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