1 // -*- c++ -*-
2 #ifndef _LIBCLUTTERMM_MAIN_H
3 #define _LIBCLUTTERMM_MAIN_H
4 /*
5  * Copyright 2008 Jonathon Jongsma
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #include <glibmm.h>
23 #include <cluttermm/actor.h>
24 
25 namespace Clutter
26 {
27 
28 /** Starts the Clutter mainloop.
29  */
30 void main();
31 
32 /** Terminates the Clutter mainloop.
33  */
34 void main_quit();
35 
36 /** Retrieves the depth of the Clutter mainloop.
37  * @return The level of the mainloop.
38  */
39 int main_level();
40 
41 #ifndef CLUTTERMM_DISABLE_DEPRECATED
42 /** Check if clutter has debugging turned on.
43  * @return true if debugging is turned on, false otherwise.
44  *
45  * @deprecated
46  */
47 bool get_debug_enabled();
48 
49 /** Returns whether Clutter should print out the frames per second on the
50  * console. You can enable this setting either using the CLUTTER_SHOW_FPS
51  * environment variable or passing the --clutter-show-fps command line
52  * argument.
53  * @return true if Clutter should show the FPS.
54  *
55  * @deprecated Use the environment variable or the configuration file to determine whether Clutter should print out the FPS counter on the console.
56  */
57 bool get_show_fps();
58 
59 /** Returns the approximate number of microseconds passed since clutter was
60  * intialised.
61  * @return Number of microseconds since clutter_init() was called.
62  *
63  * @deprecated Use Glib::Timer or g_get_monotonic_time() for a proper timing source.
64  */
65 gulong get_timestamp();
66 
67 /** Retrieves the Actor with id.
68  * @param id an Actor ID.
69  * @return the actor with the passed id or a NULL RefPtr.
70  *
71  * @deprecated The id is not used any longer.
72  */
73 Glib::RefPtr<Actor> get_actor_by_gid(guint32 id);
74 
75 /** Sets the default frame rate to be used when creating Timeline objects.
76  * @param frames_per_sec the new default frame rate.
77  *
78  * @deprecated This function does not do anything any more.
79  */
80 void set_default_frame_rate(guint frames_per_sec);
81 #endif //CLUTTERMM_DISABLE_DEPRECATED
82 
83 /** Retrieves the default frame rate used when creating ClutterTimelines.
84  *
85  * This value is also used to compute the default frequency of motion events.
86  * @return the default frame rate
87  */
88 guint get_default_frame_rate();
89 
90 #ifndef CLUTTERMM_DISABLE_DEPRECATED
91 /** Sets whether per-actor motion events should be enabled or not
92  * (the default is to enable them).
93  *
94  * If enable is false the following events will not work:
95  *
96  * <ul>
97  *  <li>ClutterActor::motion-event, unless on the ClutterStage</li>
98  *  <li>ClutterActor::enter-event</li>
99  *  <li>ClutterActor::leave-event</li>
100  * </ul>
101  *
102  * @param enable true to enable per-actor motion events.
103  *
104  * @deprecated Use Stage::set_motion_events_enabled() instead.
105  */
106 void set_motion_events_enabled(bool enable);
107 
108 /** Gets whether the per-actor motion events are enabled.
109  * @return true if the motion events are enabled.
110  *
111  * @deprecated Use Stage::get_motion_events_enabled() instead.
112  */
113 bool get_motion_events_enabled();
114 
115 /** Clears the internal cache of glyphs used by the Pango renderer. This will
116  * free up some memory and GL texture resources. The cache will be
117  * automatically refilled as more text is drawn.
118  *
119  * @deprecated Use get_font_map() and cogl_pango_font_map_clear_glyph_cache() instead.
120  */
121 void clear_glyph_cache();
122 
123 //TODO: Documentation:
124 
125 /**
126  * @deprecated Use Backend::set_font_options() and the cairo_font_option_t API.
127  */
128 void set_font_flags(FontFlags flags);
129 
130 /**
131  * @deprecated Use Backend::get_font_options() and the cairo_font_option_t API.
132  */
133 FontFlags get_font_flags();
134 #endif //CLUTTERMM_DISABLE_DEPRECATED
135 
136 Glib::RefPtr<Pango::FontMap> get_font_map();
137 
138 /** Queries the current keyboard grab of clutter.
139  * @return the actor currently holding the keyboard grab, or an empty
140  * Glib::RefPtr if there is no grab.
141  */
142 Glib::RefPtr<Actor> get_keyboard_grab();
143 
144 /** Queries the current pointer grab of clutter.
145  * @return the actor currently holding the pointer grab, or am empty
146  * Glib::RefPtr if there is no grab.
147  */
148 Glib::RefPtr<Actor> get_pointer_grab();
149 
150 /** Grabs keyboard events, after the grab is done keyboard events
151  * ("key-press-event" and "key-release-event") are delivered to this actor
152  * directly. The source set in the event will be the actor that would have
153  * received the event if the keyboard grab was not in effect.
154  * @param actor An Actor
155  */
156 void grab_keyboard(const Glib::RefPtr<Actor>& actor);
157 
158 /** Grabs pointer events, after the grab is done all pointer related events
159  * (press, motion, release, enter, leave and scroll) are delivered to this
160  * actor directly. The source set in the event will be the actor that would
161  * have received the event if the pointer grab was not in effect.
162  *
163  * If you wish to grab all the pointer events for a specific input device,
164  * you should use grab_pointer_for_device().
165  * @param actor An Actor
166  */
167 void grab_pointer(const Glib::RefPtr<Actor>& actor);
168 
169 /** Removes an existing grab of the keyboard.
170  */
171 void ungrab_keyboard();
172 
173 /** Removes an existing grab of the pointer.
174  */
175 void ungrab_pointer();
176 
177 #ifndef CLUTTERMM_DISABLE_DEPRECATED
178 /** Grabs all the pointer events coming from the device id for actor.
179  *
180  * If id is -1 then this function is equivalent to grab_pointer().
181  *
182  * @param actor An Actor.
183  * @param id a device id, or -1
184  *
185  * @deprecated Use InputDevice::grab() instead.
186  */
187 void grab_pointer_for_device(const Glib::RefPtr<Actor>& actor, int id);
188 
189 /** Removes an existing grab of the pointer events for device id.
190  *
191  * @param a device id
192  *
193  * @deprecated Use InputDevice::ungrab() instead.
194  */
195 void ungrab_pointer_for_device(int id);
196 #endif //CLUTTERMM_DISABLE_DEPRECATED
197 
198 #if 0
199 // As this function should never be used by applications, we don't wrap it
200 // until someone really needs it.
201 /** Processes an event. This function should never be called by applications.
202  * @param event An Event.
203  */
204 void do_event(Event* event);
205 #endif
206 
207 } //namespace Clutter
208 
209 #endif //_LIBCLUTTERMM_MAIN_H
210 
211