b5951c5a586d0b4af6576fe8795c7df65d28148a
[profile/ivi/clutter.git] / clutter / clutter-types.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *
8  * Copyright (C) 2006 OpenedHand
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <clutter/clutter.h> can be included directly."
26 #endif
27
28 #ifndef __CLUTTER_TYPES_H__
29 #define __CLUTTER_TYPES_H__
30
31 #include <glib-object.h>
32
33 G_BEGIN_DECLS
34
35 #define CLUTTER_TYPE_ACTOR_BOX          (clutter_actor_box_get_type ())
36 #define CLUTTER_TYPE_GEOMETRY           (clutter_geometry_get_type ())
37 #define CLUTTER_TYPE_KNOT               (clutter_knot_get_type ())
38 #define CLUTTER_TYPE_PAINT_VOLUME       (clutter_paint_volume_get_type ())
39 #define CLUTTER_TYPE_VERTEX             (clutter_vertex_get_type ())
40
41 /* Forward delarations to avoid header catch 22's */
42 typedef struct _ClutterActor            ClutterActor;
43
44 typedef struct _ClutterStage            ClutterStage;
45 typedef struct _ClutterContainer        ClutterContainer; /* dummy */
46 typedef struct _ClutterChildMeta        ClutterChildMeta;
47 typedef struct _ClutterLayoutMeta       ClutterLayoutMeta;
48 typedef struct _ClutterActorMeta        ClutterActorMeta;
49
50 typedef struct _ClutterAnimator         ClutterAnimator;
51
52 typedef struct _ClutterAction           ClutterAction;
53 typedef struct _ClutterConstraint       ClutterConstraint;
54 typedef struct _ClutterEffect           ClutterEffect;
55
56 typedef struct _ClutterShader           ClutterShader;
57
58 typedef struct _ClutterColor            ClutterColor;
59
60 typedef union _ClutterEvent             ClutterEvent;
61
62 /**
63  * ClutterGravity:
64  * @CLUTTER_GRAVITY_NONE: Do not apply any gravity
65  * @CLUTTER_GRAVITY_NORTH: Scale from topmost downwards
66  * @CLUTTER_GRAVITY_NORTH_EAST: Scale from the top right corner
67  * @CLUTTER_GRAVITY_EAST: Scale from the right side
68  * @CLUTTER_GRAVITY_SOUTH_EAST: Scale from the bottom right corner
69  * @CLUTTER_GRAVITY_SOUTH: Scale from the bottom upwards
70  * @CLUTTER_GRAVITY_SOUTH_WEST: Scale from the bottom left corner
71  * @CLUTTER_GRAVITY_WEST: Scale from the left side
72  * @CLUTTER_GRAVITY_NORTH_WEST: Scale from the top left corner
73  * @CLUTTER_GRAVITY_CENTER: Scale from the center.
74  *
75  * Gravity of the scaling operations. When a gravity different than
76  * %CLUTTER_GRAVITY_NONE is used, an actor is scaled keeping the position
77  * of the specified portion at the same coordinates.
78  *
79  * Since: 0.2
80  */
81 typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
82   CLUTTER_GRAVITY_NONE       = 0,
83   CLUTTER_GRAVITY_NORTH,
84   CLUTTER_GRAVITY_NORTH_EAST,
85   CLUTTER_GRAVITY_EAST,
86   CLUTTER_GRAVITY_SOUTH_EAST,
87   CLUTTER_GRAVITY_SOUTH,
88   CLUTTER_GRAVITY_SOUTH_WEST,
89   CLUTTER_GRAVITY_WEST,
90   CLUTTER_GRAVITY_NORTH_WEST,
91   CLUTTER_GRAVITY_CENTER
92 } ClutterGravity;
93
94 typedef struct _ClutterActorBox         ClutterActorBox;
95 typedef struct _ClutterGeometry         ClutterGeometry;
96 typedef struct _ClutterKnot             ClutterKnot;
97 typedef struct _ClutterVertex           ClutterVertex;
98
99 /**
100  * ClutterPaintVolume:
101  *
102  * <structname>ClutterPaintVolume</structname> is an opaque structure
103  * whose members cannot be directly accessed.
104  *
105  * A <structname>ClutterPaintVolume</structname> represents an
106  * a bounding volume whos internal representation isn't defined but
107  * can be set and queried in terms of an axis aligned bounding box.
108  *
109  * Other internal representation and methods for describing the
110  * bounding volume may be added in the future.
111  *
112  * Since: 1.4
113  */
114 typedef struct _ClutterPaintVolume      ClutterPaintVolume;
115
116 /**
117  * ClutterVertex:
118  * @x: X coordinate of the vertex
119  * @y: Y coordinate of the vertex
120  * @z: Z coordinate of the vertex
121  *
122  * Vertex of an actor in 3D space, expressed in pixels
123  *
124  * Since: 0.4
125  */
126 struct _ClutterVertex
127 {
128   gfloat x;
129   gfloat y;
130   gfloat z;
131 };
132
133 GType          clutter_vertex_get_type (void) G_GNUC_CONST;
134 ClutterVertex *clutter_vertex_new      (gfloat               x,
135                                         gfloat               y,
136                                         gfloat               z);
137 ClutterVertex *clutter_vertex_copy     (const ClutterVertex *vertex);
138 void           clutter_vertex_free     (ClutterVertex       *vertex);
139 gboolean       clutter_vertex_equal    (const ClutterVertex *vertex_a,
140                                         const ClutterVertex *vertex_b);
141
142 /**
143  * ClutterActorBox:
144  * @x1: X coordinate of the top left corner
145  * @y1: Y coordinate of the top left corner
146  * @x2: X coordinate of the bottom right corner
147  * @y2: Y coordinate of the bottom right corner
148  *
149  * Bounding box of an actor. The coordinates of the top left and right bottom
150  * corners of an actor. The coordinates of the two points are expressed in
151  * pixels with sub-pixel precision
152  */
153 struct _ClutterActorBox
154 {
155   gfloat x1;
156   gfloat y1;
157
158   gfloat x2;
159   gfloat y2;
160 };
161
162 GType            clutter_actor_box_get_type      (void) G_GNUC_CONST;
163 ClutterActorBox *clutter_actor_box_new           (gfloat                 x_1,
164                                                   gfloat                 y_1,
165                                                   gfloat                 x_2,
166                                                   gfloat                 y_2);
167 ClutterActorBox *clutter_actor_box_copy          (const ClutterActorBox *box);
168 void             clutter_actor_box_free          (ClutterActorBox       *box);
169 gboolean         clutter_actor_box_equal         (const ClutterActorBox *box_a,
170                                                   const ClutterActorBox *box_b);
171 gfloat           clutter_actor_box_get_x         (const ClutterActorBox *box);
172 gfloat           clutter_actor_box_get_y         (const ClutterActorBox *box);
173 gfloat           clutter_actor_box_get_width     (const ClutterActorBox *box);
174 gfloat           clutter_actor_box_get_height    (const ClutterActorBox *box);
175 void             clutter_actor_box_get_origin    (const ClutterActorBox *box,
176                                                   gfloat                *x,
177                                                   gfloat                *y);
178 void             clutter_actor_box_get_size      (const ClutterActorBox *box,
179                                                   gfloat                *width,
180                                                   gfloat                *height);
181 gfloat           clutter_actor_box_get_area      (const ClutterActorBox *box);
182 gboolean         clutter_actor_box_contains      (const ClutterActorBox *box,
183                                                   gfloat                 x,
184                                                   gfloat                 y);
185 void             clutter_actor_box_from_vertices (ClutterActorBox       *box,
186                                                   const ClutterVertex    verts[]);
187 void             clutter_actor_box_interpolate   (const ClutterActorBox *initial,
188                                                   const ClutterActorBox *final,
189                                                   gdouble                progress,
190                                                   ClutterActorBox       *result);
191 void             clutter_actor_box_clamp_to_pixel (ClutterActorBox       *box);
192 void             clutter_actor_box_union          (const ClutterActorBox *a,
193                                                    const ClutterActorBox *b,
194                                                    ClutterActorBox       *result);
195
196 void             clutter_actor_box_set_origin     (ClutterActorBox       *box,
197                                                    gfloat                 x,
198                                                    gfloat                 y);
199 void             clutter_actor_box_set_size       (ClutterActorBox       *box,
200                                                    gfloat                 width,
201                                                    gfloat                 height);
202
203 /**
204  * ClutterGeometry:
205  * @x: X coordinate of the top left corner of an actor
206  * @y: Y coordinate of the top left corner of an actor
207  * @width: width of an actor
208  * @height: height of an actor
209  *
210  * The rectangle containing an actor's bounding box, measured in pixels.
211  */
212 struct _ClutterGeometry
213 {
214   /*< public >*/
215   gint   x;
216   gint   y;
217   guint  width;
218   guint  height;
219 };
220
221 GType clutter_geometry_get_type (void) G_GNUC_CONST;
222
223 void      clutter_geometry_union      (const ClutterGeometry *geometry_a,
224                                        const ClutterGeometry *geometry_b,
225                                        ClutterGeometry       *result);
226 gboolean  clutter_geometry_intersects (const ClutterGeometry *geometry0,
227                                        const ClutterGeometry *geometry1);
228
229 /**
230  * ClutterKnot:
231  * @x: X coordinate of the knot
232  * @y: Y coordinate of the knot
233  *
234  * Point in a path behaviour.
235  *
236  * Since: 0.2
237  */
238 struct _ClutterKnot
239 {
240   gint x;
241   gint y;
242 };
243
244 GType        clutter_knot_get_type (void) G_GNUC_CONST;
245 ClutterKnot *clutter_knot_copy     (const ClutterKnot *knot);
246 void         clutter_knot_free     (ClutterKnot       *knot);
247 gboolean     clutter_knot_equal    (const ClutterKnot *knot_a,
248                                     const ClutterKnot *knot_b);
249
250 /**
251  * ClutterRotateAxis:
252  * @CLUTTER_X_AXIS: Rotate around the X axis
253  * @CLUTTER_Y_AXIS: Rotate around the Y axis
254  * @CLUTTER_Z_AXIS: Rotate around the Z axis
255  *
256  * Axis of a rotation.
257  *
258  * Since: 0.4
259  */
260 typedef enum { /*< prefix=CLUTTER >*/
261   CLUTTER_X_AXIS,
262   CLUTTER_Y_AXIS,
263   CLUTTER_Z_AXIS
264 } ClutterRotateAxis;
265
266 /**
267  * ClutterRotateDirection:
268  * @CLUTTER_ROTATE_CW: Clockwise rotation
269  * @CLUTTER_ROTATE_CCW: Counter-clockwise rotation
270  *
271  * Direction of a rotation.
272  *
273  * Since: 0.4
274  */
275 typedef enum { /*< prefix=CLUTTER_ROTATE >*/
276   CLUTTER_ROTATE_CW,
277   CLUTTER_ROTATE_CCW
278 } ClutterRotateDirection;
279
280 /**
281  * ClutterRequestMode:
282  * @CLUTTER_REQUEST_HEIGHT_FOR_WIDTH: Height for width requests
283  * @CLUTTER_REQUEST_WIDTH_FOR_HEIGHT: Width for height requests
284  *
285  * Specifies the type of requests for a #ClutterActor.
286  *
287  * Since: 0.8
288  */
289 typedef enum {
290   CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
291   CLUTTER_REQUEST_WIDTH_FOR_HEIGHT
292 } ClutterRequestMode;
293
294 /**
295  * ClutterAnimationMode:
296  * @CLUTTER_CUSTOM_MODE: custom progress function
297  * @CLUTTER_LINEAR: linear tweening
298  * @CLUTTER_EASE_IN_QUAD: quadratic tweening
299  * @CLUTTER_EASE_OUT_QUAD: quadratic tweening, inverse of
300  *    %CLUTTER_EASE_IN_QUAD
301  * @CLUTTER_EASE_IN_OUT_QUAD: quadratic tweening, combininig
302  *    %CLUTTER_EASE_IN_QUAD and %CLUTTER_EASE_OUT_QUAD
303  * @CLUTTER_EASE_IN_CUBIC: cubic tweening
304  * @CLUTTER_EASE_OUT_CUBIC: cubic tweening, invers of
305  *    %CLUTTER_EASE_IN_CUBIC
306  * @CLUTTER_EASE_IN_OUT_CUBIC: cubic tweening, combining
307  *    %CLUTTER_EASE_IN_CUBIC and %CLUTTER_EASE_OUT_CUBIC
308  * @CLUTTER_EASE_IN_QUART: quartic tweening
309  * @CLUTTER_EASE_OUT_QUART: quartic tweening, inverse of
310  *    %CLUTTER_EASE_IN_QUART
311  * @CLUTTER_EASE_IN_OUT_QUART: quartic tweening, combining
312  *    %CLUTTER_EASE_IN_QUART and %CLUTTER_EASE_OUT_QUART
313  * @CLUTTER_EASE_IN_QUINT: quintic tweening
314  * @CLUTTER_EASE_OUT_QUINT: quintic tweening, inverse of
315  *    %CLUTTER_EASE_IN_QUINT
316  * @CLUTTER_EASE_IN_OUT_QUINT: fifth power tweening, combining
317  *    %CLUTTER_EASE_IN_QUINT and %CLUTTER_EASE_OUT_QUINT
318  * @CLUTTER_EASE_IN_SINE: sinusoidal tweening
319  * @CLUTTER_EASE_OUT_SINE: sinusoidal tweening, inverse of
320  *    %CLUTTER_EASE_IN_SINE
321  * @CLUTTER_EASE_IN_OUT_SINE: sine wave tweening, combining
322  *    %CLUTTER_EASE_IN_SINE and %CLUTTER_EASE_OUT_SINE
323  * @CLUTTER_EASE_IN_EXPO: exponential tweening
324  * @CLUTTER_EASE_OUT_EXPO: exponential tweening, inverse of
325  *    %CLUTTER_EASE_IN_EXPO
326  * @CLUTTER_EASE_IN_OUT_EXPO: exponential tweening, combining
327  *    %CLUTTER_EASE_IN_EXPO and %CLUTTER_EASE_OUT_EXPO
328  * @CLUTTER_EASE_IN_CIRC: circular tweening
329  * @CLUTTER_EASE_OUT_CIRC: circular tweening, inverse of
330  *    %CLUTTER_EASE_IN_CIRC
331  * @CLUTTER_EASE_IN_OUT_CIRC: circular tweening, combining
332  *    %CLUTTER_EASE_IN_CIRC and %CLUTTER_EASE_OUT_CIRC
333  * @CLUTTER_EASE_IN_ELASTIC: elastic tweening, with offshoot on start
334  * @CLUTTER_EASE_OUT_ELASTIC: elastic tweening, with offshoot on end
335  * @CLUTTER_EASE_IN_OUT_ELASTIC: elastic tweening with offshoot on both ends
336  * @CLUTTER_EASE_IN_BACK: overshooting cubic tweening, with
337  *   backtracking on start
338  * @CLUTTER_EASE_OUT_BACK: overshooting cubic tweening, with
339  *   backtracking on end
340  * @CLUTTER_EASE_IN_OUT_BACK: overshooting cubic tweening, with
341  *   backtracking on both ends
342  * @CLUTTER_EASE_IN_BOUNCE: exponentially decaying parabolic (bounce)
343  *   tweening, with bounce on start
344  * @CLUTTER_EASE_OUT_BOUNCE: exponentially decaying parabolic (bounce)
345  *   tweening, with bounce on end
346  * @CLUTTER_EASE_IN_OUT_BOUNCE: exponentially decaying parabolic (bounce)
347  *   tweening, with bounce on both ends
348  * @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
349  *   registered global alpha functions
350  *
351  * The animation modes used by #ClutterAlpha and #ClutterAnimation. This
352  * enumeration can be expanded in later versions of Clutter. See the
353  * #ClutterAlpha documentation for a graph of all the animation modes.
354  *
355  * Every global alpha function registered using clutter_alpha_register_func()
356  * or clutter_alpha_register_closure() will have a logical id greater than
357  * %CLUTTER_ANIMATION_LAST.
358  *
359  * Since: 1.0
360  */
361 typedef enum {
362   CLUTTER_CUSTOM_MODE = 0,
363
364   /* linear */
365   CLUTTER_LINEAR,
366
367   /* quadratic */
368   CLUTTER_EASE_IN_QUAD,
369   CLUTTER_EASE_OUT_QUAD,
370   CLUTTER_EASE_IN_OUT_QUAD,
371
372   /* cubic */
373   CLUTTER_EASE_IN_CUBIC,
374   CLUTTER_EASE_OUT_CUBIC,
375   CLUTTER_EASE_IN_OUT_CUBIC,
376
377   /* quartic */
378   CLUTTER_EASE_IN_QUART,
379   CLUTTER_EASE_OUT_QUART,
380   CLUTTER_EASE_IN_OUT_QUART,
381
382   /* quintic */
383   CLUTTER_EASE_IN_QUINT,
384   CLUTTER_EASE_OUT_QUINT,
385   CLUTTER_EASE_IN_OUT_QUINT,
386
387   /* sinusoidal */
388   CLUTTER_EASE_IN_SINE,
389   CLUTTER_EASE_OUT_SINE,
390   CLUTTER_EASE_IN_OUT_SINE,
391
392   /* exponential */
393   CLUTTER_EASE_IN_EXPO,
394   CLUTTER_EASE_OUT_EXPO,
395   CLUTTER_EASE_IN_OUT_EXPO,
396
397   /* circular */
398   CLUTTER_EASE_IN_CIRC,
399   CLUTTER_EASE_OUT_CIRC,
400   CLUTTER_EASE_IN_OUT_CIRC,
401
402   /* elastic */
403   CLUTTER_EASE_IN_ELASTIC,
404   CLUTTER_EASE_OUT_ELASTIC,
405   CLUTTER_EASE_IN_OUT_ELASTIC,
406
407   /* overshooting cubic */
408   CLUTTER_EASE_IN_BACK,
409   CLUTTER_EASE_OUT_BACK,
410   CLUTTER_EASE_IN_OUT_BACK,
411
412   /* exponentially decaying parabolic */
413   CLUTTER_EASE_IN_BOUNCE,
414   CLUTTER_EASE_OUT_BOUNCE,
415   CLUTTER_EASE_IN_OUT_BOUNCE,
416
417   /* guard, before registered alpha functions */
418   CLUTTER_ANIMATION_LAST
419 } ClutterAnimationMode;
420
421 /**
422  * ClutterFontFlags:
423  * @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures.
424  * @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs.
425  *
426  * Runtime flags to change the font quality. To be used with
427  * clutter_set_font_flags().
428  *
429  * Since: 1.0
430  */
431 typedef enum
432 {
433   CLUTTER_FONT_MIPMAPPING = (1 << 0),
434   CLUTTER_FONT_HINTING    = (1 << 1)
435 } ClutterFontFlags;
436
437 /**
438  * ClutterTextDirection:
439  * @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned
440  *   by clutter_get_default_text_direction()
441  * @CLUTTER_TEXT_DIRECTION_LTR: Use left-to-right text direction
442  * @CLUTTER_TEXT_DIRECTION_RTL: Use right-to-left text direction
443  *
444  * The text direction to be used by #ClutterActor<!-- -->s
445  *
446  * Since: 1.2
447  */
448 typedef enum {
449   CLUTTER_TEXT_DIRECTION_DEFAULT,
450   CLUTTER_TEXT_DIRECTION_LTR,
451   CLUTTER_TEXT_DIRECTION_RTL
452 } ClutterTextDirection;
453
454 /**
455  * ClutterShaderType:
456  * @CLUTTER_VERTEX_SHADER: a vertex shader
457  * @CLUTTER_FRAGMENT_SHADER: a fragment shader
458  *
459  * The type of GLSL shader program
460  *
461  * Since: 1.4
462  */
463 typedef enum {
464   CLUTTER_VERTEX_SHADER,
465   CLUTTER_FRAGMENT_SHADER
466 } ClutterShaderType;
467
468 GType clutter_paint_volume_get_type (void) G_GNUC_CONST;
469
470 ClutterPaintVolume *clutter_paint_volume_copy                (const ClutterPaintVolume *pv);
471 void                clutter_paint_volume_free                (ClutterPaintVolume       *pv);
472
473 void                clutter_paint_volume_set_origin          (ClutterPaintVolume       *pv,
474                                                               const ClutterVertex      *origin);
475 void                clutter_paint_volume_get_origin          (const ClutterPaintVolume *pv,
476                                                               ClutterVertex            *vertex);
477 void                clutter_paint_volume_set_width           (ClutterPaintVolume       *pv,
478                                                               gfloat                    width);
479 gfloat              clutter_paint_volume_get_width           (const ClutterPaintVolume *pv);
480 void                clutter_paint_volume_set_height          (ClutterPaintVolume       *pv,
481                                                               gfloat                    height);
482 gfloat              clutter_paint_volume_get_height          (const ClutterPaintVolume *pv);
483 void                clutter_paint_volume_set_depth           (ClutterPaintVolume       *pv,
484                                                               gfloat                    depth);
485 gfloat              clutter_paint_volume_get_depth           (const ClutterPaintVolume *pv);
486 void                clutter_paint_volume_union               (ClutterPaintVolume       *pv,
487                                                               const ClutterPaintVolume *another_pv);
488
489 gboolean            clutter_paint_volume_set_from_allocation (ClutterPaintVolume       *pv,
490                                                               ClutterActor             *actor);
491
492 G_END_DECLS
493
494 #endif /* __CLUTTER_TYPES_H__ */