]> Pileus Git - ~andy/gtk/blob - gdk/gdk.h
Moved Gdk test functions from Gtk+ to Gdk test utils.
[~andy/gtk] / gdk / gdk.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GDK_H__
28 #define __GDK_H__
29
30 #include <gdk/gdkcairo.h>
31 #include <gdk/gdkcolor.h>
32 #include <gdk/gdkcursor.h>
33 #include <gdk/gdkdisplay.h>
34 #include <gdk/gdkdnd.h>
35 #include <gdk/gdkdrawable.h>
36 #include <gdk/gdkenumtypes.h>
37 #include <gdk/gdkevents.h>
38 #include <gdk/gdkfont.h>
39 #include <gdk/gdkgc.h>
40 #include <gdk/gdkimage.h>
41 #include <gdk/gdkinput.h>
42 #include <gdk/gdkkeys.h>
43 #include <gdk/gdkdisplaymanager.h>
44 #include <gdk/gdkpango.h>
45 #include <gdk/gdkpixbuf.h>
46 #include <gdk/gdkpixmap.h>
47 #include <gdk/gdkproperty.h>
48 #include <gdk/gdkregion.h>
49 #include <gdk/gdkrgb.h>
50 #include <gdk/gdkscreen.h>
51 #include <gdk/gdkselection.h>
52 #include <gdk/gdkspawn.h>
53 #include <gdk/gdktestutils.h>
54 #include <gdk/gdktypes.h>
55 #include <gdk/gdkvisual.h>
56 #include <gdk/gdkwindow.h>
57
58 G_BEGIN_DECLS
59
60
61 /* Initialization, exit and events
62  */
63 #define   GDK_PRIORITY_EVENTS           (G_PRIORITY_DEFAULT)
64 void      gdk_parse_args                (gint           *argc,
65                                          gchar        ***argv);
66 void      gdk_init                      (gint           *argc,
67                                          gchar        ***argv);
68 gboolean  gdk_init_check                (gint           *argc,
69                                          gchar        ***argv);
70 void gdk_add_option_entries_libgtk_only (GOptionGroup *group);
71 void gdk_pre_parse_libgtk_only          (void);
72
73 #ifndef GDK_DISABLE_DEPRECATED
74 void      gdk_exit                      (gint            error_code);
75 #endif /* GDK_DISABLE_DEPRECATED */
76 gchar*    gdk_set_locale                (void);
77
78 G_CONST_RETURN char *gdk_get_program_class (void);
79 void                 gdk_set_program_class (const char *program_class);
80
81 /* Push and pop error handlers for X errors
82  */
83 void      gdk_error_trap_push           (void);
84 gint      gdk_error_trap_pop            (void);
85
86 #ifndef GDK_DISABLE_DEPRECATED
87 void      gdk_set_use_xshm              (gboolean        use_xshm);
88 gboolean  gdk_get_use_xshm              (void);
89 #endif /* GDK_DISABLE_DEPRECATED */
90
91 gchar*                    gdk_get_display               (void);
92 G_CONST_RETURN gchar*     gdk_get_display_arg_name      (void);
93
94 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
95 /* Used by gtk_input_add_full () */
96 gint gdk_input_add_full   (gint              source,
97                            GdkInputCondition condition,
98                            GdkInputFunction  function,
99                            gpointer          data,
100                            GdkDestroyNotify  destroy);
101 #endif /* !GDK_DISABLE_DEPRECATED || GTK_COMPILATION */
102 #ifndef GDK_DISABLE_DEPRECATED
103 gint gdk_input_add        (gint              source,
104                            GdkInputCondition condition,
105                            GdkInputFunction  function,
106                            gpointer          data);
107 void gdk_input_remove     (gint              tag);
108 #endif /* GDK_DISABLE_DEPRECATED */
109
110 GdkGrabStatus gdk_pointer_grab       (GdkWindow    *window,
111                                       gboolean      owner_events,
112                                       GdkEventMask  event_mask,
113                                       GdkWindow    *confine_to,
114                                       GdkCursor    *cursor,
115                                       guint32       time_);
116 GdkGrabStatus gdk_keyboard_grab      (GdkWindow    *window,
117                                       gboolean      owner_events,
118                                       guint32       time_);
119
120 gboolean gdk_pointer_grab_info_libgtk_only (GdkDisplay *display,
121                                             GdkWindow **grab_window,
122                                             gboolean   *owner_events);
123 gboolean gdk_keyboard_grab_info_libgtk_only (GdkDisplay *display,
124                                              GdkWindow **grab_window,
125                                              gboolean   *owner_events);
126
127 #ifndef GDK_MULTIHEAD_SAFE
128 void          gdk_pointer_ungrab     (guint32       time_);
129 void          gdk_keyboard_ungrab    (guint32       time_);
130 gboolean      gdk_pointer_is_grabbed (void);
131
132 gint gdk_screen_width  (void) G_GNUC_CONST;
133 gint gdk_screen_height (void) G_GNUC_CONST;
134
135 gint gdk_screen_width_mm  (void) G_GNUC_CONST;
136 gint gdk_screen_height_mm (void) G_GNUC_CONST;
137
138 void gdk_beep (void);
139 #endif /* GDK_MULTIHEAD_SAFE */
140
141 void gdk_flush (void);
142
143 #ifndef GDK_MULTIHEAD_SAFE
144 void gdk_set_double_click_time             (guint       msec);
145 #endif
146
147 /* Rectangle utilities
148  */
149 gboolean gdk_rectangle_intersect (GdkRectangle *src1,
150                                   GdkRectangle *src2,
151                                   GdkRectangle *dest);
152 void     gdk_rectangle_union     (GdkRectangle *src1,
153                                   GdkRectangle *src2,
154                                   GdkRectangle *dest);
155
156 GType gdk_rectangle_get_type (void) G_GNUC_CONST;
157
158 #define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
159
160 /* Conversion functions between wide char and multibyte strings. 
161  */
162 #ifndef GDK_DISABLE_DEPRECATED
163 gchar     *gdk_wcstombs          (const GdkWChar   *src);
164 gint       gdk_mbstowcs          (GdkWChar         *dest,
165                                   const gchar      *src,
166                                   gint              dest_max);
167 #endif
168
169 /* Miscellaneous */
170 #ifndef GDK_MULTIHEAD_SAFE
171 gboolean gdk_event_send_client_message      (GdkEvent       *event,
172                                              GdkNativeWindow winid);
173 void     gdk_event_send_clientmessage_toall (GdkEvent  *event);
174 #endif
175 gboolean gdk_event_send_client_message_for_display (GdkDisplay *display,
176                                                     GdkEvent       *event,
177                                                     GdkNativeWindow winid);
178
179 void gdk_notify_startup_complete (void);
180
181 void gdk_notify_startup_complete_with_id (const gchar* startup_id);
182
183 /* Threading
184  */
185
186 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
187 GDKVAR GMutex *gdk_threads_mutex; /* private */
188 #endif
189
190 GDKVAR GCallback gdk_threads_lock;
191 GDKVAR GCallback gdk_threads_unlock;
192
193 void     gdk_threads_enter                (void);
194 void     gdk_threads_leave                (void);
195 void     gdk_threads_init                 (void);
196 void     gdk_threads_set_lock_functions   (GCallback enter_fn,
197                                            GCallback leave_fn);
198
199 guint    gdk_threads_add_idle_full        (gint           priority,
200                                            GSourceFunc    function,
201                                            gpointer       data,
202                                            GDestroyNotify notify);
203 guint    gdk_threads_add_idle             (GSourceFunc    function,
204                                            gpointer       data);
205 guint    gdk_threads_add_timeout_full     (gint           priority,
206                                            guint          interval,
207                                            GSourceFunc    function,
208                                            gpointer       data,
209                                            GDestroyNotify notify);
210 guint    gdk_threads_add_timeout          (guint          interval,
211                                            GSourceFunc    function,
212                                            gpointer       data);
213
214 #ifdef  G_THREADS_ENABLED
215 #  define GDK_THREADS_ENTER()   G_STMT_START {  \
216       if (gdk_threads_lock)                     \
217         (*gdk_threads_lock) ();                 \
218    } G_STMT_END
219 #  define GDK_THREADS_LEAVE()   G_STMT_START {  \
220       if (gdk_threads_unlock)                   \
221         (*gdk_threads_unlock) ();               \
222    } G_STMT_END
223 #else   /* !G_THREADS_ENABLED */
224 #  define GDK_THREADS_ENTER()
225 #  define GDK_THREADS_LEAVE()
226 #endif  /* !G_THREADS_ENABLED */
227
228 G_END_DECLS
229
230
231 #endif /* __GDK_H__ */