1 #ifndef ELM_WIDGET_GLVIEW_H
2 #define ELM_WIDGET_GLVIEW_H
8 * @section elm-glview-class The Elementary Glview Class
10 * Elementary, besides having the @ref Glview widget, exposes its
11 * foundation -- the Elementary Glview Class -- in order to create other
12 * widgets which are a glview with some more logic on top.
16 * @def ELM_GLVIEW_CLASS
18 * Use this macro to cast whichever subclass of
19 * #Elm_Glview_Smart_Class into it, so to access its fields.
23 #define ELM_GLVIEW_CLASS(x) ((Elm_Glview_Smart_Class *) x)
26 * @def ELM_GLVIEW_DATA
28 * Use this macro to cast whichever subdata of
29 * #Elm_Glview_Smart_Data into it, so to access its fields.
33 #define ELM_GLVIEW_DATA(x) ((Elm_Glview_Smart_Data *) x)
36 * @def ELM_GLVIEW_SMART_CLASS_VERSION
38 * Current version for Elementary glview @b base smart class, a value
39 * which goes to _Elm_Glview_Smart_Class::version.
43 #define ELM_GLVIEW_SMART_CLASS_VERSION 1
46 * @def ELM_GLVIEW_SMART_CLASS_INIT
48 * Initializer for a whole #Elm_Glview_Smart_Class structure, with
49 * @c NULL values on its specific fields.
51 * @param smart_class_init initializer to use for the "base" field
52 * (#Evas_Smart_Class).
54 * @see EVAS_SMART_CLASS_INIT_NULL
55 * @see EVAS_SMART_CLASS_INIT_NAME_VERSION
56 * @see ELM_GLVIEW_SMART_CLASS_INIT_NULL
57 * @see ELM_GLVIEW_SMART_CLASS_INIT_NAME_VERSION
61 #define ELM_GLVIEW_SMART_CLASS_INIT(smart_class_init) \
62 {smart_class_init, ELM_GLVIEW_SMART_CLASS_VERSION}
65 * @def ELM_GLVIEW_SMART_CLASS_INIT_NULL
67 * Initializer to zero out a whole #Elm_Glview_Smart_Class structure.
69 * @see ELM_GLVIEW_SMART_CLASS_INIT_NAME_VERSION
70 * @see ELM_GLVIEW_SMART_CLASS_INIT
74 #define ELM_GLVIEW_SMART_CLASS_INIT_NULL \
75 ELM_GLVIEW_SMART_CLASS_INIT(EVAS_SMART_CLASS_INIT_NULL)
78 * @def ELM_GLVIEW_SMART_CLASS_INIT_NAME_VERSION
80 * Initializer to zero out a whole #Elm_Glview_Smart_Class structure and
81 * set its name and version.
83 * This is similar to #ELM_GLVIEW_SMART_CLASS_INIT_NULL, but it will
84 * also set the version field of #Elm_Glview_Smart_Class (base field)
85 * to the latest #ELM_GLVIEW_SMART_CLASS_VERSION and name it to the
88 * It will keep a reference to the name field as a <c>"const char *"</c>,
89 * i.e., the name must be available while the structure is
90 * used (hint: static or global variable!) and must not be modified.
92 * @see ELM_GLVIEW_SMART_CLASS_INIT_NULL
93 * @see ELM_GLVIEW_SMART_CLASS_INIT
97 #define ELM_GLVIEW_SMART_CLASS_INIT_NAME_VERSION(name) \
98 ELM_GLVIEW_SMART_CLASS_INIT(ELM_WIDGET_SMART_CLASS_INIT_NAME_VERSION(name))
101 * Elementary glview base smart class. This inherits directly from
102 * #Elm_Widget_Smart_Class and is meant to build widgets extending the
103 * behavior of a glview.
105 * All of the functions listed on @ref Glview namespace will work for
106 * objects deriving from #Elm_Glview_Smart_Class.
108 typedef struct _Elm_Glview_Smart_Class
110 Elm_Widget_Smart_Class base;
112 int version; /**< Version of this smart class definition */
113 } Elm_Glview_Smart_Class;
116 * Base widget smart data extended with glview instance data.
118 typedef struct _Elm_Glview_Smart_Data Elm_Glview_Smart_Data;
119 struct _Elm_Glview_Smart_Data
121 Elm_Widget_Smart_Data base; /* base widget smart data as
122 * first member obligatory, as
123 * we're inheriting from it */
125 Elm_GLView_Mode mode;
126 Elm_GLView_Resize_Policy scale_policy;
127 Elm_GLView_Render_Policy render_policy;
130 Evas_GL_Config *config;
131 Evas_GL_Surface *surface;
132 Evas_GL_Context *context;
136 Elm_GLView_Func_Cb init_func;
137 Elm_GLView_Func_Cb del_func;
138 Elm_GLView_Func_Cb resize_func;
139 Elm_GLView_Func_Cb render_func;
141 Ecore_Idle_Enterer *render_idle_enterer;
143 Eina_Bool initialized : 1;
144 Eina_Bool resized : 1;
151 EAPI extern const char ELM_GLVIEW_SMART_NAME[];
152 EAPI const Elm_Glview_Smart_Class *elm_glview_smart_class_get(void);
154 #define ELM_GLVIEW_DATA_GET(o, sd) \
155 Elm_Glview_Smart_Data * sd = evas_object_smart_data_get(o)
157 #define ELM_GLVIEW_DATA_GET_OR_RETURN(o, ptr) \
158 ELM_GLVIEW_DATA_GET(o, ptr); \
161 CRITICAL("No widget data for object %p (%s)", \
162 o, evas_object_type_get(o)); \
166 #define ELM_GLVIEW_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
167 ELM_GLVIEW_DATA_GET(o, ptr); \
170 CRITICAL("No widget data for object %p (%s)", \
171 o, evas_object_type_get(o)); \
175 #define ELM_GLVIEW_CHECK(obj) \
176 if (!obj || !elm_widget_type_check((obj), ELM_GLVIEW_SMART_NAME, __func__)) \