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 #ifndef __CLUTTER_STAGE_H__
25 #define __CLUTTER_STAGE_H__
26 
27 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <clutter/clutter.h> can be included directly."
29 #endif
30 
31 #include <clutter/clutter-types.h>
32 #include <clutter/clutter-group.h>
33 
34 G_BEGIN_DECLS
35 
36 #define CLUTTER_TYPE_STAGE              (clutter_stage_get_type())
37 
38 #define CLUTTER_STAGE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE, ClutterStage))
39 #define CLUTTER_STAGE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STAGE, ClutterStageClass))
40 #define CLUTTER_IS_STAGE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE))
41 #define CLUTTER_IS_STAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STAGE))
42 #define CLUTTER_STAGE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STAGE, ClutterStageClass))
43 
44 typedef struct _ClutterStageClass   ClutterStageClass;
45 typedef struct _ClutterStagePrivate ClutterStagePrivate;
46 
47 /**
48  * ClutterStage:
49  *
50  * The #ClutterStage structure contains only private data
51  * and should be accessed using the provided API
52  *
53  * Since: 0.2
54  */
55 struct _ClutterStage
56 {
57   /*< private >*/
58   ClutterGroup parent_instance;
59 
60   ClutterStagePrivate *priv;
61 };
62 /**
63  * ClutterStageClass:
64  * @fullscreen: handler for the #ClutterStage::fullscreen signal
65  * @unfullscreen: handler for the #ClutterStage::unfullscreen signal
66  * @activate: handler for the #ClutterStage::activate signal
67  * @deactivate: handler for the #ClutterStage::deactivate signal
68  * @delete_event: handler for the #ClutterStage::delete-event signal
69  *
70  * The #ClutterStageClass structure contains only private data
71  *
72  * Since: 0.2
73  */
74 
75 struct _ClutterStageClass
76 {
77   /*< private >*/
78   ClutterGroupClass parent_class;
79 
80   /*< public >*/
81   /* signals */
82   void (* fullscreen)   (ClutterStage *stage);
83   void (* unfullscreen) (ClutterStage *stage);
84   void (* activate)     (ClutterStage *stage);
85   void (* deactivate)   (ClutterStage *stage);
86 
87   gboolean (* delete_event) (ClutterStage *stage,
88                              ClutterEvent *event);
89 
90   /*< private >*/
91   /* padding for future expansion */
92   gpointer _padding_dummy[31];
93 };
94 
95 /**
96  * ClutterPerspective:
97  * @fovy: the field of view angle, in degrees, in the y direction
98  * @aspect: the aspect ratio that determines the field of view in the x
99  *   direction. The aspect ratio is the ratio of x (width) to y (height)
100  * @z_near: the distance from the viewer to the near clipping
101  *   plane (always positive)
102  * @z_far: the distance from the viewer to the far clipping
103  *   plane (always positive)
104  *
105  * Stage perspective definition. #ClutterPerspective is only used by
106  * the fixed point version of clutter_stage_set_perspective().
107  *
108  * Since: 0.4
109  */
110 struct _ClutterPerspective
111 {
112   gfloat fovy;
113   gfloat aspect;
114   gfloat z_near;
115   gfloat z_far;
116 };
117 
118 /**
119  * ClutterFog:
120  * @z_near: starting distance from the viewer to the near clipping
121  *   plane (always positive)
122  * @z_far: final distance from the viewer to the far clipping
123  *   plane (always positive)
124  *
125  * Fog settings used to create the depth cueing effect.
126  *
127  * Since: 0.6
128  *
129  * Deprecated: 1.10: The fog-related API in #ClutterStage has been
130  *   deprecated as well.
131  */
132 struct _ClutterFog
133 {
134   gfloat z_near;
135   gfloat z_far;
136 };
137 
138 /**
139  * ClutterFrameInfo: (skip)
140  */
141 struct _ClutterFrameInfo
142 {
143   int64_t frame_counter;
144   int64_t presentation_time;
145   float refresh_rate;
146 };
147 
148 typedef struct _ClutterCapture
149 {
150   cairo_surface_t *image;
151   cairo_rectangle_int_t rect;
152 } ClutterCapture;
153 
154 CLUTTER_AVAILABLE_IN_ALL
155 GType clutter_perspective_get_type (void) G_GNUC_CONST;
156 CLUTTER_DEPRECATED_IN_1_10
157 GType clutter_fog_get_type (void) G_GNUC_CONST;
158 CLUTTER_AVAILABLE_IN_ALL
159 GType clutter_stage_get_type (void) G_GNUC_CONST;
160 
161 CLUTTER_AVAILABLE_IN_ALL
162 ClutterActor *  clutter_stage_new                               (void);
163 
164 CLUTTER_AVAILABLE_IN_ALL
165 void            clutter_stage_set_perspective                   (ClutterStage          *stage,
166 			                                         ClutterPerspective    *perspective);
167 CLUTTER_AVAILABLE_IN_ALL
168 void            clutter_stage_get_perspective                   (ClutterStage          *stage,
169 			                                         ClutterPerspective    *perspective);
170 CLUTTER_AVAILABLE_IN_ALL
171 void            clutter_stage_set_fullscreen                    (ClutterStage          *stage,
172                                                                  gboolean               fullscreen);
173 CLUTTER_AVAILABLE_IN_ALL
174 gboolean        clutter_stage_get_fullscreen                    (ClutterStage          *stage);
175 CLUTTER_AVAILABLE_IN_ALL
176 void            clutter_stage_show_cursor                       (ClutterStage          *stage);
177 CLUTTER_AVAILABLE_IN_ALL
178 void            clutter_stage_hide_cursor                       (ClutterStage          *stage);
179 CLUTTER_AVAILABLE_IN_ALL
180 void            clutter_stage_set_title                         (ClutterStage          *stage,
181                                                                  const gchar           *title);
182 CLUTTER_AVAILABLE_IN_ALL
183 const gchar *   clutter_stage_get_title                         (ClutterStage          *stage);
184 CLUTTER_AVAILABLE_IN_ALL
185 void            clutter_stage_set_user_resizable                (ClutterStage          *stage,
186 						                 gboolean               resizable);
187 CLUTTER_AVAILABLE_IN_ALL
188 gboolean        clutter_stage_get_user_resizable                (ClutterStage          *stage);
189 
190 CLUTTER_AVAILABLE_IN_ALL
191 void            clutter_stage_set_minimum_size                  (ClutterStage          *stage,
192                                                                  guint                  width,
193                                                                  guint                  height);
194 CLUTTER_AVAILABLE_IN_ALL
195 void            clutter_stage_get_minimum_size                  (ClutterStage          *stage,
196                                                                  guint                 *width,
197                                                                  guint                 *height);
198 CLUTTER_AVAILABLE_IN_ALL
199 void            clutter_stage_set_no_clear_hint                 (ClutterStage          *stage,
200                                                                  gboolean               no_clear);
201 CLUTTER_AVAILABLE_IN_ALL
202 gboolean        clutter_stage_get_no_clear_hint                 (ClutterStage          *stage);
203 CLUTTER_AVAILABLE_IN_ALL
204 void            clutter_stage_set_use_alpha                     (ClutterStage          *stage,
205                                                                  gboolean               use_alpha);
206 CLUTTER_AVAILABLE_IN_ALL
207 gboolean        clutter_stage_get_use_alpha                     (ClutterStage          *stage);
208 
209 CLUTTER_AVAILABLE_IN_ALL
210 void            clutter_stage_set_key_focus                     (ClutterStage          *stage,
211                                                                  ClutterActor          *actor);
212 CLUTTER_AVAILABLE_IN_ALL
213 ClutterActor *  clutter_stage_get_key_focus                     (ClutterStage          *stage);
214 CLUTTER_AVAILABLE_IN_ALL
215 void            clutter_stage_set_throttle_motion_events        (ClutterStage          *stage,
216                                                                  gboolean               throttle);
217 CLUTTER_AVAILABLE_IN_ALL
218 gboolean        clutter_stage_get_throttle_motion_events        (ClutterStage          *stage);
219 CLUTTER_AVAILABLE_IN_ALL
220 void            clutter_stage_set_motion_events_enabled         (ClutterStage          *stage,
221                                                                  gboolean               enabled);
222 CLUTTER_AVAILABLE_IN_ALL
223 gboolean        clutter_stage_get_motion_events_enabled         (ClutterStage          *stage);
224 CLUTTER_AVAILABLE_IN_ALL
225 void            clutter_stage_set_accept_focus                  (ClutterStage          *stage,
226                                                                  gboolean               accept_focus);
227 CLUTTER_AVAILABLE_IN_ALL
228 gboolean        clutter_stage_get_accept_focus                  (ClutterStage          *stage);
229 CLUTTER_AVAILABLE_IN_ALL
230 gboolean        clutter_stage_event                             (ClutterStage          *stage,
231                                                                  ClutterEvent          *event);
232 
233 CLUTTER_AVAILABLE_IN_ALL
234 ClutterActor *  clutter_stage_get_actor_at_pos                  (ClutterStage          *stage,
235                                                                  ClutterPickMode        pick_mode,
236                                                                  gint                   x,
237                                                                  gint                   y);
238 CLUTTER_AVAILABLE_IN_ALL
239 guchar *        clutter_stage_read_pixels                       (ClutterStage          *stage,
240                                                                  gint                   x,
241                                                                  gint                   y,
242                                                                  gint                   width,
243                                                                  gint                   height);
244 
245 CLUTTER_AVAILABLE_IN_ALL
246 void            clutter_stage_get_redraw_clip_bounds            (ClutterStage          *stage,
247                                                                  cairo_rectangle_int_t *clip);
248 CLUTTER_AVAILABLE_IN_ALL
249 void            clutter_stage_ensure_viewport                   (ClutterStage          *stage);
250 CLUTTER_AVAILABLE_IN_ALL
251 void            clutter_stage_ensure_redraw                     (ClutterStage          *stage);
252 
253 #ifdef CLUTTER_ENABLE_EXPERIMENTAL_API
254 CLUTTER_AVAILABLE_IN_1_14
255 void            clutter_stage_set_sync_delay                    (ClutterStage          *stage,
256                                                                  gint                   sync_delay);
257 CLUTTER_AVAILABLE_IN_1_14
258 void            clutter_stage_skip_sync_delay                   (ClutterStage          *stage);
259 #endif
260 
261 CLUTTER_AVAILABLE_IN_MUFFIN
262 gboolean clutter_stage_capture (ClutterStage          *stage,
263                                 gboolean               paint,
264                                 cairo_rectangle_int_t *rect,
265                                 ClutterCapture       **captures,
266                                 int                   *n_captures);
267 
268 G_END_DECLS
269 
270 #endif /* __CLUTTER_STAGE_H__ */
271