cleanup specfile for packaging
[profile/ivi/clutter.git] / clutter / clutter-actor-private.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2010  Intel Corporation.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #ifndef __CLUTTER_ACTOR_PRIVATE_H__
23 #define __CLUTTER_ACTOR_PRIVATE_H__
24
25 #include <clutter/clutter-actor.h>
26
27 G_BEGIN_DECLS
28
29 /*< private >
30  * ClutterRedrawFlags:
31  * @CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION: Tells clutter the maximum
32  *   extents of what needs to be redrawn lies within the actors
33  *   current allocation. (Only use this for 2D actors though because
34  *   any actor with depth may be projected outside of its allocation)
35  *
36  * Flags passed to the clutter_actor_queue_redraw_with_clip ()
37  * function
38  *
39  * Since: 1.6
40  */
41 typedef enum
42 {
43   CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION  = 1 << 0
44 } ClutterRedrawFlags;
45
46 /*< private >
47  * ClutterActorTraverseFlags:
48  * CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST: Traverse the graph in
49  *   a depth first order.
50  * CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST: Traverse the graph in a
51  *   breadth first order.
52  *
53  * Controls some options for how clutter_actor_traverse() iterates
54  * through the graph.
55  */
56 typedef enum {
57   CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST   = 1L<<0,
58   CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1
59 } ClutterActorTraverseFlags;
60
61 /*< private >
62  * ClutterActorTraverseVisitFlags:
63  * CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE: Continue traversing as
64  *   normal
65  * CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN: Don't traverse the
66  *   children of the last visited actor. (Not applicable when using
67  *   %CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST_POST_ORDER since the children
68  *   are visited before having an opportunity to bail out)
69  * CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK: Immediately bail out without
70  *   visiting any more actors.
71  *
72  * Each time an actor is visited during a scenegraph traversal the
73  * ClutterTraverseCallback can return a set of flags that may affect
74  * the continuing traversal. It may stop traversal completely, just
75  * skip over children for the current actor or continue as normal.
76  */
77 typedef enum {
78   CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE       = 1L<<0,
79   CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN  = 1L<<1,
80   CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK          = 1L<<2
81 } ClutterActorTraverseVisitFlags;
82
83 /*< private >
84  * ClutterTraverseCallback:
85  *
86  * The callback prototype used with clutter_actor_traverse. The
87  * returned flags can be used to affect the continuing traversal
88  * either by continuing as normal, skipping over children of an
89  * actor or bailing out completely.
90  */
91 typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor *actor,
92                                                                    gint          depth,
93                                                                    gpointer      user_data);
94
95 /*< private >
96  * ClutterForeachCallback:
97  * @actor: The actor being iterated
98  * @user_data: The private data specified when starting the iteration
99  *
100  * A generic callback for iterating over actor, such as with
101  * _clutter_actor_foreach_child. The difference when compared to
102  * #ClutterCallback is that it returns a boolean so it is possible to break
103  * out of an iteration early.
104  *
105  * Return value: %TRUE to continue iterating or %FALSE to break iteration
106  * early.
107  */
108 typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
109                                             gpointer      user_data);
110
111 typedef struct _AnchorCoord             AnchorCoord;
112 typedef struct _SizeRequest             SizeRequest;
113
114 typedef struct _ClutterLayoutInfo       ClutterLayoutInfo;
115 typedef struct _ClutterTransformInfo    ClutterTransformInfo;
116 typedef struct _ClutterAnimationInfo    ClutterAnimationInfo;
117
118 /* Internal helper struct to represent a point that can be stored in
119    either direct pixel coordinates or as a fraction of the actor's
120    size. It is used for the anchor point, scale center and rotation
121    centers. */
122 struct _AnchorCoord
123 {
124   gboolean is_fractional;
125
126   union
127   {
128     /* Used when is_fractional == TRUE */
129     struct
130     {
131       gdouble x;
132       gdouble y;
133     } fraction;
134
135     /* Use when is_fractional == FALSE */
136     ClutterVertex units;
137   } v;
138 };
139
140 struct _SizeRequest
141 {
142   guint  age;
143   gfloat for_size;
144   gfloat min_size;
145   gfloat natural_size;
146 };
147
148 /*< private >
149  * ClutterLayoutInfo:
150  * @fixed_x: the fixed position of the actor, set using clutter_actor_set_x()
151  * @fixed_y: the fixed position of the actor, set using clutter_actor_set_y()
152  * @margin: the composed margin of the actor
153  * @x_expand: whether the actor should expand horizontally
154  * @y_expand: whether the actor should expand vertically
155  * @x_align: the horizontal alignment, if the actor expands horizontally
156  * @y_align: the vertical alignment, if the actor expands vertically
157  * @min_width: the minimum width, set using clutter_actor_set_min_width()
158  * @min_height: the minimum height, set using clutter_actor_set_min_height()
159  * @natural_width: the natural width, set using clutter_actor_set_natural_width()
160  * @natural_height: the natural height, set using clutter_actor_set_natural_height()
161  *
162  * Ancillary layout information for an actor.
163  */
164 struct _ClutterLayoutInfo
165 {
166   /* fixed position coordinates */
167   float fixed_x;
168   float fixed_y;
169
170   ClutterMargin margin;
171
172   guint x_expand : 1;
173   guint y_expand : 1;
174
175   guint x_align : 4;
176   guint y_align : 4;
177
178   float min_width;
179   float min_height;
180   float natural_width;
181   float natural_height;
182 };
183
184 const ClutterLayoutInfo *       _clutter_actor_get_layout_info_or_defaults      (ClutterActor *self);
185 ClutterLayoutInfo *             _clutter_actor_get_layout_info                  (ClutterActor *self);
186
187 struct _ClutterTransformInfo
188 {
189   /* rotation (angle and center) */
190   gdouble rx_angle;
191   AnchorCoord rx_center;
192
193   gdouble ry_angle;
194   AnchorCoord ry_center;
195
196   gdouble rz_angle;
197   AnchorCoord rz_center;
198
199   /* scaling */
200   gdouble scale_x;
201   gdouble scale_y;
202   AnchorCoord scale_center;
203
204   /* anchor point */
205   AnchorCoord anchor;
206
207   /* depth */
208   gfloat depth;
209 };
210
211 const ClutterTransformInfo *    _clutter_actor_get_transform_info_or_defaults   (ClutterActor *self);
212 ClutterTransformInfo *          _clutter_actor_get_transform_info               (ClutterActor *self);
213
214 typedef struct _AState {
215   guint easing_duration;
216   guint easing_delay;
217   ClutterAnimationMode easing_mode;
218 } AState;
219
220 struct _ClutterAnimationInfo
221 {
222   GArray *states;
223   AState *cur_state;
224
225   GHashTable *transitions;
226 };
227
228 const ClutterAnimationInfo *    _clutter_actor_get_animation_info_or_defaults   (ClutterActor *self);
229 ClutterAnimationInfo *          _clutter_actor_get_animation_info               (ClutterActor *self);
230
231 ClutterTransition *             _clutter_actor_create_transition                (ClutterActor *self,
232                                                                                  GParamSpec   *pspec,
233                                                                                  ...);
234 ClutterTransition *             _clutter_actor_get_transition                   (ClutterActor *self,
235                                                                                  GParamSpec   *pspec);
236 void                            _clutter_actor_update_transition                (ClutterActor *self,
237                                                                                  GParamSpec   *pspec,
238                                                                                  ...);
239
240 gboolean      _clutter_actor_foreach_child              (ClutterActor *self,
241                                                          ClutterForeachCallback callback,
242                                                          gpointer user_data);
243 void          _clutter_actor_traverse                   (ClutterActor *actor,
244                                                          ClutterActorTraverseFlags flags,
245                                                          ClutterTraverseCallback before_children_callback,
246                                                          ClutterTraverseCallback after_children_callback,
247                                                          gpointer user_data);
248 ClutterActor *_clutter_actor_get_stage_internal         (ClutterActor *actor);
249
250 void _clutter_actor_apply_modelview_transform           (ClutterActor *self,
251                                                          CoglMatrix *matrix);
252 void _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
253                                                           ClutterActor *ancestor,
254                                                           CoglMatrix *matrix);
255
256 void _clutter_actor_rerealize (ClutterActor    *self,
257                                ClutterCallback  callback,
258                                gpointer         data);
259
260 void _clutter_actor_set_opacity_override (ClutterActor *self,
261                                           gint          opacity);
262 gint _clutter_actor_get_opacity_override (ClutterActor *self);
263 void _clutter_actor_set_in_clone_paint (ClutterActor *self,
264                                         gboolean      is_in_clone_paint);
265
266 void _clutter_actor_set_enable_model_view_transform (ClutterActor *self,
267                                                      gboolean      enable);
268
269 void _clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
270                                                gboolean      enable);
271
272 void _clutter_actor_set_has_pointer (ClutterActor *self,
273                                      gboolean      has_pointer);
274
275 void _clutter_actor_queue_redraw_with_clip   (ClutterActor              *self,
276                                               ClutterRedrawFlags         flags,
277                                               ClutterPaintVolume        *clip_volume);
278 void _clutter_actor_queue_redraw_full        (ClutterActor              *self,
279                                               ClutterRedrawFlags         flags,
280                                               ClutterPaintVolume        *volume,
281                                               ClutterEffect             *effect);
282
283 ClutterPaintVolume *_clutter_actor_get_queue_redraw_clip (ClutterActor *self);
284 void _clutter_actor_set_queue_redraw_clip     (ClutterActor             *self,
285                                                ClutterPaintVolume *clip_volume);
286 void _clutter_actor_finish_queue_redraw       (ClutterActor             *self,
287                                                ClutterPaintVolume       *clip);
288
289 gboolean        _clutter_actor_set_default_paint_volume (ClutterActor *self,
290                                                          GType         check_gtype,
291                                                          ClutterPaintVolume *volume);
292
293 const gchar *   _clutter_actor_get_debug_name (ClutterActor *self);
294
295 void _clutter_actor_push_clone_paint (void);
296 void _clutter_actor_pop_clone_paint  (void);
297
298 guint32 _clutter_actor_get_pick_id (ClutterActor *self);
299
300 void    _clutter_actor_shader_pre_paint         (ClutterActor *actor,
301                                                  gboolean      repeat);
302 void    _clutter_actor_shader_post_paint        (ClutterActor *actor);
303
304 G_END_DECLS
305
306 #endif /* __CLUTTER_ACTOR_PRIVATE_H__ */