fomatting of headers -> fixup. and documentation fixing.
[framework/uifw/elementary.git] / src / lib / elm_glview.h
1 /**
2  * @defgroup GLView
3  *
4  * A simple GLView widget that allows GL rendering.
5  *
6  * Signals that you can add callbacks for are:
7  *
8  * @{
9  */
10
11 typedef void (*Elm_GLView_Func_Cb)(Evas_Object *obj);
12
13 typedef enum _Elm_GLView_Mode
14 {
15    ELM_GLVIEW_ALPHA = 1,
16    ELM_GLVIEW_DEPTH = 2,
17    ELM_GLVIEW_STENCIL = 4
18 } Elm_GLView_Mode;
19
20 /**
21  * Defines a policy for the glview resizing.
22  *
23  * @note Default is ELM_GLVIEW_RESIZE_POLICY_RECREATE
24  */
25 typedef enum _Elm_GLView_Resize_Policy
26 {
27    ELM_GLVIEW_RESIZE_POLICY_RECREATE = 1, /**< Resize the internal surface along with the image */
28    ELM_GLVIEW_RESIZE_POLICY_SCALE = 2 /**< Only reize the internal image and not the surface */
29 } Elm_GLView_Resize_Policy;
30
31 typedef enum _Elm_GLView_Render_Policy
32 {
33    ELM_GLVIEW_RENDER_POLICY_ON_DEMAND = 1, /**< Render only when there is a need for redrawing */
34    ELM_GLVIEW_RENDER_POLICY_ALWAYS = 2 /**< Render always even when it is not visible */
35 } Elm_GLView_Render_Policy;
36
37 /**
38  * Add a new glview to the parent
39  *
40  * @param parent The parent object
41  * @return The new object or NULL if it cannot be created
42  *
43  * @ingroup GLView
44  */
45 EAPI Evas_Object *
46                   elm_glview_add(Evas_Object *parent)
47 EINA_ARG_NONNULL(1);
48
49 /**
50  * Sets the size of the glview
51  *
52  * @param obj The glview object
53  * @param width width of the glview object
54  * @param height height of the glview object
55  *
56  * @ingroup GLView
57  */
58 EAPI void         elm_glview_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height) EINA_ARG_NONNULL(1);
59
60 /**
61  * Gets the size of the glview.
62  *
63  * @param obj The glview object
64  * @param width width of the glview object
65  * @param height height of the glview object
66  *
67  * Note that this function returns the actual image size of the
68  * glview.  This means that when the scale policy is set to
69  * ELM_GLVIEW_RESIZE_POLICY_SCALE, it'll return the non-scaled
70  * size.
71  *
72  * @ingroup GLView
73  */
74 EAPI void         elm_glview_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) EINA_ARG_NONNULL(1);
75
76 /**
77  * Gets the gl api struct for gl rendering
78  *
79  * @param obj The glview object
80  * @return The api object or NULL if it cannot be created
81  *
82  * @ingroup GLView
83  */
84 EAPI Evas_GL_API *elm_glview_gl_api_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
85
86 /**
87  * Set the mode of the GLView. Supports Three simple modes.
88  *
89  * @param obj The glview object
90  * @param mode The mode Options OR'ed enabling Alpha, Depth, Stencil.
91  * @return True if set properly.
92  *
93  * @ingroup GLView
94  */
95 EAPI Eina_Bool    elm_glview_mode_set(Evas_Object *obj, Elm_GLView_Mode mode) EINA_ARG_NONNULL(1);
96
97 /**
98  * Set the resize policy for the glview object.
99  *
100  * @param obj The glview object.
101  * @param policy The scaling policy.
102  *
103  * By default, the resize policy is set to
104  * ELM_GLVIEW_RESIZE_POLICY_RECREATE.  When resize is called it
105  * destroys the previous surface and recreates the newly specified
106  * size. If the policy is set to ELM_GLVIEW_RESIZE_POLICY_SCALE,
107  * however, glview only scales the image object and not the underlying
108  * GL Surface.
109  *
110  * @ingroup GLView
111  */
112 EAPI Eina_Bool    elm_glview_resize_policy_set(Evas_Object *obj, Elm_GLView_Resize_Policy policy) EINA_ARG_NONNULL(1);
113
114 /**
115  * Set the render policy for the glview object.
116  *
117  * @param obj The glview object.
118  * @param policy The render policy.
119  *
120  * By default, the render policy is set to
121  * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND.  This policy is set such
122  * that during the render loop, glview is only redrawn if it needs
123  * to be redrawn. (i.e. When it is visible) If the policy is set to
124  * ELM_GLVIEWW_RENDER_POLICY_ALWAYS, it redraws regardless of
125  * whether it is visible/need redrawing or not.
126  *
127  * @ingroup GLView
128  */
129 EAPI Eina_Bool    elm_glview_render_policy_set(Evas_Object *obj, Elm_GLView_Render_Policy policy) EINA_ARG_NONNULL(1);
130
131 /**
132  * Set the init function that runs once in the main loop.
133  *
134  * @param obj The glview object.
135  * @param func The init function to be registered.
136  *
137  * The registered init function gets called once during the render loop.
138  *
139  * @ingroup GLView
140  */
141 EAPI void         elm_glview_init_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) EINA_ARG_NONNULL(1);
142
143 /**
144  * Set the render function that runs in the main loop.
145  *
146  * @param obj The glview object.
147  * @param func The delete function to be registered.
148  *
149  * The registered del function gets called when GLView object is deleted.
150  *
151  * @ingroup GLView
152  */
153 EAPI void         elm_glview_del_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) EINA_ARG_NONNULL(1);
154
155 /**
156  * Set the resize function that gets called when resize happens.
157  *
158  * @param obj The glview object.
159  * @param func The resize function to be registered.
160  *
161  * @ingroup GLView
162  */
163 EAPI void         elm_glview_resize_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) EINA_ARG_NONNULL(1);
164
165 /**
166  * Set the render function that runs in the main loop.
167  *
168  * @param obj The glview object.
169  * @param func The render function to be registered.
170  *
171  * @ingroup GLView
172  */
173 EAPI void         elm_glview_render_func_set(Evas_Object *obj, Elm_GLView_Func_Cb func) EINA_ARG_NONNULL(1);
174
175 /**
176  * Notifies that there has been changes in the GLView.
177  *
178  * @param obj The glview object.
179  *
180  * @ingroup GLView
181  */
182 EAPI void         elm_glview_changed_set(Evas_Object *obj) EINA_ARG_NONNULL(1);
183
184 /**
185  * @}
186  */