]> Pileus Git - ~andy/gtk/blob - gdk/gdk.h
80cb257fa1dfc7825b53121a5b2a746b842df13a
[~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/gdkcolor.h>
31 #include <gdk/gdkcursor.h>
32 #include <gdk/gdkdisplay.h>
33 #include <gdk/gdkdnd.h>
34 #include <gdk/gdkdrawable.h>
35 #include <gdk/gdkenumtypes.h>
36 #include <gdk/gdkevents.h>
37 #include <gdk/gdkfont.h>
38 #include <gdk/gdkgc.h>
39 #include <gdk/gdkimage.h>
40 #include <gdk/gdkinput.h>
41 #include <gdk/gdkkeys.h>
42 #include <gdk/gdkdisplaymanager.h>
43 #include <gdk/gdkpango.h>
44 #include <gdk/gdkpixbuf.h>
45 #include <gdk/gdkpixmap.h>
46 #include <gdk/gdkproperty.h>
47 #include <gdk/gdkregion.h>
48 #include <gdk/gdkrgb.h>
49 #include <gdk/gdkscreen.h>
50 #include <gdk/gdkselection.h>
51 #include <gdk/gdktypes.h>
52 #include <gdk/gdkvisual.h>
53 #include <gdk/gdkwindow.h>
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58
59
60 /* Initialization, exit and events
61  */
62 #define   GDK_PRIORITY_EVENTS           (G_PRIORITY_DEFAULT)
63 void      gdk_parse_args                (gint           *argc,
64                                          gchar        ***argv);
65 void      gdk_init                      (gint           *argc,
66                                          gchar        ***argv);
67 gboolean  gdk_init_check                (gint           *argc,
68                                          gchar        ***argv);
69
70 #ifndef GDK_DISABLE_DEPRECATED
71 void      gdk_exit                      (gint            error_code);
72 #endif /* GDK_DISABLE_DEPRECATED */
73 gchar*    gdk_set_locale                (void);
74
75 G_CONST_RETURN char *gdk_get_program_class (void);
76 void                 gdk_set_program_class (const char *program_class);
77
78 /* Push and pop error handlers for X errors
79  */
80 void      gdk_error_trap_push           (void);
81 gint      gdk_error_trap_pop            (void);
82
83 #ifndef GDK_DISABLE_DEPRECATED
84 void      gdk_set_use_xshm              (gboolean        use_xshm);
85 gboolean  gdk_get_use_xshm              (void);
86 #endif /* GDK_DISABLE_DEPRECATED */
87
88 gchar*                    gdk_get_display               (void);
89 G_CONST_RETURN gchar*     gdk_get_display_arg_name      (void);
90
91 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
92 /* Used by gtk_input_add_full () */
93 gint gdk_input_add_full   (gint              source,
94                            GdkInputCondition condition,
95                            GdkInputFunction  function,
96                            gpointer          data,
97                            GdkDestroyNotify  destroy);
98 #endif /* !GDK_DISABLE_DEPRECATED || GTK_COMPILATION */
99 #ifndef GDK_DISABLE_DEPRECATED
100 gint gdk_input_add        (gint              source,
101                            GdkInputCondition condition,
102                            GdkInputFunction  function,
103                            gpointer          data);
104 void gdk_input_remove     (gint              tag);
105 #endif /* GDK_DISABLE_DEPRECATED */
106
107 GdkGrabStatus gdk_pointer_grab       (GdkWindow    *window,
108                                       gboolean      owner_events,
109                                       GdkEventMask  event_mask,
110                                       GdkWindow    *confine_to,
111                                       GdkCursor    *cursor,
112                                       guint32       time_);
113 GdkGrabStatus gdk_keyboard_grab      (GdkWindow    *window,
114                                       gboolean      owner_events,
115                                       guint32       time_);
116
117 #ifndef GDK_MULTIHEAD_SAFE
118 void          gdk_pointer_ungrab     (guint32       time_);
119 void          gdk_keyboard_ungrab    (guint32       time_);
120 gboolean      gdk_pointer_is_grabbed (void);
121
122 gint gdk_screen_width  (void) G_GNUC_CONST;
123 gint gdk_screen_height (void) G_GNUC_CONST;
124
125 gint gdk_screen_width_mm  (void) G_GNUC_CONST;
126 gint gdk_screen_height_mm (void) G_GNUC_CONST;
127
128 void gdk_beep (void);
129 #endif /* GDK_MULTIHEAD_SAFE */
130
131 void gdk_flush (void);
132
133 #ifndef GDK_MULTIHEAD_SAFE
134 void gdk_set_double_click_time             (guint       msec);
135 #endif
136
137 /* Rectangle utilities
138  */
139 gboolean gdk_rectangle_intersect (GdkRectangle *src1,
140                                   GdkRectangle *src2,
141                                   GdkRectangle *dest);
142 void     gdk_rectangle_union     (GdkRectangle *src1,
143                                   GdkRectangle *src2,
144                                   GdkRectangle *dest);
145
146 GType gdk_rectangle_get_type (void);
147
148 #define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
149
150 /* Conversion functions between wide char and multibyte strings. 
151  */
152 gchar     *gdk_wcstombs          (const GdkWChar   *src);
153 gint       gdk_mbstowcs          (GdkWChar         *dest,
154                                   const gchar      *src,
155                                   gint              dest_max);
156
157 /* Miscellaneous */
158 #ifndef GDK_MULTIHEAD_SAFE
159 gboolean gdk_event_send_client_message      (GdkEvent       *event,
160                                              GdkNativeWindow winid);
161 void     gdk_event_send_clientmessage_toall (GdkEvent  *event);
162 #endif
163 gboolean gdk_event_send_client_message_for_display (GdkDisplay *display,
164                                                     GdkEvent       *event,
165                                                     GdkNativeWindow winid);
166
167 void gdk_notify_startup_complete (void);
168
169 /* Threading
170  */
171
172 GDKVAR GMutex *gdk_threads_mutex;
173
174 void     gdk_threads_enter                (void);
175 void     gdk_threads_leave                (void);
176 void     gdk_threads_init                 (void);  
177
178 #ifdef  G_THREADS_ENABLED
179 #  define GDK_THREADS_ENTER()   G_STMT_START {  \
180       if (gdk_threads_mutex)                    \
181         g_mutex_lock (gdk_threads_mutex);       \
182    } G_STMT_END
183 #  define GDK_THREADS_LEAVE()   G_STMT_START {  \
184       if (gdk_threads_mutex)                    \
185         g_mutex_unlock (gdk_threads_mutex);     \
186    } G_STMT_END
187 #else   /* !G_THREADS_ENABLED */
188 #  define GDK_THREADS_ENTER()
189 #  define GDK_THREADS_LEAVE()
190 #endif  /* !G_THREADS_ENABLED */
191
192 #ifdef __cplusplus
193 }
194 #endif /* __cplusplus */
195
196
197 #endif /* __GDK_H__ */