// Call the init function if it hasn't been called already
if (!sd->initialized)
{
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_CREATED, NULL);
if (sd->init_func) sd->init_func(obj);
sd->initialized = EINA_TRUE;
}
if (sd->resized)
{
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_RESIZED, NULL);
if (sd->resize_func) sd->resize_func(obj);
sd->resized = EINA_FALSE;
}
evas_sync(evas_object_evas_get(obj));
// Call the render function
if (sd->render_func) sd->render_func(obj);
+ //TODO:will be optimized
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_RENDER, NULL);
// Depending on the policy return true or false
if (sd->render_policy == ELM_GLVIEW_RENDER_POLICY_ON_DEMAND)
evas_gl_make_current(sd->evasgl, sd->surface, sd->context);
sd->del_func(obj);
}
+ //TODO:will be optimised
+ eo_event_callback_call(obj, ELM_GLVIEW_EVENT_DESTROYED, NULL);
ecore_idle_enterer_del(sd->render_idle_enterer);
evas_gl_make_current(sd->evasgl, NULL, NULL);
evas_obj_smart_del(eo_super(obj, MY_CLASS));
}
+static Eina_Bool
+_cb_added(void *data EINA_UNUSED, const Eo_Event *ev)
+{
+ const Eo_Callback_Array_Item *event = ev->event_info;
+
+ ELM_GLVIEW_DATA_GET(ev->obj, sd);
+
+ if (event->desc == ELM_GLVIEW_EVENT_CREATED)
+ {
+ sd->initialized = EINA_FALSE;
+ }
+ else if (event->desc == ELM_GLVIEW_EVENT_RENDER)
+ {
+ _set_render_policy_callback(ev->obj);
+ }
+
+ return EO_CALLBACK_CONTINUE;
+}
+
EAPI Evas_Object *
elm_glview_add(Evas_Object *parent)
{
evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY);
evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks);
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_ANIMATION);
+ eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_ADD, _cb_added, NULL);
}
EOLIAN static Eo *
}
EOLIAN static void
-_elm_glview_init_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->initialized = EINA_FALSE;
- sd->init_func = func;
-}
-
-EOLIAN static void
-_elm_glview_del_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->del_func = func;
-}
-
-EOLIAN static void
-_elm_glview_resize_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->resize_func = func;
-}
-
-EOLIAN static void
-_elm_glview_render_func_set(Eo *obj EINA_UNUSED, Elm_Glview_Data *sd, Elm_GLView_Func_Cb func)
-{
- sd->render_func = func;
- _set_render_policy_callback(obj);
-}
-
-EOLIAN static void
_elm_glview_draw_request(Eo *obj, Elm_Glview_Data *sd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
-/* Legacy wrappers */
-
+/* Legacy deprecated functions */
EAPI void
elm_glview_changed_set(Evas_Object *obj)
{
{
efl_gfx_view_size_set(obj, w, h);
}
+
+EAPI void
+elm_glview_init_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->initialized = EINA_FALSE;
+ sd->init_func = func;
+}
+
+EAPI void
+elm_glview_del_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->del_func = func;
+}
+
+EAPI void
+elm_glview_resize_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->resize_func = func;
+}
+
+EAPI void
+elm_glview_render_func_set(Elm_Glview *obj, Elm_GLView_Func_Cb func)
+{
+ ELM_GLVIEW_CHECK(obj);
+ ELM_GLVIEW_DATA_GET(obj, sd);
+
+ sd->render_func = func;
+ _set_render_policy_callback(obj);
+}
#include "elm_glview.eo.c"
policy: Elm.GLView.Resize.Policy; [[The scaling policy.]]
}
}
- @property 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
- alls that they desire when resize happens.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb; [[The resize function to be registered.]]
- }
- }
- @property 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.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The delete function to be registered.]]
- }
- }
- @property 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.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The init function to be registered.]]
- }
- }
@property render_policy {
set {
[[Set the render policy for the glview object.
mode: Elm.GLView.Mode; [[The mode Options OR'ed enabling Alpha, Depth, Stencil, Direct.]]
}
}
- @property 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
- @.draw_request called.
- ]]
- }
- values {
- func: Elm_GLView_Func_Cb @nullable; [[The render function to be registered.]]
- }
- }
@property gl_api {
get {
[[Get the gl api struct for gl rendering.]]
Efl.Gfx.View.view_size.set;
}
events {
+ created; [[Event dispatched when first render happens.
+
+ The callback function gets called once during the
+ render loop. Callback 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.
+ ]]
+ destroyed; [[Event dispatched when GLView object is deleted.
+
+ The registered destroyed function gets called when GLView object
+ is deleted. Callback 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.
+ ]]
+ resized; [[Event dispatched when resize happens.
+
+ The resized event callback functions gets called
+ during the render loop. The callback function allows
+ glview to hide all the rendering context/surface
+ details and have the user just call GL alls that
+ they desire when resize happens.
+ ]]
+ render; [[Event dispatched when GLView is rendered.
+
+ The callback function gets called in the main loop but whether
+ it runs depends on the rendering policy and whether
+ @.draw_request gets called.
+ ]]
}
constructors {
.version_constructor;