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