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