]> Pileus Git - ~andy/gtk/blob - gdk/gdktypes.h
new functions gtk_selection_data_copy and gtk_selection_data_free.
[~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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 #ifndef __GDK_TYPES_H__
20 #define __GDK_TYPES_H__
21
22
23 /* GDK uses "glib". (And so does GTK).
24  */
25 #include <glib.h>
26
27
28 #define GDK_NONE             0L
29 #define GDK_CURRENT_TIME     0L
30 #define GDK_PARENT_RELATIVE  1L
31
32 /* special deviceid for core pointer events */
33 #define GDK_CORE_POINTER 0xfedc
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #pragma }
39 #endif /* __cplusplus */
40
41
42 /* Type definitions for the basic structures.
43  */
44
45 typedef gulong                        GdkAtom;
46 typedef struct _GdkColor              GdkColor;
47 typedef struct _GdkColormap           GdkColormap;
48 typedef struct _GdkVisual             GdkVisual;
49 typedef struct _GdkWindowAttr         GdkWindowAttr;
50 typedef struct _GdkWindow             GdkWindow;
51 typedef struct _GdkWindow             GdkPixmap;
52 typedef struct _GdkWindow             GdkBitmap;
53 typedef struct _GdkWindow             GdkDrawable;
54 typedef struct _GdkImage              GdkImage;
55 typedef struct _GdkGCValues           GdkGCValues;
56 typedef struct _GdkGC                 GdkGC;
57 typedef struct _GdkPoint              GdkPoint;
58 typedef struct _GdkRectangle          GdkRectangle;
59 typedef struct _GdkSegment            GdkSegment;
60 typedef struct _GdkFont               GdkFont;
61 typedef struct _GdkCursor             GdkCursor;
62 typedef struct _GdkColorContextDither GdkColorContextDither;
63 typedef struct _GdkColorContext       GdkColorContext;
64
65 typedef struct _GdkEventAny         GdkEventAny;
66 typedef struct _GdkEventExpose      GdkEventExpose;
67 typedef struct _GdkEventNoExpose    GdkEventNoExpose;
68 typedef struct _GdkEventVisibility  GdkEventVisibility;
69 typedef struct _GdkEventMotion      GdkEventMotion;
70 typedef struct _GdkEventButton      GdkEventButton;
71 typedef struct _GdkEventKey         GdkEventKey;
72 typedef struct _GdkEventFocus       GdkEventFocus;
73 typedef struct _GdkEventCrossing    GdkEventCrossing;
74 typedef struct _GdkEventConfigure   GdkEventConfigure;
75 typedef struct _GdkEventProperty    GdkEventProperty;
76 typedef struct _GdkEventSelection   GdkEventSelection;
77 typedef struct _GdkEventProximity   GdkEventProximity;
78 typedef struct _GdkEventOther       GdkEventOther;
79 typedef struct _GdkEventDragBegin   GdkEventDragBegin;
80 typedef struct _GdkEventDragRequest GdkEventDragRequest;
81 typedef struct _GdkEventDropEnter   GdkEventDropEnter;
82 typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
83 typedef struct _GdkEventDropLeave   GdkEventDropLeave;
84 typedef struct _GdkEventClient      GdkEventClient;
85 typedef union  _GdkEvent            GdkEvent;
86 typedef struct _GdkDeviceKey        GdkDeviceKey;
87 typedef struct _GdkDeviceInfo       GdkDeviceInfo;
88 typedef struct _GdkTimeCoord        GdkTimeCoord;
89 typedef struct _GdkRegion           GdkRegion;
90 typedef gint (*GdkEventFunc) (GdkEvent *event,
91                               gpointer  data);
92
93 typedef void*                     GdkIC;
94 typedef void*                     GdkIM;
95
96
97 /* Types of windows.
98  *   Root: There is only 1 root window and it is initialized
99  *         at startup. Creating a window of type GDK_WINDOW_ROOT
100  *         is an error.
101  *   Toplevel: Windows which interact with the window manager.
102  *   Child: Windows which are children of some other type of window.
103  *          (Any other type of window). Most windows are child windows.
104  *   Dialog: A special kind of toplevel window which interacts with
105  *           the window manager slightly differently than a regular
106  *           toplevel window. Dialog windows should be used for any
107  *           transient window.
108  *   Pixmap: Pixmaps are really just another kind of window which
109  *           doesn't actually appear on the screen. It can't have
110  *           children, either and is really just a convenience so
111  *           that the drawing functions can work on both windows
112  *           and pixmaps transparently. (ie. You shouldn't pass a
113  *           pixmap to any procedure which accepts a window with the
114  *           exception of the drawing functions).
115  *   Foreign: A window that actually belongs to another application
116  */
117 typedef enum
118 {
119   G_SV (GDK_WINDOW_ROOT,        root),
120   G_SV (GDK_WINDOW_TOPLEVEL,    toplevel),
121   G_SV (GDK_WINDOW_CHILD,       child),
122   G_SV (GDK_WINDOW_DIALOG,      dialog),
123   G_SV (GDK_WINDOW_TEMP,        temp),
124   G_SV (GDK_WINDOW_PIXMAP,      pixmap),
125   G_SV (GDK_WINDOW_FOREIGN,     foreign)
126 } G_ENUM (GdkWindowType);
127
128 /* Classes of windows.
129  *   InputOutput: Almost every window should be of this type. Such windows
130  *                receive events and are also displayed on screen.
131  *   InputOnly: Used only in special circumstances when events need to be
132  *              stolen from another window or windows. Input only windows
133  *              have no visible output, so they are handy for placing over
134  *              top of a group of windows in order to grab the events (or
135  *              filter the events) from those windows.
136  */
137 typedef enum
138 {
139   G_SV (GDK_INPUT_OUTPUT,       input-output),
140   G_SV (GDK_INPUT_ONLY,         input-only)
141 } G_ENUM (GdkWindowClass);
142
143 /* Types of images.
144  *   Normal: Normal X image type. These are slow as they involve passing
145  *           the entire image through the X connection each time a draw
146  *           request is required.
147  *   Shared: Shared memory X image type. These are fast as the X server
148  *           and the program actually use the same piece of memory. They
149  *           should be used with care though as there is the possibility
150  *           for both the X server and the program to be reading/writing
151  *           the image simultaneously and producing undesired results.
152  */
153 typedef enum
154 {
155   G_SV (GDK_IMAGE_NORMAL,       normal),
156   G_SV (GDK_IMAGE_SHARED,       shared),
157   G_SV (GDK_IMAGE_FASTEST,      fastest)
158 } G_ENUM (GdkImageType);
159
160 /* Types of visuals.
161  *   StaticGray:
162  *   Grayscale:
163  *   StaticColor:
164  *   PseudoColor:
165  *   TrueColor:
166  *   DirectColor:
167  */
168 typedef enum
169 {
170   G_SV (GDK_VISUAL_STATIC_GRAY,         static-gray),
171   G_SV (GDK_VISUAL_GRAYSCALE,           grayscale),
172   G_SV (GDK_VISUAL_STATIC_COLOR,        static-color),
173   G_SV (GDK_VISUAL_PSEUDO_COLOR,        pseudo-color),
174   G_SV (GDK_VISUAL_TRUE_COLOR,          true-color),
175   G_SV (GDK_VISUAL_DIRECT_COLOR,        direct-color)
176 } G_ENUM (GdkVisualType);
177
178 /* Types of font.
179  *   GDK_FONT_FONT: the font is an XFontStruct.
180  *   GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
181  */
182 typedef enum
183 {
184   G_SV (GDK_FONT_FONT,          font),
185   G_SV (GDK_FONT_FONTSET,       fontset)
186 } G_ENUM (GdkFontType);
187
188 /* Window attribute mask values.
189  *   GDK_WA_TITLE: The "title" field is valid.
190  *   GDK_WA_X: The "x" field is valid.
191  *   GDK_WA_Y: The "y" field is valid.
192  *   GDK_WA_CURSOR: The "cursor" field is valid.
193  *   GDK_WA_COLORMAP: The "colormap" field is valid.
194  *   GDK_WA_VISUAL: The "visual" field is valid.
195  */
196 typedef enum
197 {
198   G_NV (GDK_WA_TITLE,           title,          1 << 1),
199   G_NV (GDK_WA_X,               x,              1 << 2),
200   G_NV (GDK_WA_Y,               y,              1 << 3),
201   G_NV (GDK_WA_CURSOR,          cursor,         1 << 4),
202   G_NV (GDK_WA_COLORMAP,        colormap,       1 << 5),
203   G_NV (GDK_WA_VISUAL,          visual,         1 << 6),
204   G_NV (GDK_WA_WMCLASS,         wmclass,        1 << 7),
205   G_NV (GDK_WA_NOREDIR,         noredir,        1 << 8)
206 } G_FLAGS (GdkWindowAttributesType);
207
208 /* Size restriction enumeration.
209  */
210 typedef enum
211 {
212   G_NV (GDK_HINT_POS,           pos,            1 << 0),
213   G_NV (GDK_HINT_MIN_SIZE,      min-size,       1 << 1),
214   G_NV (GDK_HINT_MAX_SIZE,      max-size,       1 << 2)
215 } G_FLAGS (GdkWindowHints);
216
217 /* GC function types.
218  *   Copy: Overwrites destination pixels with the source pixels.
219  *   Invert: Inverts the destination pixels.
220  *   Xor: Xor's the destination pixels with the source pixels.
221  */
222 typedef enum
223 {
224   G_SV (GDK_COPY,       copy),
225   G_SV (GDK_INVERT,     invert),
226   G_SV (GDK_XOR,        xor)
227 } G_ENUM (GdkFunction);
228
229 /* GC fill types.
230  *  Solid:
231  *  Tiled:
232  *  Stippled:
233  *  OpaqueStippled:
234  */
235 typedef enum
236 {
237   G_SV (GDK_SOLID,              solid),
238   G_SV (GDK_TILED,              tiled),
239   G_SV (GDK_STIPPLED,           stippled),
240   G_SV (GDK_OPAQUE_STIPPLED,    opaque-stippled)
241 } G_ENUM (GdkFill);
242
243 /* GC fill rule for polygons
244  *  EvenOddRule
245  *  WindingRule
246  */
247 typedef enum
248 {
249   G_SV (GDK_EVEN_ODD_RULE,      even-odd-rule),
250   G_SV (GDK_WINDING_RULE,       winding-rule)
251 } G_ENUM (GdkFillRule);
252
253 /* GC line styles
254  *  Solid:
255  *  OnOffDash:
256  *  DoubleDash:
257  */
258 typedef enum
259 {
260   G_SV (GDK_LINE_SOLID,         solid),
261   G_SV (GDK_LINE_ON_OFF_DASH,   on-off-dash),
262   G_SV (GDK_LINE_DOUBLE_DASH,   double-dash)
263 } G_ENUM (GdkLineStyle);
264
265 /* GC cap styles
266  *  CapNotLast:
267  *  CapButt:
268  *  CapRound:
269  *  CapProjecting:
270  */
271 typedef enum
272 {
273   G_SV (GDK_CAP_NOT_LAST,       not-last),
274   G_SV (GDK_CAP_BUTT,           butt),
275   G_SV (GDK_CAP_ROUND,          round),
276   G_SV (GDK_CAP_PROJECTING,     projecting)
277 } G_ENUM (GdkCapStyle);
278
279 /* GC join styles
280  *  JoinMiter:
281  *  JoinRound:
282  *  JoinBevel:
283  */
284 typedef enum
285 {
286   G_SV (GDK_JOIN_MITER, miter),
287   G_SV (GDK_JOIN_ROUND, round),
288   G_SV (GDK_JOIN_BEVEL, bevel)
289 } G_ENUM (GdkJoinStyle);
290
291 /* Cursor types.
292  */
293 typedef enum
294 {
295 #include <gdk/gdkcursors.h>
296   GDK_LAST_CURSOR,
297   GDK_CURSOR_IS_PIXMAP = -1
298 } GdkCursorType;
299
300 typedef enum {
301   G_SV (GDK_FILTER_CONTINUE,    continue),  /* Event not handled,
302                                              * continue processesing */
303   G_SV (GDK_FILTER_TRANSLATE,   translate), /* Translated event stored */
304   G_SV (GDK_FILTER_REMOVE,      remove)     /* Terminate processing,
305                                              * removing event */
306 } G_ENUM (GdkFilterReturn);
307
308 typedef enum {
309   G_SV (GDK_VISIBILITY_UNOBSCURED,      unobscured),
310   G_SV (GDK_VISIBILITY_PARTIAL,         partial),
311   G_SV (GDK_VISIBILITY_FULLY_OBSCURED,  fully-obscured)
312 } G_ENUM (GdkVisibilityState);
313
314 /* Event types.
315  *   Nothing: No event occurred.
316  *   Delete: A window delete event was sent by the window manager.
317  *           The specified window should be deleted.
318  *   Destroy: A window has been destroyed.
319  *   Expose: Part of a window has been uncovered.
320  *   NoExpose: Same as expose, but no expose event was generated.
321  *   VisibilityNotify: A window has become fully/partially/not obscured.
322  *   MotionNotify: The mouse has moved.
323  *   ButtonPress: A mouse button was pressed.
324  *   ButtonRelease: A mouse button was release.
325  *   KeyPress: A key was pressed.
326  *   KeyRelease: A key was released.
327  *   EnterNotify: A window was entered.
328  *   LeaveNotify: A window was exited.
329  *   FocusChange: The focus window has changed. (The focus window gets
330  *                keyboard events).
331  *   Resize: A window has been resized.
332  *   Map: A window has been mapped. (It is now visible on the screen).
333  *   Unmap: A window has been unmapped. (It is no longer visible on
334  *          the screen).
335  */
336 typedef enum
337 {
338   G_NV (GDK_NOTHING,            NOTHING,        -1),
339   G_NV (GDK_DELETE,             delete,          0),
340   G_NV (GDK_DESTROY,            destroy,         1),
341   G_NV (GDK_EXPOSE,             expose,          2),
342   G_NV (GDK_MOTION_NOTIFY,      motion-notify,   3),
343   G_NV (GDK_BUTTON_PRESS,       button-press,    4),
344   G_NV (GDK_2BUTTON_PRESS,      2button-press,   5),
345   G_NV (GDK_3BUTTON_PRESS,      3button-press,   6),
346   G_NV (GDK_BUTTON_RELEASE,     button-release,  7),
347   G_NV (GDK_KEY_PRESS,          key-press,       8),
348   G_NV (GDK_KEY_RELEASE,        key-release,     9),
349   G_NV (GDK_ENTER_NOTIFY,       enter-notify,    10),
350   G_NV (GDK_LEAVE_NOTIFY,       leave-notify,    11),
351   G_NV (GDK_FOCUS_CHANGE,       focus-change,    12),
352   G_NV (GDK_CONFIGURE,          configure,       13),
353   G_NV (GDK_MAP,                map,             14),
354   G_NV (GDK_UNMAP,              unmap,           15),
355   G_NV (GDK_PROPERTY_NOTIFY,    property-notify, 16),
356   G_NV (GDK_SELECTION_CLEAR,    selection-clear, 17),
357   G_NV (GDK_SELECTION_REQUEST,  selection-request,18),
358   G_NV (GDK_SELECTION_NOTIFY,   selection-notify,19),
359   G_NV (GDK_PROXIMITY_IN,       proximity-in,    20),
360   G_NV (GDK_PROXIMITY_OUT,      proximity-out,   21),
361   G_NV (GDK_DRAG_BEGIN,         drag-begin,      22),
362   G_NV (GDK_DRAG_REQUEST,       drag-request,    23),
363   G_NV (GDK_DROP_ENTER,         drop-enter,      24),
364   G_NV (GDK_DROP_LEAVE,         drop-leave,      25),
365   G_NV (GDK_DROP_DATA_AVAIL,    drop-data-avail, 26),
366   G_NV (GDK_CLIENT_EVENT,       client-event,    27),
367   G_NV (GDK_VISIBILITY_NOTIFY,  visibility-notify, 28),
368   G_NV (GDK_NO_EXPOSE,          no-expose,       29),
369   G_NV (GDK_OTHER_EVENT,        other-event,     9999)  /* Deprecated, use
370                                                          * filters instead */
371 } G_ENUM (GdkEventType);
372
373 /* Event masks. (Used to select what types of events a window
374  *  will receive).
375  */
376 typedef enum
377 {
378   G_NV (GDK_EXPOSURE_MASK,              exposure-mask,          1 << 1),
379   G_NV (GDK_POINTER_MOTION_MASK,        pointer-motion-mask,    1 << 2),
380   G_NV (GDK_POINTER_MOTION_HINT_MASK,   pointer-motion-hint-mask, 1 << 3),
381   G_NV (GDK_BUTTON_MOTION_MASK,         button-motion-mask,     1 << 4),
382   G_NV (GDK_BUTTON1_MOTION_MASK,        button1-motion-mask,    1 << 5),
383   G_NV (GDK_BUTTON2_MOTION_MASK,        button2-motion-mask,    1 << 6),
384   G_NV (GDK_BUTTON3_MOTION_MASK,        button3-motion-mask,    1 << 7),
385   G_NV (GDK_BUTTON_PRESS_MASK,          button-press-mask,      1 << 8),
386   G_NV (GDK_BUTTON_RELEASE_MASK,        button-release-mask,    1 << 9),
387   G_NV (GDK_KEY_PRESS_MASK,             key-press-mask,         1 << 10),
388   G_NV (GDK_KEY_RELEASE_MASK,           key-release-mask,       1 << 11),
389   G_NV (GDK_ENTER_NOTIFY_MASK,          enter-notify-mask,      1 << 12),
390   G_NV (GDK_LEAVE_NOTIFY_MASK,          leave-notify-mask,      1 << 13),
391   G_NV (GDK_FOCUS_CHANGE_MASK,          focus-change-mask,      1 << 14),
392   G_NV (GDK_STRUCTURE_MASK,             structure-mask,         1 << 15),
393   G_NV (GDK_PROPERTY_CHANGE_MASK,       property-change-mask,   1 << 16),
394   G_NV (GDK_VISIBILITY_NOTIFY_MASK,     visibility-notify-mask, 1 << 17),
395   G_NV (GDK_PROXIMITY_IN_MASK,          proximity-in-mask,      1 << 18),
396   G_NV (GDK_PROXIMITY_OUT_MASK,         proximity-out-mask,     1 << 19),
397   G_NV (GDK_SUBSTRUCTURE_MASK,          substructure-mask,      1 << 20),
398   G_NV (GDK_ALL_EVENTS_MASK,            all-events-mask,        0x0FFFFF)
399 } G_FLAGS (GdkEventMask);
400
401 /* Types of enter/leave notifications.
402  *   Ancestor:
403  *   Virtual:
404  *   Inferior:
405  *   Nonlinear:
406  *   NonlinearVirtual:
407  *   Unknown: An unknown type of enter/leave event occurred.
408  */
409 typedef enum
410 {
411   G_NV (GDK_NOTIFY_ANCESTOR,            ancestor,               0),
412   G_NV (GDK_NOTIFY_VIRTUAL,             virtual,                1),
413   G_NV (GDK_NOTIFY_INFERIOR,            inferior,               2),
414   G_NV (GDK_NOTIFY_NONLINEAR,           nonlinear,              3),
415   G_NV (GDK_NOTIFY_NONLINEAR_VIRTUAL,   nonlinear-virtual,      4),
416   G_NV (GDK_NOTIFY_UNKNOWN,             unknown,                5)
417 } G_ENUM (GdkNotifyType);
418
419 /* Enter/leave event modes.
420  *   NotifyNormal
421  *   NotifyGrab
422  *   NotifyUngrab
423  */
424 typedef enum
425 {
426   G_SV (GDK_CROSSING_NORMAL,    crossing-normal),
427   G_SV (GDK_CROSSING_GRAB,      crossing-grab),
428   G_SV (GDK_CROSSING_UNGRAB,    crossing-ungrab)
429 } G_ENUM (GdkCrossingMode);
430
431 /* Types of modifiers.
432  */
433 typedef enum
434 {
435   G_NV (GDK_SHIFT_MASK,         shift-mask,     1 << 0),
436   G_NV (GDK_LOCK_MASK,          lock-mask,      1 << 1),
437   G_NV (GDK_CONTROL_MASK,       control-mask,   1 << 2),
438   G_NV (GDK_MOD1_MASK,          mod1-mask,      1 << 3),
439   G_NV (GDK_MOD2_MASK,          mod2-mask,      1 << 4),
440   G_NV (GDK_MOD3_MASK,          mod3-mask,      1 << 5),
441   G_NV (GDK_MOD4_MASK,          mod4-mask,      1 << 6),
442   G_NV (GDK_MOD5_MASK,          mod5-mask,      1 << 7),
443   G_NV (GDK_BUTTON1_MASK,       button1-mask,   1 << 8),
444   G_NV (GDK_BUTTON2_MASK,       button2-mask,   1 << 9),
445   G_NV (GDK_BUTTON3_MASK,       button3-mask,   1 << 10),
446   G_NV (GDK_BUTTON4_MASK,       button4-mask,   1 << 11),
447   G_NV (GDK_BUTTON5_MASK,       button5-mask,   1 << 12),
448   G_NV (GDK_MODIFIER_MASK,      modifier-mask,  0x1fff)
449 } G_FLAGS (GdkModifierType);
450
451 typedef enum
452 {
453   G_NV (GDK_CLIP_BY_CHILDREN,   clip-by-children,       0),
454   G_NV (GDK_INCLUDE_INFERIORS,  include-inferiors,      1)
455 } G_ENUM (GdkSubwindowMode);
456
457 typedef enum
458 {
459   G_NV (GDK_INPUT_READ,         read,           1 << 0),
460   G_NV (GDK_INPUT_WRITE,        write,          1 << 1),
461   G_NV (GDK_INPUT_EXCEPTION,    exception,      1 << 2)
462 } G_FLAGS (GdkInputCondition);
463
464 typedef enum
465 {
466   G_NV (GDK_OK,                 ok,              0),
467   G_NV (GDK_ERROR,              error,          -1),
468   G_NV (GDK_ERROR_PARAM,        error-param,    -2),
469   G_NV (GDK_ERROR_FILE,         error-file,     -3),
470   G_NV (GDK_ERROR_MEM,          error-mem,      -4)
471 } G_ENUM (GdkStatus);
472
473 typedef enum
474 {
475   G_SV (GDK_LSB_FIRST,  lsb-first),
476   G_SV (GDK_MSB_FIRST,  msb-first)
477 } G_ENUM (GdkByteOrder);
478
479 typedef enum
480 {
481   G_NV (GDK_GC_FOREGROUND,      foreground,     1 << 0),
482   G_NV (GDK_GC_BACKGROUND,      background,     1 << 1),
483   G_NV (GDK_GC_FONT,            font,           1 << 2),
484   G_NV (GDK_GC_FUNCTION,        function,       1 << 3),
485   G_NV (GDK_GC_FILL,            fill,           1 << 4),
486   G_NV (GDK_GC_TILE,            tile,           1 << 5),
487   G_NV (GDK_GC_STIPPLE,         stipple,        1 << 6),
488   G_NV (GDK_GC_CLIP_MASK,       clip-mask,      1 << 7),
489   G_NV (GDK_GC_SUBWINDOW,       subwindow,      1 << 8),
490   G_NV (GDK_GC_TS_X_ORIGIN,     ts-x-origin,    1 << 9),
491   G_NV (GDK_GC_TS_Y_ORIGIN,     ts-y-origin,    1 << 10),
492   G_NV (GDK_GC_CLIP_X_ORIGIN,   clip-x-origin,  1 << 11),
493   G_NV (GDK_GC_CLIP_Y_ORIGIN,   clip-y-origin,  1 << 12),
494   G_NV (GDK_GC_EXPOSURES,       exposures,      1 << 13),
495   G_NV (GDK_GC_LINE_WIDTH,      line-width,     1 << 14),
496   G_NV (GDK_GC_LINE_STYLE,      line-style,     1 << 15),
497   G_NV (GDK_GC_CAP_STYLE,       cap-style,      1 << 16),
498   G_NV (GDK_GC_JOIN_STYLE,      join-style,     1 << 17)
499 } G_FLAGS (GdkGCValuesMask);
500
501 typedef enum
502 {
503   G_NV (GDK_SELECTION_PRIMARY,          primary,        1),
504   G_NV (GDK_SELECTION_SECONDARY,        secondary,      2)
505 } G_ENUM (GdkSelection);
506
507 typedef enum
508 {
509   G_SV (GDK_PROPERTY_NEW_VALUE, new-value),
510   G_SV (GDK_PROPERTY_DELETE,    delete)
511 } G_ENUM (GdkPropertyState);
512
513 typedef enum
514 {
515   G_SV (GDK_PROP_MODE_REPLACE,  replace),
516   G_SV (GDK_PROP_MODE_PREPEND,  prepend),
517   G_SV (GDK_PROP_MODE_APPEND,   append)
518 } G_ENUM (GdkPropMode);
519
520 /* These definitions are for version 1 of the OffiX D&D protocol,
521    taken from <OffiX/DragAndDropTypes.h> */
522 typedef enum
523 {
524   G_NV (GDK_DNDTYPE_NOTDND,     NOTDND,         -1),
525   G_NV (GDK_DNDTYPE_UNKNOWN,    UNKNOWN,        0),
526   G_NV (GDK_DNDTYPE_RAWDATA,    RAWDATA,        1),
527   G_NV (GDK_DNDTYPE_FILE,       FILE,           2),
528   G_NV (GDK_DNDTYPE_FILES,      FILES,          3),
529   G_NV (GDK_DNDTYPE_TEXT,       text,           4),
530   G_NV (GDK_DNDTYPE_DIR,        dir,            5),
531   G_NV (GDK_DNDTYPE_LINK,       link,           6),
532   G_NV (GDK_DNDTYPE_EXE,        exe,            7),
533   G_NV (GDK_DNDTYPE_URL,        url,            8),
534   G_NV (GDK_DNDTYPE_MIME,       mime,           9),
535   G_NV (GDK_DNDTYPE_END,        end,            10)
536 } G_ENUM (GdkDndType);
537
538 /* Enums for XInput support */
539
540 typedef enum
541 {
542   G_SV (GDK_SOURCE_MOUSE,       mouse),
543   G_SV (GDK_SOURCE_PEN,         pen),
544   G_SV (GDK_SOURCE_ERASER,      eraser),
545   G_SV (GDK_SOURCE_CURSOR,      cursor)
546 } G_ENUM (GdkInputSource);
547
548 typedef enum
549 {
550   G_SV (GDK_MODE_DISABLED,      disabled),
551   G_SV (GDK_MODE_SCREEN,        screen),
552   G_SV (GDK_MODE_WINDOW,        window)
553 } G_ENUM (GdkInputMode);
554
555 typedef enum
556 {
557   G_SV (GDK_AXIS_IGNORE,        ignore),
558   G_SV (GDK_AXIS_X,             x),
559   G_SV (GDK_AXIS_Y,             y),
560   G_SV (GDK_AXIS_PRESSURE,      pressure),
561   G_SV (GDK_AXIS_XTILT,         xtilt),
562   G_SV (GDK_AXIS_YTILT,         ytilt),
563   G_SV (GDK_AXIS_LAST,          last)
564 } G_ENUM (GdkAxisUse);
565
566 /* The next two types define enums for predefined atoms relating
567  * to selections. In general, one will need to use gdk_intern_atom
568  */
569 typedef enum
570 {
571   G_NV (GDK_TARGET_BITMAP,      bitmap,         5),
572   G_NV (GDK_TARGET_COLORMAP,    colormap,       7),
573   G_NV (GDK_TARGET_DRAWABLE,    drawable,       17),
574   G_NV (GDK_TARGET_PIXMAP,      pixmap,         20),
575   G_NV (GDK_TARGET_STRING,      string,         31)
576 } G_ENUM (GdkTarget);
577
578 typedef enum
579 {
580   G_NV (GDK_SELECTION_TYPE_ATOM,        atom,           4),
581   G_NV (GDK_SELECTION_TYPE_BITMAP,      bitmap,         5),
582   G_NV (GDK_SELECTION_TYPE_COLORMAP,    colormap,       7),
583   G_NV (GDK_SELECTION_TYPE_DRAWABLE,    drawable,       17),
584   G_NV (GDK_SELECTION_TYPE_INTEGER,     integer,        19),
585   G_NV (GDK_SELECTION_TYPE_PIXMAP,      pixmap,         20),
586   G_NV (GDK_SELECTION_TYPE_WINDOW,      window,         33),
587   G_NV (GDK_SELECTION_TYPE_STRING,      string,         31)
588 } G_ENUM (GdkSelectionType);
589
590 typedef enum
591 {
592   G_SV (GDK_EXTENSION_EVENTS_NONE,      none),
593   G_SV (GDK_EXTENSION_EVENTS_ALL,       all),
594   G_SV (GDK_EXTENSION_EVENTS_CURSOR,    cursor)
595 } G_ENUM (GdkExtensionMode);
596
597 typedef enum
598 {
599   GdkIMPreeditArea      = 0x0001L,
600   GdkIMPreeditCallbacks = 0x0002L,
601   GdkIMPreeditPosition  = 0x0004L,
602   GdkIMPreeditNothing   = 0x0008L,
603   GdkIMPreeditNone      = 0x0010L,
604   GdkIMStatusArea       = 0x0100L,
605   GdkIMStatusCallbacks  = 0x0200L,
606   GdkIMStatusNothing    = 0x0400L,
607   GdkIMStatusNone       = 0x0800L
608 } GdkIMStyle;
609
610 /* The next two enumeration values current match the
611  * Motif constants. If this is changed, the implementation
612  * of gdk_window_set_decorations/gdk_window_set_functions
613  * will need to change as well.
614  */
615 typedef enum
616 {
617   G_NV (GDK_DECOR_ALL,          all,            1 << 0),
618   G_NV (GDK_DECOR_BORDER,       border,         1 << 1),
619   G_NV (GDK_DECOR_RESIZEH,      resizeh,        1 << 2),
620   G_NV (GDK_DECOR_TITLE,        title,          1 << 3),
621   G_NV (GDK_DECOR_MENU,         menu,           1 << 4),
622   G_NV (GDK_DECOR_MINIMIZE,     minimize,       1 << 5),
623   G_NV (GDK_DECOR_MAXIMIZE,     maximize,       1 << 6)
624 } G_FLAGS (GdkWMDecoration);
625
626 typedef enum
627 {
628   G_NV (GDK_FUNC_ALL,           all,            1 << 0),
629   G_NV (GDK_FUNC_RESIZE,        resize,         1 << 1),
630   G_NV (GDK_FUNC_MOVE,          move,           1 << 2),
631   G_NV (GDK_FUNC_MINIMIZE,      minimize,       1 << 3),
632   G_NV (GDK_FUNC_MAXIMIZE,      maximize,       1 << 4),
633   G_NV (GDK_FUNC_CLOSE,         close,          1 << 5)
634 } G_FLAGS (GdkWMFunction);
635
636 #define GdkIMPreeditMask \
637         ( GdkIMPreeditArea     | GdkIMPreeditCallbacks | \
638           GdkIMPreeditPosition | GdkIMPreeditNothing | \
639           GdkIMPreeditNone )
640
641 #define GdkIMStatusMask \
642         ( GdkIMStatusArea | GdkIMStatusCallbacks | \
643           GdkIMStatusNothing | GdkIMStatusNone )
644
645 typedef void (*GdkInputFunction) (gpointer          data,
646                                   gint              source,
647                                   GdkInputCondition condition);
648
649 typedef void (*GdkDestroyNotify) (gpointer data);
650
651 /* Color Context modes.
652  *
653  * GDK_CC_MODE_UNDEFINED - unknown
654  * GDK_CC_MODE_BW        - default B/W
655  * GDK_CC_MODE_STD_CMAP  - has a standard colormap
656  * GDK_CC_MODE_TRUE      - is a TrueColor/DirectColor visual
657  * GDK_CC_MODE_MY_GRAY   - my grayramp
658  * GDK_CC_MODE_PALETTE   - has a pre-allocated palette
659  */ 
660
661 typedef enum
662 {
663   G_SV (GDK_CC_MODE_UNDEFINED,  undefined),
664   G_SV (GDK_CC_MODE_BW,         bw),
665   G_SV (GDK_CC_MODE_STD_CMAP,   std-cmap),
666   G_SV (GDK_CC_MODE_TRUE,       true),
667   G_SV (GDK_CC_MODE_MY_GRAY,    my-gray),
668   G_SV (GDK_CC_MODE_PALETTE,    palette)
669 } G_ENUM (GdkColorContextMode);
670
671 /* Types of overlapping between a rectangle and a region
672  * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
673  * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
674  * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
675  */
676
677 typedef enum
678 {
679   G_SV (GDK_OVERLAP_RECTANGLE_IN,       in),
680   G_SV (GDK_OVERLAP_RECTANGLE_OUT,      out),
681   G_SV (GDK_OVERLAP_RECTANGLE_PART,     part)
682 } G_ENUM (GdkOverlapType);
683
684 /* The color type.
685  *   A color consists of red, green and blue values in the
686  *    range 0-65535 and a pixel value. The pixel value is highly
687  *    dependent on the depth and colormap which this color will
688  *    be used to draw into. Therefore, sharing colors between
689  *    colormaps is a bad idea.
690  */
691 struct _GdkColor
692 {
693   gulong  pixel;
694   gushort red;
695   gushort green;
696   gushort blue;
697 };
698
699 /* The colormap type.
700  *   Colormaps consist of 256 colors.
701  */
702 struct _GdkColormap
703 {
704   gint      size;
705   GdkColor *colors;
706 };
707
708 /* The visual type.
709  *   "type" is the type of visual this is (PseudoColor, TrueColor, etc).
710  *   "depth" is the bit depth of this visual.
711  *   "colormap_size" is the size of a colormap for this visual.
712  *   "bits_per_rgb" is the number of significant bits per red, green and blue.
713  *  The red, green and blue masks, shifts and precisions refer
714  *   to value needed to calculate pixel values in TrueColor and DirectColor
715  *   visuals. The "mask" is the significant bits within the pixel. The
716  *   "shift" is the number of bits left we must shift a primary for it
717  *   to be in position (according to the "mask"). "prec" refers to how
718  *   much precision the pixel value contains for a particular primary.
719  */
720 struct _GdkVisual
721 {
722   GdkVisualType type;
723   gint depth;
724   GdkByteOrder byte_order;
725   gint colormap_size;
726   gint bits_per_rgb;
727   
728   guint32 red_mask;
729   gint red_shift;
730   gint red_prec;
731   
732   guint32 green_mask;
733   gint green_shift;
734   gint green_prec;
735   
736   guint32 blue_mask;
737   gint blue_shift;
738   gint blue_prec;
739 };
740
741 struct _GdkWindowAttr
742 {
743   gchar *title;
744   gint event_mask;
745   gint16 x, y;
746   gint16 width;
747   gint16 height;
748   GdkWindowClass wclass;
749   GdkVisual *visual;
750   GdkColormap *colormap;
751   GdkWindowType window_type;
752   GdkCursor *cursor;
753   gchar *wmclass_name;
754   gchar *wmclass_class;
755   gboolean override_redirect;
756 };
757
758 struct _GdkWindow
759 {
760   gpointer user_data;
761 };
762
763 struct _GdkImage
764 {
765   GdkImageType  type;
766   GdkVisual    *visual;     /* visual used to create the image */
767   GdkByteOrder  byte_order;
768   guint16       width;
769   guint16       height;
770   guint16       depth;
771   guint16       bpp;        /* bytes per pixel */
772   guint16       bpl;        /* bytes per line */
773   gpointer      mem;
774 };
775
776 struct _GdkGCValues
777 {
778   GdkColor          foreground;
779   GdkColor          background;
780   GdkFont          *font;
781   GdkFunction       function;
782   GdkFill           fill;
783   GdkPixmap        *tile;
784   GdkPixmap        *stipple;
785   GdkPixmap        *clip_mask;
786   GdkSubwindowMode  subwindow_mode;
787   gint              ts_x_origin;
788   gint              ts_y_origin;
789   gint              clip_x_origin;
790   gint              clip_y_origin;
791   gint              graphics_exposures;
792   gint              line_width;
793   GdkLineStyle      line_style;
794   GdkCapStyle       cap_style;
795   GdkJoinStyle      join_style;
796 };
797
798 struct _GdkGC
799 {
800   gint dummy_var;
801 };
802
803 struct _GdkPoint
804 {
805   gint16 x;
806   gint16 y;
807 };
808
809 struct _GdkRectangle
810 {
811   gint16 x;
812   gint16 y;
813   guint16 width;
814   guint16 height;
815 };
816
817 struct _GdkSegment
818 {
819   gint16 x1;
820   gint16 y1;
821   gint16 x2;
822   gint16 y2;
823 };
824
825 struct _GdkFont
826 {
827   GdkFontType type;
828   gint ascent;
829   gint descent;
830 };
831
832 struct _GdkCursor
833 {
834   GdkCursorType type;
835 };
836
837 struct _GdkColorContextDither
838 {
839   gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
840   gint fast_err[32][32][32]; /* internal RGB error information */
841   gint fast_erg[32][32][32];
842   gint fast_erb[32][32][32];
843 };
844
845 struct _GdkColorContext
846 {
847   GdkVisual *visual;
848   GdkColormap *colormap;
849   
850   gint num_colors;              /* available no. of colors in colormap */
851   gint max_colors;              /* maximum no. of colors */
852   gint num_allocated;           /* no. of allocated colors */
853   
854   GdkColorContextMode mode;
855   gint need_to_free_colormap;
856   GdkAtom std_cmap_atom;
857   
858   gulong *clut;                 /* color look-up table */
859   GdkColor *cmap;               /* colormap */
860   
861   GHashTable *color_hash;       /* hash table of allocated colors */
862   GdkColor *palette;            /* preallocated palette */
863   gint num_palette;             /* size of palette */
864   
865   GdkColorContextDither *fast_dither;   /* fast dither matrix */
866   
867   struct
868   {
869     gint red;
870     gint green;
871     gint blue;
872   } shifts;
873   
874   struct
875   {
876     gulong red;
877     gulong green;
878     gulong blue;
879   } masks;
880   
881   struct
882   {
883     gint red;
884     gint green;
885     gint blue;
886   } bits;
887   
888   gulong max_entry;
889   
890   gulong black_pixel;
891   gulong white_pixel;
892 };
893
894 /* Types for XInput support */
895
896 struct _GdkDeviceKey
897 {
898   guint keyval;
899   GdkModifierType modifiers;
900 };
901
902 struct _GdkDeviceInfo
903 {
904   guint32 deviceid;
905   gchar *name;
906   GdkInputSource source;
907   GdkInputMode mode;
908   gint has_cursor;      /* TRUE if the X pointer follows device motion */
909   gint num_axes;
910   GdkAxisUse *axes;    /* Specifies use for each axis */
911   gint num_keys;
912   GdkDeviceKey *keys;
913 };
914
915 struct _GdkTimeCoord
916 {
917   guint32 time;
918   gdouble x;
919   gdouble y;
920   gdouble pressure;
921   gdouble xtilt;
922   gdouble ytilt;
923 };
924
925 /* Event filtering */
926
927 typedef void GdkXEvent;   /* Can be cast to XEvent */
928
929 typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
930                                           GdkEvent *event,
931                                           gpointer  data);
932
933 struct _GdkEventAny
934 {
935   GdkEventType type;
936   GdkWindow *window;
937   gint8 send_event;
938 };
939
940 struct _GdkEventExpose
941 {
942   GdkEventType type;
943   GdkWindow *window;
944   gint8 send_event;
945   GdkRectangle area;
946   gint count; /* If non-zero, how many more events follow. */
947 };
948
949 struct _GdkEventNoExpose
950 {
951   GdkEventType type;
952   GdkWindow *window;
953   gint8 send_event;
954   /* XXX: does anyone need the X major_code or minor_code fields? */
955 };
956
957 struct _GdkEventVisibility
958 {
959   GdkEventType type;
960   GdkWindow *window;
961   gint8 send_event;
962   GdkVisibilityState state;
963 };
964
965 struct _GdkEventMotion
966 {
967   GdkEventType type;
968   GdkWindow *window;
969   gint8 send_event;
970   guint32 time;
971   gdouble x;
972   gdouble y;
973   gdouble pressure;
974   gdouble xtilt;
975   gdouble ytilt;
976   guint state;
977   gint16 is_hint;
978   GdkInputSource source;
979   guint32 deviceid;
980   gdouble x_root, y_root;
981 };
982
983 struct _GdkEventButton
984 {
985   GdkEventType type;
986   GdkWindow *window;
987   gint8 send_event;
988   guint32 time;
989   gdouble x;
990   gdouble y;
991   gdouble pressure;
992   gdouble xtilt;
993   gdouble ytilt;
994   guint state;
995   guint button;
996   GdkInputSource source;
997   guint32 deviceid;
998   gdouble x_root, y_root;
999 };
1000
1001 struct _GdkEventKey
1002 {
1003   GdkEventType type;
1004   GdkWindow *window;
1005   gint8 send_event;
1006   guint32 time;
1007   guint state;
1008   guint keyval;
1009   gint length;
1010   gchar *string;
1011 };
1012
1013 struct _GdkEventCrossing
1014 {
1015   GdkEventType type;
1016   GdkWindow *window;
1017   gint8 send_event;
1018   GdkWindow *subwindow;
1019   guint32 time;
1020   gdouble x;
1021   gdouble y;
1022   gdouble x_root;
1023   gdouble y_root;
1024   GdkCrossingMode mode;
1025   GdkNotifyType detail;
1026   gboolean focus;
1027   guint state;
1028 };
1029
1030 struct _GdkEventFocus
1031 {
1032   GdkEventType type;
1033   GdkWindow *window;
1034   gint8 send_event;
1035   gint16 in;
1036 };
1037
1038 struct _GdkEventConfigure
1039 {
1040   GdkEventType type;
1041   GdkWindow *window;
1042   gint8 send_event;
1043   gint16 x, y;
1044   gint16 width;
1045   gint16 height;
1046 };
1047
1048 struct _GdkEventProperty
1049 {
1050   GdkEventType type;
1051   GdkWindow *window;
1052   gint8 send_event;
1053   GdkAtom atom;
1054   guint32 time;
1055   guint state;
1056 };
1057
1058 struct _GdkEventSelection
1059 {
1060   GdkEventType type;
1061   GdkWindow *window;
1062   gint8 send_event;
1063   GdkAtom selection;
1064   GdkAtom target;
1065   GdkAtom property;
1066   guint32 requestor;
1067   guint32 time;
1068 };
1069
1070 /* This event type will be used pretty rarely. It only is important
1071    for XInput aware programs that are drawing their own cursor */
1072
1073 struct _GdkEventProximity
1074 {
1075   GdkEventType type;
1076   GdkWindow *window;
1077   gint8 send_event;
1078   guint32 time;
1079   GdkInputSource source;
1080   guint32 deviceid;
1081 };
1082
1083 struct _GdkEventDragRequest
1084 {
1085   GdkEventType type;
1086   GdkWindow *window;
1087   gint8 send_event;
1088   guint32 requestor;
1089   union {
1090     struct {
1091       guint protocol_version:4;
1092       guint sendreply:1;
1093       guint willaccept:1;
1094       guint delete_data:1; /* Do *not* delete if link is sent, only
1095                               if data is sent */
1096       guint senddata:1;
1097       guint reserved:22;
1098     } flags;
1099     glong allflags;
1100   } u;
1101   guint8 isdrop; /* This gdk event can be generated by a couple of
1102                     X events - this lets the app know whether the
1103                     drop really occurred or we just set the data */
1104   
1105   GdkPoint drop_coords;
1106   gchar *data_type;
1107   guint32 timestamp;
1108 };
1109
1110 struct _GdkEventDragBegin
1111 {
1112   GdkEventType type;
1113   GdkWindow *window;
1114   gint8 send_event;
1115   union {
1116     struct {
1117       guint protocol_version:4;
1118       guint reserved:28;
1119     } flags;
1120     glong allflags;
1121   } u;
1122 };
1123
1124 struct _GdkEventDropEnter
1125 {
1126   GdkEventType type;
1127   GdkWindow *window;
1128   gint8 send_event;
1129   guint32 requestor;
1130   union {
1131     struct {
1132       guint protocol_version:4;
1133       guint sendreply:1;
1134       guint extended_typelist:1;
1135       guint reserved:26;
1136     } flags;
1137     glong allflags;
1138   } u;
1139 };
1140
1141 struct _GdkEventDropLeave
1142 {
1143   GdkEventType type;
1144   GdkWindow *window;
1145   gint8 send_event;
1146   guint32 requestor;
1147   union {
1148     struct {
1149       guint protocol_version:4;
1150       guint reserved:28;
1151     } flags;
1152     glong allflags;
1153   } u;
1154 };
1155
1156 struct _GdkEventDropDataAvailable
1157 {
1158   GdkEventType type;
1159   GdkWindow *window;
1160   gint8 send_event;
1161   guint32 requestor;
1162   union {
1163     struct {
1164       guint protocol_version:4;
1165       guint isdrop:1;
1166       guint reserved:25;
1167     } flags;
1168     glong allflags;
1169   } u;
1170   gchar *data_type; /* MIME type */
1171   gulong data_numbytes;
1172   gpointer data;
1173   guint32 timestamp;
1174   GdkPoint coords;
1175 };
1176
1177 struct _GdkEventClient
1178 {
1179   GdkEventType type;
1180   GdkWindow *window;
1181   gint8 send_event;
1182   GdkAtom message_type;
1183   gushort data_format;
1184   union {
1185     char b[20];
1186     short s[10];
1187     long l[5];
1188   } data;
1189 };
1190
1191 struct _GdkEventOther
1192 {
1193   GdkEventType type;
1194   GdkWindow *window;
1195   gint8 send_event;
1196   GdkXEvent *xevent;
1197 };
1198
1199 union _GdkEvent
1200 {
1201   GdkEventType              type;
1202   GdkEventAny               any;
1203   GdkEventExpose            expose;
1204   GdkEventNoExpose          no_expose;
1205   GdkEventVisibility        visibility;
1206   GdkEventMotion            motion;
1207   GdkEventButton            button;
1208   GdkEventKey               key;
1209   GdkEventCrossing          crossing;
1210   GdkEventFocus             focus_change;
1211   GdkEventConfigure         configure;
1212   GdkEventProperty          property;
1213   GdkEventSelection         selection;
1214   GdkEventProximity         proximity;
1215   GdkEventDragBegin         dragbegin;
1216   GdkEventDragRequest       dragrequest;
1217   GdkEventDropEnter         dropenter;
1218   GdkEventDropLeave         dropleave;
1219   GdkEventDropDataAvailable dropdataavailable;
1220   GdkEventClient            client;
1221   GdkEventOther             other;
1222 };
1223
1224 struct _GdkRegion
1225 {
1226   gpointer user_data;
1227 };
1228
1229
1230
1231 #ifdef __cplusplus
1232 }
1233 #endif /* __cplusplus */
1234
1235
1236 #endif /* __GDK_TYPES_H__ */