Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-main.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_MAIN_H__
29 #define __CLUTTER_MAIN_H__
30
31 #include <clutter/clutter-actor.h>
32 #include <clutter/clutter-stage.h>
33 #include <pango/pango.h>
34
35 G_BEGIN_DECLS
36
37 /**
38  * CLUTTER_INIT_ERROR:
39  *
40  * #GError domain for #ClutterInitError
41  */
42 #define CLUTTER_INIT_ERROR      (clutter_init_error_quark ())
43
44 /**
45  * ClutterInitError:
46  * @CLUTTER_INIT_SUCCESS: Initialisation successful
47  * @CLUTTER_INIT_ERROR_UNKNOWN: Unknown error
48  * @CLUTTER_INIT_ERROR_THREADS: Thread initialisation failed
49  * @CLUTTER_INIT_ERROR_BACKEND: Backend initialisation failed
50  * @CLUTTER_INIT_ERROR_INTERNAL: Internal error
51  *
52  * Error conditions returned by clutter_init() and clutter_init_with_args().
53  *
54  * Since: 0.2
55  */
56 typedef enum {
57   CLUTTER_INIT_SUCCESS        =  1,
58   CLUTTER_INIT_ERROR_UNKNOWN  =  0,
59   CLUTTER_INIT_ERROR_THREADS  = -1,
60   CLUTTER_INIT_ERROR_BACKEND  = -2,
61   CLUTTER_INIT_ERROR_INTERNAL = -3
62 } ClutterInitError;
63
64 GQuark clutter_init_error_quark (void);
65
66 /**
67  * CLUTTER_PRIORITY_REDRAW:
68  *
69  * Priority of the redraws. This is chosen to be lower than the GTK+
70  * redraw and resize priorities, because in application with both
71  * GTK+ and Clutter it's more likely that the Clutter part will be
72  * continually animating (and thus able to starve GTK+) than
73  * vice-versa.
74  *
75  * Since: 0.8
76  */
77 #define CLUTTER_PRIORITY_REDRAW         (G_PRIORITY_HIGH_IDLE + 50)
78
79 /* Initialisation */
80 void                    clutter_base_init                       (void);
81 ClutterInitError        clutter_init                            (int          *argc,
82                                                                  char       ***argv) G_GNUC_WARN_UNUSED_RESULT;
83 ClutterInitError        clutter_init_with_args                  (int          *argc,
84                                                                  char       ***argv,
85                                                                  const char   *parameter_string,
86                                                                  GOptionEntry *entries,
87                                                                  const char   *translation_domain,
88                                                                  GError      **error) G_GNUC_WARN_UNUSED_RESULT;
89
90 GOptionGroup *          clutter_get_option_group                (void);
91 GOptionGroup *          clutter_get_option_group_without_init   (void);
92
93 /* Mainloop */
94 void                    clutter_main                            (void);
95 void                    clutter_main_quit                       (void);
96 gint                    clutter_main_level                      (void);
97
98 void                    clutter_do_event                        (ClutterEvent *event);
99
100 /* Debug utility functions */
101 gboolean                clutter_get_accessibility_enabled       (void);
102
103 /* Threading functions */
104 void                    clutter_threads_enter                   (void);
105 void                    clutter_threads_leave                   (void);
106 void                    clutter_threads_set_lock_functions      (GCallback enter_fn,
107                                                                  GCallback leave_fn);
108 guint                   clutter_threads_add_idle                (GSourceFunc    func,
109                                                                  gpointer       data);
110 guint                   clutter_threads_add_idle_full           (gint           priority,
111                                                                  GSourceFunc    func,
112                                                                  gpointer       data,
113                                                                  GDestroyNotify notify);
114 guint                   clutter_threads_add_timeout             (guint          interval,
115                                                                  GSourceFunc    func,
116                                                                  gpointer       data);
117 guint                   clutter_threads_add_timeout_full        (gint           priority,
118                                                                  guint          interval,
119                                                                  GSourceFunc    func,
120                                                                  gpointer       data,
121                                                                  GDestroyNotify notify);
122 guint                   clutter_threads_add_repaint_func        (GSourceFunc    func,
123                                                                  gpointer       data,
124                                                                  GDestroyNotify notify);
125 CLUTTER_AVAILABLE_IN_1_10
126 guint                   clutter_threads_add_repaint_func_full   (ClutterRepaintFlags flags,
127                                                                  GSourceFunc    func,
128                                                                  gpointer       data,
129                                                                  GDestroyNotify notify);
130 void                    clutter_threads_remove_repaint_func     (guint          handle_id);
131
132 void                    clutter_grab_pointer                    (ClutterActor  *actor);
133 void                    clutter_ungrab_pointer                  (void);
134 ClutterActor *          clutter_get_pointer_grab                (void);
135 void                    clutter_grab_keyboard                   (ClutterActor  *actor);
136 void                    clutter_ungrab_keyboard                 (void);
137 ClutterActor *          clutter_get_keyboard_grab               (void);
138
139 PangoFontMap *          clutter_get_font_map                    (void);
140
141 ClutterTextDirection    clutter_get_default_text_direction      (void);
142
143 guint                   clutter_get_default_frame_rate          (void);
144
145 G_END_DECLS
146
147 #endif /* _CLUTTER_MAIN_H__ */