Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-layout-manager.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Copyright (C) 2009  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  * Author:
22  *   Emmanuele Bassi <ebassi@linux.intel.com>
23  */
24
25 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
26 #error "Only <clutter/clutter.h> can be included directly."
27 #endif
28
29 #ifndef __CLUTTER_LAYOUT_MANAGER_H__
30 #define __CLUTTER_LAYOUT_MANAGER_H__
31
32 #include <clutter/clutter-types.h>
33
34 G_BEGIN_DECLS
35
36 #define CLUTTER_TYPE_LAYOUT_MANAGER             (clutter_layout_manager_get_type ())
37 #define CLUTTER_LAYOUT_MANAGER(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManager))
38 #define CLUTTER_IS_LAYOUT_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYOUT_MANAGER))
39 #define CLUTTER_LAYOUT_MANAGER_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
40 #define CLUTTER_IS_LAYOUT_MANAGER_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_MANAGER))
41 #define CLUTTER_LAYOUT_MANAGER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
42
43 typedef struct _ClutterLayoutManagerPrivate     ClutterLayoutManagerPrivate;
44 typedef struct _ClutterLayoutManagerClass       ClutterLayoutManagerClass;
45
46 /**
47  * ClutterLayoutManager:
48  *
49  * The #ClutterLayoutManager structure contains only private data
50  * and should be accessed using the provided API
51  *
52  * Since: 1.2
53  */
54 struct _ClutterLayoutManager
55 {
56   /*< private >*/
57   GInitiallyUnowned parent_instance;
58
59   ClutterLayoutManagerPrivate *priv;
60 };
61
62 /**
63  * ClutterLayoutManagerClass:
64  * @get_preferred_width: virtual function; override to provide a preferred
65  *   width for the layout manager. See also the get_preferred_width()
66  *   virtual function in #ClutterActor
67  * @get_preferred_height: virtual function; override to provide a preferred
68  *   height for the layout manager. See also the get_preferred_height()
69  *   virtual function in #ClutterActor
70  * @allocate: virtual function; override to allocate the children of the
71  *   layout manager. See also the allocate() virtual function in
72  *   #ClutterActor
73  * @set_container: virtual function; override to set a back pointer
74  *   on the #ClutterContainer using the layout manager. The implementation
75  *   should not take a reference on the container, but just take a weak
76  *   reference, to avoid potential leaks due to reference cycles
77  * @get_child_meta_type: virtual function; override to return the #GType
78  *   of the #ClutterLayoutMeta sub-class used by the #ClutterLayoutManager
79  * @create_child_meta: virtual function; override to create a
80  *   #ClutterLayoutMeta instance associated to a #ClutterContainer and a
81  *   child #ClutterActor, used to maintain layout manager specific properties
82  * @begin_animation: virtual function; override to control the animation
83  *   of a #ClutterLayoutManager with the given duration and easing mode.
84  *   This virtual function is deprecated, and it should not be overridden
85  *   in newly written code.
86  * @end_animation: virtual function; override to end an animation started
87  *   by clutter_layout_manager_begin_animation(). This virtual function is
88  *   deprecated, and it should not be overriden in newly written code.
89  * @get_animation_progress: virtual function; override to control the
90  *   progress of the animation of a #ClutterLayoutManager. This virtual
91  *   function is deprecated, and it should not be overridden in newly written
92  *   code.
93  * @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
94  *   signal
95  *
96  * The #ClutterLayoutManagerClass structure contains only private
97  * data and should be accessed using the provided API
98  *
99  * Since: 1.2
100  */
101 struct _ClutterLayoutManagerClass
102 {
103   /*< private >*/
104   GInitiallyUnownedClass parent_class;
105
106   /*< public >*/
107   void               (* get_preferred_width)    (ClutterLayoutManager   *manager,
108                                                  ClutterContainer       *container,
109                                                  gfloat                  for_height,
110                                                  gfloat                 *min_width_p,
111                                                  gfloat                 *nat_width_p);
112   void               (* get_preferred_height)   (ClutterLayoutManager   *manager,
113                                                  ClutterContainer       *container,
114                                                  gfloat                  for_width,
115                                                  gfloat                 *min_height_p,
116                                                  gfloat                 *nat_height_p);
117   void               (* allocate)               (ClutterLayoutManager   *manager,
118                                                  ClutterContainer       *container,
119                                                  const ClutterActorBox  *allocation,
120                                                  ClutterAllocationFlags  flags);
121
122   void               (* set_container)          (ClutterLayoutManager   *manager,
123                                                  ClutterContainer       *container);
124
125   GType              (* get_child_meta_type)    (ClutterLayoutManager   *manager);
126   ClutterLayoutMeta *(* create_child_meta)      (ClutterLayoutManager   *manager,
127                                                  ClutterContainer       *container,
128                                                  ClutterActor           *actor);
129
130   /* deprecated */
131   ClutterAlpha *     (* begin_animation)        (ClutterLayoutManager   *manager,
132                                                  guint                   duration,
133                                                  gulong                  mode);
134   /* deprecated */
135   gdouble            (* get_animation_progress) (ClutterLayoutManager   *manager);
136   /* deprecated */
137   void               (* end_animation)          (ClutterLayoutManager   *manager);
138
139   void               (* layout_changed)         (ClutterLayoutManager   *manager);
140
141   /*< private >*/
142   /* padding for future expansion */
143   void (* _clutter_padding_1) (void);
144   void (* _clutter_padding_2) (void);
145   void (* _clutter_padding_3) (void);
146   void (* _clutter_padding_4) (void);
147   void (* _clutter_padding_5) (void);
148   void (* _clutter_padding_6) (void);
149   void (* _clutter_padding_7) (void);
150   void (* _clutter_padding_8) (void);
151 };
152
153 GType clutter_layout_manager_get_type (void) G_GNUC_CONST;
154
155 void               clutter_layout_manager_get_preferred_width   (ClutterLayoutManager   *manager,
156                                                                  ClutterContainer       *container,
157                                                                  gfloat                  for_height,
158                                                                  gfloat                 *min_width_p,
159                                                                  gfloat                 *nat_width_p);
160 void               clutter_layout_manager_get_preferred_height  (ClutterLayoutManager   *manager,
161                                                                  ClutterContainer       *container,
162                                                                  gfloat                  for_width,
163                                                                  gfloat                 *min_height_p,
164                                                                  gfloat                 *nat_height_p);
165 void               clutter_layout_manager_allocate              (ClutterLayoutManager   *manager,
166                                                                  ClutterContainer       *container,
167                                                                  const ClutterActorBox  *allocation,
168                                                                  ClutterAllocationFlags  flags);
169
170 void               clutter_layout_manager_set_container         (ClutterLayoutManager   *manager,
171                                                                  ClutterContainer       *container);
172 void               clutter_layout_manager_layout_changed        (ClutterLayoutManager   *manager);
173
174 GParamSpec *       clutter_layout_manager_find_child_property   (ClutterLayoutManager   *manager,
175                                                                  const gchar            *name);
176 GParamSpec **      clutter_layout_manager_list_child_properties (ClutterLayoutManager   *manager,
177                                                                  guint                  *n_pspecs);
178
179 ClutterLayoutMeta *clutter_layout_manager_get_child_meta        (ClutterLayoutManager   *manager,
180                                                                  ClutterContainer       *container,
181                                                                  ClutterActor           *actor);
182
183 void               clutter_layout_manager_child_set             (ClutterLayoutManager   *manager,
184                                                                  ClutterContainer       *container,
185                                                                  ClutterActor           *actor,
186                                                                  const gchar            *first_property,
187                                                                  ...) G_GNUC_NULL_TERMINATED;
188 void               clutter_layout_manager_child_get             (ClutterLayoutManager   *manager,
189                                                                  ClutterContainer       *container,
190                                                                  ClutterActor           *actor,
191                                                                  const gchar            *first_property,
192                                                                  ...) G_GNUC_NULL_TERMINATED;
193 void               clutter_layout_manager_child_set_property    (ClutterLayoutManager   *manager,
194                                                                  ClutterContainer       *container,
195                                                                  ClutterActor           *actor,
196                                                                  const gchar            *property_name,
197                                                                  const GValue           *value);
198 void               clutter_layout_manager_child_get_property    (ClutterLayoutManager   *manager,
199                                                                  ClutterContainer       *container,
200                                                                  ClutterActor           *actor,
201                                                                  const gchar            *property_name,
202                                                                  GValue                 *value);
203
204 CLUTTER_DEPRECATED_IN_1_12
205 ClutterAlpha *     clutter_layout_manager_begin_animation       (ClutterLayoutManager   *manager,
206                                                                  guint                   duration,
207                                                                  gulong                  mode);
208 CLUTTER_DEPRECATED_IN_1_12
209 void               clutter_layout_manager_end_animation         (ClutterLayoutManager   *manager);
210 CLUTTER_DEPRECATED_IN_1_12
211 gdouble            clutter_layout_manager_get_animation_progress (ClutterLayoutManager   *manager);
212
213 CLUTTER_AVAILABLE_IN_1_12
214 void               clutter_layout_manager_set_use_animations    (ClutterLayoutManager   *manager,
215                                                                  gboolean                animate);
216 CLUTTER_AVAILABLE_IN_1_12
217 gboolean           clutter_layout_manager_get_use_animations    (ClutterLayoutManager   *manager);
218 CLUTTER_AVAILABLE_IN_1_12
219 void               clutter_layout_manager_set_easing_mode       (ClutterLayoutManager   *manager,
220                                                                  ClutterAnimationMode    mode);
221 CLUTTER_AVAILABLE_IN_1_12
222 ClutterAnimationMode clutter_layout_manager_get_easing_mode     (ClutterLayoutManager   *manager);
223
224 CLUTTER_AVAILABLE_IN_1_12
225 void               clutter_layout_manager_set_easing_duration   (ClutterLayoutManager   *manager,
226                                                                  guint                   duration);
227 CLUTTER_AVAILABLE_IN_1_12
228 guint              clutter_layout_manager_get_easing_duration   (ClutterLayoutManager   *manager);
229 CLUTTER_AVAILABLE_IN_1_12
230 void               clutter_layout_manager_set_easing_delay      (ClutterLayoutManager   *manager,
231                                                                  guint                   delay);
232 CLUTTER_AVAILABLE_IN_1_12
233 guint              clutter_layout_manager_get_easing_delay      (ClutterLayoutManager   *manager);
234 CLUTTER_AVAILABLE_IN_1_12
235 gboolean           clutter_layout_manager_get_easing_state      (ClutterLayoutManager   *manager,
236                                                                  ClutterAnimationMode   *mode,
237                                                                  guint                  *duration,
238                                                                  guint                  *delay);
239
240 G_END_DECLS
241
242 #endif /* __CLUTTER_LAYOUT_MANAGER_H__ */