]> Pileus Git - ~andy/gtk/blob - gdk/gdktypes.h
Implement GdkRegion in terms of cairo_region_t
[~andy/gtk] / gdk / gdktypes.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 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_TYPES_H__
32 #define __GDK_TYPES_H__
33
34 /* GDK uses "glib". (And so does GTK).
35  */
36 #include <glib.h>
37 #include <pango/pango.h>
38 #include <glib-object.h>
39 #include <cairo.h>
40
41 #ifdef G_OS_WIN32
42 #  ifdef GDK_COMPILATION
43 #    define GDKVAR __declspec(dllexport)
44 #  else
45 #    define GDKVAR extern __declspec(dllimport)
46 #  endif
47 #else
48 #  define GDKVAR extern
49 #endif
50
51 /* The system specific file gdkconfig.h contains such configuration
52  * settings that are needed not only when compiling GDK (or GTK)
53  * itself, but also occasionally when compiling programs that use GDK
54  * (or GTK). One such setting is what windowing API backend is in use.
55  */
56 #include <gdkconfig.h>
57
58 /* some common magic values */
59 #define GDK_CURRENT_TIME     0L
60
61 /**
62  * GDK_PARENT_RELATIVE:
63  *
64  * A special value for #GdkPixmap variables, indicating that the background
65  * pixmap for a window should be inherited from the parent window.
66  */
67 #define GDK_PARENT_RELATIVE  1L
68
69
70
71 G_BEGIN_DECLS
72
73
74 /* Type definitions for the basic structures.
75  */
76 typedef struct _GdkPoint              GdkPoint;
77 typedef cairo_rectangle_int_t         GdkRectangle;
78 typedef struct _GdkSegment            GdkSegment;
79 typedef struct _GdkSpan               GdkSpan;
80
81 typedef struct _GdkAtom            *GdkAtom;
82
83 #define GDK_ATOM_TO_POINTER(atom) (atom)
84 #define GDK_POINTER_TO_ATOM(ptr)  ((GdkAtom)(ptr))
85
86 #ifdef GDK_NATIVE_WINDOW_POINTER
87 #define GDK_GPOINTER_TO_NATIVE_WINDOW(p) ((GdkNativeWindow) (p))
88 #else
89 #define GDK_GPOINTER_TO_NATIVE_WINDOW(p) GPOINTER_TO_UINT(p)
90 #endif
91
92 #define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
93 #define GDK_NONE            _GDK_MAKE_ATOM (0)
94
95 #ifdef GDK_NATIVE_WINDOW_POINTER
96 typedef gpointer GdkNativeWindow;
97 #else
98 typedef guint32 GdkNativeWindow;
99 #endif
100  
101 /* Forward declarations of commonly used types
102  */
103 typedef struct _GdkColor              GdkColor;
104 typedef struct _GdkColormap           GdkColormap;
105 typedef struct _GdkCursor             GdkCursor;
106 typedef struct _GdkGC                 GdkGC;
107 typedef struct _GdkImage              GdkImage;
108 typedef cairo_region_t                GdkRegion;
109 typedef struct _GdkVisual             GdkVisual;
110
111 typedef struct _GdkDrawable           GdkDrawable;
112 typedef struct _GdkDrawable           GdkBitmap;
113 typedef struct _GdkDrawable           GdkPixmap;
114
115 /**
116  * GdkWindow:
117  *
118  * An opaque structure representing an onscreen drawable. Pointers to structures
119  * of type #GdkPixmap, #GdkBitmap, and #GdkWindow can often be used
120  * interchangeably. The type #GdkDrawable refers generically to any of these
121  * types.
122  */
123 typedef struct _GdkDrawable           GdkWindow;
124 typedef struct _GdkDisplay            GdkDisplay;
125 typedef struct _GdkScreen             GdkScreen;
126
127 typedef enum
128 {
129   GDK_LSB_FIRST,
130   GDK_MSB_FIRST
131 } GdkByteOrder;
132
133 /* Types of modifiers.
134  */
135 /**
136  * GdkModifierType:
137  * @GDK_SHIFT_MASK: the Shift key.
138  * @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
139  *  X server this may either be CapsLock or ShiftLock).
140  * @GDK_CONTROL_MASK: the Control key.
141  * @GDK_MOD1_MASK: the fourth modifier key (it depends on the modifier
142  *  mapping of the X server which key is interpreted as this modifier, but
143  *  normally it is the Alt key).
144  * @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
145  *  mapping of the X server which key is interpreted as this modifier).
146  * @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
147  *  mapping of the X server which key is interpreted as this modifier).
148  * @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
149  *  mapping of the X server which key is interpreted as this modifier).
150  * @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
151  *  mapping of the X server which key is interpreted as this modifier).
152  * @GDK_BUTTON1_MASK: the first mouse button.
153  * @GDK_BUTTON2_MASK: the second mouse button.
154  * @GDK_BUTTON3_MASK: the third mouse button.
155  * @GDK_BUTTON4_MASK: the fourth mouse button.
156  * @GDK_BUTTON5_MASK: the fifth mouse button.
157  * @GDK_SUPER_MASK: the Super modifier. Since 2.10
158  * @GDK_HYPER_MASK: the Hyper modifier. Since 2.10
159  * @GDK_META_MASK: the Meta modifier. Since 2.10
160  * @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
161  *  between (keyval, modifiers) pairs from key press and release events.
162  * @GDK_MODIFIER_MASK: a mask covering all modifier types.
163  *
164  * A set of bit-flags to indicate the state of modifier keys and mouse buttons
165  * in various event types. Typical modifier keys are Shift, Control, Meta,
166  * Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
167  *
168  * Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
169  *
170  * Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
171  * to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
172  * %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
173  */
174 typedef enum
175 {
176   GDK_SHIFT_MASK    = 1 << 0,
177   GDK_LOCK_MASK     = 1 << 1,
178   GDK_CONTROL_MASK  = 1 << 2,
179   GDK_MOD1_MASK     = 1 << 3,
180   GDK_MOD2_MASK     = 1 << 4,
181   GDK_MOD3_MASK     = 1 << 5,
182   GDK_MOD4_MASK     = 1 << 6,
183   GDK_MOD5_MASK     = 1 << 7,
184   GDK_BUTTON1_MASK  = 1 << 8,
185   GDK_BUTTON2_MASK  = 1 << 9,
186   GDK_BUTTON3_MASK  = 1 << 10,
187   GDK_BUTTON4_MASK  = 1 << 11,
188   GDK_BUTTON5_MASK  = 1 << 12,
189
190   /* The next few modifiers are used by XKB, so we skip to the end.
191    * Bits 15 - 25 are currently unused. Bit 29 is used internally.
192    */
193   
194   GDK_SUPER_MASK    = 1 << 26,
195   GDK_HYPER_MASK    = 1 << 27,
196   GDK_META_MASK     = 1 << 28,
197   
198   GDK_RELEASE_MASK  = 1 << 30,
199
200   GDK_MODIFIER_MASK = 0x5c001fff
201 } GdkModifierType;
202
203 typedef enum
204 {
205   GDK_OK          = 0,
206   GDK_ERROR       = -1,
207   GDK_ERROR_PARAM = -2,
208   GDK_ERROR_FILE  = -3,
209   GDK_ERROR_MEM   = -4
210 } GdkStatus;
211
212 /* We define specific numeric values for these constants,
213  * since old application code may depend on them matching the X values
214  * We don't actually depend on the matchup ourselves.
215  */
216 typedef enum
217 {
218   GDK_GRAB_SUCCESS         = 0,
219   GDK_GRAB_ALREADY_GRABBED = 1,
220   GDK_GRAB_INVALID_TIME    = 2,
221   GDK_GRAB_NOT_VIEWABLE    = 3,
222   GDK_GRAB_FROZEN          = 4
223 } GdkGrabStatus;
224
225 /**
226  * GdkGrabOwnership:
227  * @GDK_OWNERSHIP_NONE: All other devices' events are allowed.
228  * @GDK_OWNERSHIP_WINDOW: Other devices' events are blocked for the grab window.
229  * @GDK_OWNERSHIP_APPLICATION: Other devices' events are blocked for the whole application.
230  *
231  * Defines how device grabs interact with other devices.
232  */
233 typedef enum
234 {
235   GDK_OWNERSHIP_NONE,
236   GDK_OWNERSHIP_WINDOW,
237   GDK_OWNERSHIP_APPLICATION
238 } GdkGrabOwnership;
239
240 /* Event masks. (Used to select what types of events a window
241  *  *  will receive).
242  *   */
243 typedef enum
244 {
245   GDK_EXPOSURE_MASK             = 1 << 1,
246   GDK_POINTER_MOTION_MASK       = 1 << 2,
247   GDK_POINTER_MOTION_HINT_MASK  = 1 << 3,
248   GDK_BUTTON_MOTION_MASK        = 1 << 4,
249   GDK_BUTTON1_MOTION_MASK       = 1 << 5,
250   GDK_BUTTON2_MOTION_MASK       = 1 << 6,
251   GDK_BUTTON3_MOTION_MASK       = 1 << 7,
252   GDK_BUTTON_PRESS_MASK         = 1 << 8,
253   GDK_BUTTON_RELEASE_MASK       = 1 << 9,
254   GDK_KEY_PRESS_MASK            = 1 << 10,
255   GDK_KEY_RELEASE_MASK          = 1 << 11,
256   GDK_ENTER_NOTIFY_MASK         = 1 << 12,
257   GDK_LEAVE_NOTIFY_MASK         = 1 << 13,
258   GDK_FOCUS_CHANGE_MASK         = 1 << 14,
259   GDK_STRUCTURE_MASK            = 1 << 15,
260   GDK_PROPERTY_CHANGE_MASK      = 1 << 16,
261   GDK_VISIBILITY_NOTIFY_MASK    = 1 << 17,
262   GDK_PROXIMITY_IN_MASK         = 1 << 18,
263   GDK_PROXIMITY_OUT_MASK        = 1 << 19,
264   GDK_SUBSTRUCTURE_MASK         = 1 << 20,
265   GDK_SCROLL_MASK               = 1 << 21,
266   GDK_ALL_EVENTS_MASK           = 0x3FFFFE
267 } GdkEventMask;
268
269 struct _GdkPoint
270 {
271   gint x;
272   gint y;
273 };
274
275 struct _GdkRectangle
276 {
277   gint x;
278   gint y;
279   gint width;
280   gint height;
281 };
282
283 struct _GdkSegment
284 {
285   gint x1;
286   gint y1;
287   gint x2;
288   gint y2;
289 };
290
291 struct _GdkSpan
292 {
293   gint x;
294   gint y;
295   gint width;
296 };
297
298 G_END_DECLS
299
300
301 #endif /* __GDK_TYPES_H__ */