forked from enlightenment/efl
Eolian: Integration of GLView
This commit is contained in:
parent
809fbeda4d
commit
2fe064a1ec
|
@ -587,7 +587,9 @@ BUILT_SOURCES = \
|
|||
elm_flip.eo.c \
|
||||
elm_flip.eo.h \
|
||||
elm_gesture_layer.eo.c \
|
||||
elm_gesture_layer.eo.h
|
||||
elm_gesture_layer.eo.h \
|
||||
elm_glview.eo.c \
|
||||
elm_glview.eo.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
elm_widget.eo \
|
||||
|
@ -621,7 +623,8 @@ EXTRA_DIST += \
|
|||
elm_diskselector.eo \
|
||||
elm_entry.eo \
|
||||
elm_flip.eo \
|
||||
elm_gesture_layer.eo
|
||||
elm_gesture_layer.eo \
|
||||
elm_glview.eo
|
||||
|
||||
nodist_includesunstable_HEADERS = \
|
||||
elm_widget.eo.h \
|
||||
|
@ -655,5 +658,6 @@ nodist_includesunstable_HEADERS = \
|
|||
elm_diskselector.eo.h \
|
||||
elm_entry.eo.h \
|
||||
elm_flip.eo.h \
|
||||
elm_gesture_layer.eo.h
|
||||
elm_gesture_layer.eo.h \
|
||||
elm_glview.eo.h
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "elm_priv.h"
|
||||
#include "elm_widget_glview.h"
|
||||
|
||||
EAPI Eo_Op ELM_OBJ_GLVIEW_BASE_ID = EO_NOOP;
|
||||
|
||||
#define MY_CLASS ELM_OBJ_GLVIEW_CLASS
|
||||
|
||||
#define MY_CLASS_NAME "Elm_Glview"
|
||||
|
@ -27,23 +25,21 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
_elm_glview_smart_on_focus(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_glview_elm_widget_on_focus(Eo *obj, Elm_Glview_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
Eina_Bool int_ret = EINA_FALSE;
|
||||
|
||||
eo_do_super(obj, MY_CLASS, elm_obj_widget_on_focus(&int_ret));
|
||||
if (!int_ret) return;
|
||||
if (!int_ret) return EINA_FALSE;
|
||||
|
||||
if (elm_widget_focus_get(obj))
|
||||
evas_object_focus_set(wd->resize_obj, EINA_TRUE);
|
||||
else
|
||||
evas_object_focus_set(wd->resize_obj, EINA_FALSE);
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -76,13 +72,9 @@ _glview_update_surface(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_glview_smart_resize(Eo *obj, void *_pd, va_list *list)
|
||||
EOLIAN static void
|
||||
_elm_glview_evas_smart_resize(Eo *obj, Elm_Glview_Data *sd, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
Evas_Coord w = va_arg(*list, Evas_Coord);
|
||||
Evas_Coord h = va_arg(*list, Evas_Coord);
|
||||
Elm_Glview_Smart_Data * sd = _pd;
|
||||
|
||||
eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h));
|
||||
|
||||
sd->resized = EINA_TRUE;
|
||||
|
@ -186,10 +178,9 @@ _set_render_policy_callback(Evas_Object *obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_glview_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_glview_evas_smart_add(Eo *obj, Elm_Glview_Data *priv)
|
||||
{
|
||||
Elm_Glview_Smart_Data *priv = _pd;
|
||||
Evas_Object *img;
|
||||
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
|
@ -243,11 +234,9 @@ _elm_glview_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_glview_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_glview_evas_smart_del(Eo *obj, Elm_Glview_Data *sd)
|
||||
{
|
||||
Elm_Glview_Smart_Data * sd = _pd;
|
||||
|
||||
// Call delete func if it's registered
|
||||
if (sd->del_func)
|
||||
{
|
||||
|
@ -274,10 +263,9 @@ elm_glview_add(Evas_Object *parent)
|
|||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_elm_glview_eo_base_constructor(Eo *obj, Elm_Glview_Data *sd)
|
||||
{
|
||||
const Elm_Glview_Smart_Data *sd = _pd;
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
eo_do(obj,
|
||||
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
||||
|
@ -290,40 +278,16 @@ _constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Evas_GL_API *
|
||||
elm_glview_gl_api_get(const Evas_Object *obj)
|
||||
EOLIAN static Evas_GL_API*
|
||||
_elm_glview_gl_api_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj) NULL;
|
||||
Evas_GL_API *ret = NULL;
|
||||
eo_do((Eo *)obj, elm_obj_glview_gl_api_get(&ret));
|
||||
return ret;
|
||||
return evas_gl_api_get(sd->evasgl);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_api_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_glview_mode_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Mode mode)
|
||||
{
|
||||
Evas_GL_API **ret = va_arg(*list, Evas_GL_API **);
|
||||
const Elm_Glview_Smart_Data *sd = _pd;
|
||||
*ret = evas_gl_api_get(sd->evasgl);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_glview_mode_set(Evas_Object *obj,
|
||||
Elm_GLView_Mode mode)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do(obj, elm_obj_glview_mode_set(mode, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_mode_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Mode mode = va_arg(*list, Elm_GLView_Mode);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
|
||||
// Set the configs
|
||||
if (mode & ELM_GLVIEW_ALPHA) sd->config->color_format = EVAS_GL_RGBA_8888;
|
||||
|
@ -351,28 +315,13 @@ _mode_set(Eo *obj, void *_pd, va_list *list)
|
|||
_glview_update_surface(obj);
|
||||
elm_glview_changed_set(obj);
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_glview_resize_policy_set(Evas_Object *obj,
|
||||
Elm_GLView_Resize_Policy policy)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_glview_resize_policy_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Resize_Policy policy)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do(obj, elm_obj_glview_resize_policy_set(policy, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_resize_policy_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Resize_Policy policy = va_arg(*list, Elm_GLView_Resize_Policy);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
if (policy == sd->scale_policy) return;
|
||||
if (policy == sd->scale_policy) return EINA_TRUE;
|
||||
switch (policy)
|
||||
{
|
||||
case ELM_GLVIEW_RESIZE_POLICY_RECREATE:
|
||||
|
@ -380,63 +329,37 @@ _resize_policy_set(Eo *obj, void *_pd, va_list *list)
|
|||
sd->scale_policy = policy;
|
||||
_glview_update_surface(obj);
|
||||
elm_glview_changed_set(obj);
|
||||
return;
|
||||
return EINA_TRUE;
|
||||
|
||||
default:
|
||||
ERR("Invalid Scale Policy.\n");
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_glview_render_policy_set(Evas_Object *obj,
|
||||
Elm_GLView_Render_Policy policy)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_glview_render_policy_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Render_Policy policy)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do(obj, elm_obj_glview_render_policy_set(policy, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_render_policy_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Render_Policy policy = va_arg(*list, Elm_GLView_Render_Policy);
|
||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
|
||||
if ((policy != ELM_GLVIEW_RENDER_POLICY_ON_DEMAND) &&
|
||||
(policy != ELM_GLVIEW_RENDER_POLICY_ALWAYS))
|
||||
{
|
||||
ERR("Invalid Render Policy.\n");
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (sd->render_policy == policy) return;
|
||||
if (sd->render_policy == policy) return EINA_TRUE;
|
||||
|
||||
sd->render_policy = policy;
|
||||
_set_render_policy_callback(obj);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_size_set(Evas_Object *obj,
|
||||
int w,
|
||||
int h)
|
||||
EOLIAN static void
|
||||
_elm_glview_size_set(Eo *obj, Elm_Glview_Data *sd, int w, int h)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_size_set(w, h));
|
||||
}
|
||||
|
||||
static void
|
||||
_size_set(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
int w = va_arg(*list, int);
|
||||
int h = va_arg(*list, int);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
if ((w == sd->w) && (h == sd->h)) return;
|
||||
|
||||
sd->w = w;
|
||||
|
@ -446,107 +369,42 @@ _size_set(Eo *obj, void *_pd, va_list *list)
|
|||
elm_glview_changed_set(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_size_get(const Evas_Object *obj,
|
||||
int *w,
|
||||
int *h)
|
||||
EOLIAN static void
|
||||
_elm_glview_size_get(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, int *w, int *h)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do((Eo *) obj, elm_obj_glview_size_get(w, h));
|
||||
}
|
||||
|
||||
static void
|
||||
_size_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
int *w = va_arg(*list, int *);
|
||||
int *h = va_arg(*list, int *);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
if (w) *w = sd->w;
|
||||
if (h) *h = sd->h;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_init_func_set(Evas_Object *obj,
|
||||
Elm_GLView_Func_Cb func)
|
||||
EOLIAN static void
|
||||
_elm_glview_init_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_init_func_set(func));
|
||||
}
|
||||
|
||||
static void
|
||||
_init_func_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Func_Cb func = va_arg(*list, Elm_GLView_Func_Cb);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
sd->initialized = EINA_FALSE;
|
||||
sd->init_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_del_func_set(Evas_Object *obj,
|
||||
Elm_GLView_Func_Cb func)
|
||||
EOLIAN static void
|
||||
_elm_glview_del_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_del_func_set(func));
|
||||
}
|
||||
|
||||
static void
|
||||
_del_func_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Func_Cb func = va_arg(*list, Elm_GLView_Func_Cb);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
sd->del_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_resize_func_set(Evas_Object *obj,
|
||||
Elm_GLView_Func_Cb func)
|
||||
EOLIAN static void
|
||||
_elm_glview_resize_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_resize_func_set(func));
|
||||
}
|
||||
|
||||
static void
|
||||
_resize_func_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Func_Cb func = va_arg(*list, Elm_GLView_Func_Cb);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
sd->resize_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_render_func_set(Evas_Object *obj,
|
||||
Elm_GLView_Func_Cb func)
|
||||
EOLIAN static void
|
||||
_elm_glview_render_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_render_func_set(func));
|
||||
}
|
||||
|
||||
static void
|
||||
_render_func_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_GLView_Func_Cb func = va_arg(*list, Elm_GLView_Func_Cb);
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
|
||||
sd->render_func = func;
|
||||
_set_render_policy_callback(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_glview_changed_set(Evas_Object *obj)
|
||||
EOLIAN static void
|
||||
_elm_glview_changed_set(Eo *obj, Elm_Glview_Data *sd)
|
||||
{
|
||||
ELM_GLVIEW_CHECK(obj);
|
||||
eo_do(obj, elm_obj_glview_changed_set());
|
||||
}
|
||||
|
||||
static void
|
||||
_changed_set(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
{
|
||||
Elm_Glview_Smart_Data *sd = _pd;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
evas_object_image_pixels_dirty_set
|
||||
|
@ -558,59 +416,9 @@ _changed_set(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eo_Class *klass)
|
||||
_elm_glview_class_constructor(Eo_Class *klass)
|
||||
{
|
||||
const Eo_Op_Func_Description func_desc[] = {
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_glview_smart_add),
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_glview_smart_del),
|
||||
EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_RESIZE), _elm_glview_smart_resize),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_WIDGET_ID(ELM_OBJ_WIDGET_SUB_ID_ON_FOCUS), _elm_glview_smart_on_focus),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_GL_API_GET), _gl_api_get),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_MODE_SET), _mode_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_RESIZE_POLICY_SET), _resize_policy_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_RENDER_POLICY_SET), _render_policy_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_SIZE_SET), _size_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_SIZE_GET), _size_get),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_INIT_FUNC_SET), _init_func_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_DEL_FUNC_SET), _del_func_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_RESIZE_FUNC_SET), _resize_func_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_RENDER_FUNC_SET), _render_func_set),
|
||||
EO_OP_FUNC(ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_CHANGED_SET), _changed_set),
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
eo_class_funcs_set(klass, func_desc);
|
||||
|
||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
}
|
||||
|
||||
static const Eo_Op_Description op_desc[] = {
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_GL_API_GET, "Get the gl api struct for gl rendering."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_MODE_SET, "Set the mode of the GLView."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_RESIZE_POLICY_SET, "Set the resize policy for the glview object."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_RENDER_POLICY_SET, "Set the render policy for the glview object."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_SIZE_SET, "Sets the size of the glview."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_SIZE_GET, "Get the size of the glview."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_INIT_FUNC_SET, "Set the init function that runs once in the main loop."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_DEL_FUNC_SET, "Set the render function that runs in the main loop."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_RESIZE_FUNC_SET, "Set the resize function that gets called when resize happens."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_RENDER_FUNC_SET, "Set the render function that runs in the main loop."),
|
||||
EO_OP_DESCRIPTION(ELM_OBJ_GLVIEW_SUB_ID_CHANGED_SET, "Notifies that there has been changes in the GLView."),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_GLVIEW_BASE_ID, op_desc, ELM_OBJ_GLVIEW_SUB_ID_LAST),
|
||||
NULL,
|
||||
sizeof(Elm_Glview_Smart_Data),
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
||||
EO_DEFINE_CLASS(elm_obj_glview_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);
|
||||
#include "elm_glview.eo.c"
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
class Elm_Glview (Elm_Widget)
|
||||
{
|
||||
eo_prefix: elm_obj_glview;
|
||||
properties {
|
||||
size {
|
||||
set {
|
||||
/*@
|
||||
Sets the size of the glview
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
Get the size of the glview.
|
||||
|
||||
Note that this function returns the actual image size of the
|
||||
glview. This means that when the scale policy is set to
|
||||
ELM_GLVIEW_RESIZE_POLICY_SCALE, it'll return the non-scaled
|
||||
size.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
values {
|
||||
int w; /*@ width of the glview object */
|
||||
int h; /*@ height of the glview object */
|
||||
}
|
||||
}
|
||||
resize_policy {
|
||||
set {
|
||||
/*@
|
||||
Set the resize policy for the glview object.
|
||||
|
||||
By default, the resize policy is set to ELM_GLVIEW_RESIZE_POLICY_RECREATE.
|
||||
When resize is called it destroys the previous surface and recreates the
|
||||
newly specified size. If the policy is set to
|
||||
ELM_GLVIEW_RESIZE_POLICY_SCALE, however, glview only scales the image
|
||||
object and not the underlying GL Surface.
|
||||
|
||||
@ingroup GLView */
|
||||
return Eina_Bool;
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Resize_Policy policy; /*@ The scaling policy. */
|
||||
}
|
||||
}
|
||||
changed {
|
||||
set {
|
||||
/*@
|
||||
Notifies that there has been changes in the GLView.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
}
|
||||
resize_func {
|
||||
set {
|
||||
/*@
|
||||
Set the resize function that gets called when resize happens.
|
||||
|
||||
The resize function gets called during the render loop.
|
||||
This function allows glview to hide all the rendering context/surface
|
||||
details and have the user just call GL calls that they desire
|
||||
when resize happens.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Func_Cb func; /*@ The resize function to be registered. */
|
||||
}
|
||||
}
|
||||
del_func {
|
||||
set {
|
||||
/*@
|
||||
Set the render function that runs in the main loop.
|
||||
|
||||
The registered del function gets called when GLView object is deleted.
|
||||
This function allows glview to hide all the rendering context/surface
|
||||
details and have the user just call GL calls that they desire
|
||||
when delete happens.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Func_Cb func; /*@ The delete function to be registered. */
|
||||
}
|
||||
}
|
||||
init_func {
|
||||
set {
|
||||
/*@
|
||||
Set the init function that runs once in the main loop.
|
||||
|
||||
The registered init function gets called once during the render loop.
|
||||
This function allows glview to hide all the rendering context/surface
|
||||
details and have the user just call GL calls that they desire
|
||||
for initialization GL calls.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Func_Cb func; /*@ The init function to be registered. */
|
||||
}
|
||||
}
|
||||
render_policy {
|
||||
set {
|
||||
/*@
|
||||
Set the render policy for the glview object.
|
||||
|
||||
By default, the render policy is set to ELM_GLVIEW_RENDER_POLICY_ON_DEMAND.
|
||||
This policy is set such that during the render loop, glview is only
|
||||
redrawn if it needs to be redrawn. (i.e. when it is visible) If the policy
|
||||
is set to ELM_GLVIEWW_RENDER_POLICY_ALWAYS, it redraws regardless of
|
||||
whether it is visible or needs redrawing.
|
||||
|
||||
@ingroup GLView */
|
||||
return Eina_Bool;
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Render_Policy policy; /*@ The render policy. */
|
||||
}
|
||||
}
|
||||
mode {
|
||||
set {
|
||||
/*@
|
||||
Set the mode of the GLView. Supports alpha, depth, stencil.
|
||||
|
||||
@return True if set properly.
|
||||
|
||||
Direct is a hint for the elm_glview to render directly to the window
|
||||
given that the right conditions are met. Otherwise it falls back
|
||||
to rendering to an offscreen buffer before it gets composited to the
|
||||
window.
|
||||
|
||||
@ingroup GLView */
|
||||
return Eina_Bool;
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Mode mode; /*@ The mode Options OR'ed enabling Alpha, Depth, Stencil, Direct. */
|
||||
}
|
||||
}
|
||||
render_func {
|
||||
set {
|
||||
/*@
|
||||
Set the render function that runs in the main loop.
|
||||
|
||||
The render function gets called in the main loop but whether it runs
|
||||
depends on the rendering policy and whether elm_glview_changed_set()
|
||||
gets called.
|
||||
|
||||
@ingroup GLView */
|
||||
}
|
||||
values {
|
||||
Elm_GLView_Func_Cb func; /*@ The render function to be registered. */
|
||||
}
|
||||
}
|
||||
gl_api {
|
||||
get {
|
||||
/*@
|
||||
Get the gl api struct for gl rendering
|
||||
|
||||
@return The api object or NULL if it cannot be created
|
||||
|
||||
@ingroup GLView */
|
||||
return Evas_GL_API *;
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class::constructor;
|
||||
Eo_Base::constructor;
|
||||
Evas_Smart::add;
|
||||
Evas_Smart::del;
|
||||
Evas_Smart::resize;
|
||||
Elm_Widget::on_focus;
|
||||
}
|
||||
events {
|
||||
focused;
|
||||
unfocused;
|
||||
language,changed;
|
||||
access,changed;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
#include "elm_glview.eo.h"
|
||||
|
||||
#if 0
|
||||
#define ELM_OBJ_GLVIEW_CLASS elm_obj_glview_class_get()
|
||||
|
||||
const Eo_Class *elm_obj_glview_class_get(void) EINA_CONST;
|
||||
|
@ -180,3 +183,4 @@ enum
|
|||
* @ingroup GLView
|
||||
*/
|
||||
#define elm_obj_glview_changed_set() ELM_OBJ_GLVIEW_ID(ELM_OBJ_GLVIEW_SUB_ID_CHANGED_SET)
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
/**
|
||||
* Base widget smart data extended with glview instance data.
|
||||
*/
|
||||
typedef struct _Elm_Glview_Smart_Data Elm_Glview_Smart_Data;
|
||||
struct _Elm_Glview_Smart_Data
|
||||
typedef struct _Elm_Glview_Data Elm_Glview_Data;
|
||||
struct _Elm_Glview_Data
|
||||
{
|
||||
Elm_GLView_Mode mode;
|
||||
Elm_GLView_Resize_Policy scale_policy;
|
||||
|
@ -47,7 +47,7 @@ struct _Elm_Glview_Smart_Data
|
|||
*/
|
||||
|
||||
#define ELM_GLVIEW_DATA_GET(o, sd) \
|
||||
Elm_Glview_Smart_Data * sd = eo_data_scope_get(o, ELM_OBJ_GLVIEW_CLASS)
|
||||
Elm_Glview_Data * sd = eo_data_scope_get(o, ELM_OBJ_GLVIEW_CLASS)
|
||||
|
||||
#define ELM_GLVIEW_DATA_GET_OR_RETURN(o, ptr) \
|
||||
ELM_GLVIEW_DATA_GET(o, ptr); \
|
||||
|
|
Loading…
Reference in New Issue