]> Pileus Git - ~andy/gtk/blob - gdk/gdktypes.h
stylecontext: Do invalidation on first resize container
[~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, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #ifndef __GDK_TYPES_H__
26 #define __GDK_TYPES_H__
27
28 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
29 #error "Only <gdk/gdk.h> can be included directly."
30 #endif
31
32 /* GDK uses "glib". (And so does GTK).
33  */
34 #include <glib.h>
35 #include <pango/pango.h>
36 #include <glib-object.h>
37 #include <cairo.h>
38
39 /* The system specific file gdkconfig.h contains such configuration
40  * settings that are needed not only when compiling GDK (or GTK)
41  * itself, but also occasionally when compiling programs that use GDK
42  * (or GTK). One such setting is what windowing API backend is in use.
43  */
44 #include <gdk/gdkconfig.h>
45
46 /* some common magic values */
47
48 /**
49  * GDK_CURRENT_TIME:
50  *
51  * Represents the current time, and can be used anywhere a time is expected.
52  */
53 #define GDK_CURRENT_TIME     0L
54
55 /**
56  * GDK_PARENT_RELATIVE:
57  *
58  * A special value, indicating that the background
59  * for a window should be inherited from the parent window.
60  */
61 #define GDK_PARENT_RELATIVE  1L
62
63
64
65 G_BEGIN_DECLS
66
67
68 /* Type definitions for the basic structures.
69  */
70 typedef struct _GdkPoint              GdkPoint;
71
72 /**
73  * GdkRectangle:
74  *
75  * Defines the position and size of a rectangle. It is identical to
76  * #cairo_rectangle_int_t.
77  */
78 typedef cairo_rectangle_int_t         GdkRectangle;
79
80 /**
81  * GdkAtom:
82  *
83  * An opaque type representing a string as an index into a table
84  * of strings on the X server.
85  */
86 typedef struct _GdkAtom            *GdkAtom;
87
88 /**
89  * GDK_ATOM_TO_POINTER:
90  * @atom: a #GdkAtom.
91  *
92  * Converts a #GdkAtom into a pointer type.
93  */
94 #define GDK_ATOM_TO_POINTER(atom) (atom)
95
96 /**
97  * GDK_POINTER_TO_ATOM:
98  * @ptr: a pointer containing a #GdkAtom.
99  *
100  * Extracts a #GdkAtom from a pointer. The #GdkAtom must have been
101  * stored in the pointer with GDK_ATOM_TO_POINTER().
102  */
103 #define GDK_POINTER_TO_ATOM(ptr)  ((GdkAtom)(ptr))
104
105 #define _GDK_MAKE_ATOM(val) ((GdkAtom)GUINT_TO_POINTER(val))
106
107 /**
108  * GDK_NONE:
109  *
110  * A null value for #GdkAtom, used in a similar way as
111  * <literal>None</literal> in the Xlib API.
112  */
113 #define GDK_NONE            _GDK_MAKE_ATOM (0)
114
115 /* Forward declarations of commonly used types */
116 typedef struct _GdkColor              GdkColor;
117 typedef struct _GdkRGBA               GdkRGBA;
118 typedef struct _GdkCursor             GdkCursor;
119 typedef struct _GdkVisual             GdkVisual;
120 typedef struct _GdkDevice             GdkDevice;
121 typedef struct _GdkDragContext        GdkDragContext;
122
123 typedef struct _GdkDisplayManager     GdkDisplayManager;
124 typedef struct _GdkDeviceManager      GdkDeviceManager;
125 typedef struct _GdkDisplay            GdkDisplay;
126 typedef struct _GdkScreen             GdkScreen;
127 typedef struct _GdkWindow             GdkWindow;
128 typedef struct _GdkKeymap             GdkKeymap;
129 typedef struct _GdkAppLaunchContext   GdkAppLaunchContext;
130
131 /**
132  * GdkByteOrder:
133  * @GDK_LSB_FIRST: The values are stored with the least-significant byte
134  *   first. For instance, the 32-bit value 0xffeecc would be stored
135  *   in memory as 0xcc, 0xee, 0xff, 0x00.
136  * @GDK_MSB_FIRST: The values are stored with the most-significant byte
137  *   first. For instance, the 32-bit value 0xffeecc would be stored
138  *   in memory as 0x00, 0xff, 0xee, 0xcc.
139  *
140  * A set of values describing the possible byte-orders
141  * for storing pixel values in memory.
142  */
143 typedef enum
144 {
145   GDK_LSB_FIRST,
146   GDK_MSB_FIRST
147 } GdkByteOrder;
148
149 /* Types of modifiers.
150  */
151 /**
152  * GdkModifierType:
153  * @GDK_SHIFT_MASK: the Shift key.
154  * @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
155  *  X server this may either be CapsLock or ShiftLock).
156  * @GDK_CONTROL_MASK: the Control key.
157  * @GDK_MOD1_MASK: the fourth modifier key (it depends on the modifier
158  *  mapping of the X server which key is interpreted as this modifier, but
159  *  normally it is the Alt key).
160  * @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
161  *  mapping of the X server which key is interpreted as this modifier).
162  * @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
163  *  mapping of the X server which key is interpreted as this modifier).
164  * @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
165  *  mapping of the X server which key is interpreted as this modifier).
166  * @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
167  *  mapping of the X server which key is interpreted as this modifier).
168  * @GDK_BUTTON1_MASK: the first mouse button.
169  * @GDK_BUTTON2_MASK: the second mouse button.
170  * @GDK_BUTTON3_MASK: the third mouse button.
171  * @GDK_BUTTON4_MASK: the fourth mouse button.
172  * @GDK_BUTTON5_MASK: the fifth mouse button.
173  * @GDK_MODIFIER_RESERVED_13_MASK: A reserved bit flag; do not use in your own code
174  * @GDK_SUPER_MASK: the Super modifier. Since 2.10
175  * @GDK_HYPER_MASK: the Hyper modifier. Since 2.10
176  * @GDK_META_MASK: the Meta modifier. Since 2.10
177  * @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
178  *  between (keyval, modifiers) pairs from key press and release events.
179  * @GDK_MODIFIER_MASK: a mask covering all modifier types.
180  *
181  * A set of bit-flags to indicate the state of modifier keys and mouse buttons
182  * in various event types. Typical modifier keys are Shift, Control, Meta,
183  * Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
184  *
185  * Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
186  *
187  * Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
188  * to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
189  * %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
190  *
191  * Note that GDK may add internal values to events which include
192  * reserved values such as %GDK_MODIFIER_RESERVED_13_MASK.  Your code
193  * should preserve and ignore them.  You can use %GDK_MODIFIER_MASK to
194  * remove all reserved values.
195  */
196 typedef enum
197 {
198   GDK_SHIFT_MASK    = 1 << 0,
199   GDK_LOCK_MASK     = 1 << 1,
200   GDK_CONTROL_MASK  = 1 << 2,
201   GDK_MOD1_MASK     = 1 << 3,
202   GDK_MOD2_MASK     = 1 << 4,
203   GDK_MOD3_MASK     = 1 << 5,
204   GDK_MOD4_MASK     = 1 << 6,
205   GDK_MOD5_MASK     = 1 << 7,
206   GDK_BUTTON1_MASK  = 1 << 8,
207   GDK_BUTTON2_MASK  = 1 << 9,
208   GDK_BUTTON3_MASK  = 1 << 10,
209   GDK_BUTTON4_MASK  = 1 << 11,
210   GDK_BUTTON5_MASK  = 1 << 12,
211
212   GDK_MODIFIER_RESERVED_13_MASK  = 1 << 13,
213   GDK_MODIFIER_RESERVED_14_MASK  = 1 << 14,
214   GDK_MODIFIER_RESERVED_15_MASK  = 1 << 15,
215   GDK_MODIFIER_RESERVED_16_MASK  = 1 << 16,
216   GDK_MODIFIER_RESERVED_17_MASK  = 1 << 17,
217   GDK_MODIFIER_RESERVED_18_MASK  = 1 << 18,
218   GDK_MODIFIER_RESERVED_19_MASK  = 1 << 19,
219   GDK_MODIFIER_RESERVED_20_MASK  = 1 << 20,
220   GDK_MODIFIER_RESERVED_21_MASK  = 1 << 21,
221   GDK_MODIFIER_RESERVED_22_MASK  = 1 << 22,
222   GDK_MODIFIER_RESERVED_23_MASK  = 1 << 23,
223   GDK_MODIFIER_RESERVED_24_MASK  = 1 << 24,
224   GDK_MODIFIER_RESERVED_25_MASK  = 1 << 25,
225
226   /* The next few modifiers are used by XKB, so we skip to the end.
227    * Bits 15 - 25 are currently unused. Bit 29 is used internally.
228    */
229   
230   GDK_SUPER_MASK    = 1 << 26,
231   GDK_HYPER_MASK    = 1 << 27,
232   GDK_META_MASK     = 1 << 28,
233   
234   GDK_MODIFIER_RESERVED_29_MASK  = 1 << 29,
235
236   GDK_RELEASE_MASK  = 1 << 30,
237
238   /* Combination of GDK_SHIFT_MASK..GDK_BUTTON5_MASK + GDK_SUPER_MASK
239      + GDK_HYPER_MASK + GDK_META_MASK + GDK_RELEASE_MASK */
240   GDK_MODIFIER_MASK = 0x5c001fff
241 } GdkModifierType;
242
243 /**
244  * GdkModifierIntent:
245  * @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
246  *  menu accelerators.
247  * @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
248  *  Note that mouse button 3 always triggers context menus. When this modifier
249  *  is not 0, it <strong>additionally</strong> triggers context menus when used
250  *  with mouse button 1.
251  * @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
252  *  using &lt;modifier&gt;-click or &lt;modifier&gt;-cursor-key
253  * @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
254  *  which in most cases means toggling the clicked item into or out of the selection.
255  * @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
256  *  key event cannot produce a symbol directly. This is meant to be used for
257  *  input methods, and for use cases like typeahead search.
258  * @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
259  *  groups (AltGr on X11/Windows and Option/Alt on OS X).
260  *
261  * This enum is used with gdk_keymap_get_modifier_mask() and
262  * gdk_get_modifier_mask() in order to determine what modifiers the
263  * currently used windowing system backend uses for particular
264  * purposes. For example, on X11/Windows, the Control key is used for
265  * invoking menu shortcuts (accelerators), whereas on Apple computers
266  * it's the Command key (which correspond to %GDK_CONTROL_MASK and
267  * %GDK_MOD2_MASK, respectively).
268  *
269  * Since: 3.4
270  **/
271 typedef enum
272 {
273   GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
274   GDK_MODIFIER_INTENT_CONTEXT_MENU,
275   GDK_MODIFIER_INTENT_EXTEND_SELECTION,
276   GDK_MODIFIER_INTENT_MODIFY_SELECTION,
277   GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
278   GDK_MODIFIER_INTENT_SHIFT_GROUP
279 } GdkModifierIntent;
280
281 typedef enum
282 {
283   GDK_OK          = 0,
284   GDK_ERROR       = -1,
285   GDK_ERROR_PARAM = -2,
286   GDK_ERROR_FILE  = -3,
287   GDK_ERROR_MEM   = -4
288 } GdkStatus;
289
290 /**
291  * GdkGrabStatus:
292  * @GDK_GRAB_SUCCESS: the resource was successfully grabbed.
293  * @GDK_GRAB_ALREADY_GRABBED: the resource is actively grabbed by another client.
294  * @GDK_GRAB_INVALID_TIME: the resource was grabbed more recently than the
295  *  specified time.
296  * @GDK_GRAB_NOT_VIEWABLE: the grab window or the @confine_to window are not
297  *  viewable.
298  * @GDK_GRAB_FROZEN: the resource is frozen by an active grab of another client.
299  *
300  * Returned by gdk_pointer_grab() and gdk_keyboard_grab() to indicate
301  * success or the reason for the failure of the grab attempt.
302  */
303 typedef enum
304 {
305   GDK_GRAB_SUCCESS         = 0,
306   GDK_GRAB_ALREADY_GRABBED = 1,
307   GDK_GRAB_INVALID_TIME    = 2,
308   GDK_GRAB_NOT_VIEWABLE    = 3,
309   GDK_GRAB_FROZEN          = 4
310 } GdkGrabStatus;
311
312 /**
313  * GdkGrabOwnership:
314  * @GDK_OWNERSHIP_NONE: All other devices' events are allowed.
315  * @GDK_OWNERSHIP_WINDOW: Other devices' events are blocked for the grab window.
316  * @GDK_OWNERSHIP_APPLICATION: Other devices' events are blocked for the whole application.
317  *
318  * Defines how device grabs interact with other devices.
319  */
320 typedef enum
321 {
322   GDK_OWNERSHIP_NONE,
323   GDK_OWNERSHIP_WINDOW,
324   GDK_OWNERSHIP_APPLICATION
325 } GdkGrabOwnership;
326
327 /**
328  * GdkEventMask:
329  * @GDK_EXPOSURE_MASK: receive expose events
330  * @GDK_POINTER_MOTION_MASK: receive all pointer motion events
331  * @GDK_POINTER_MOTION_HINT_MASK: see the explanation above
332  * @GDK_BUTTON_MOTION_MASK: receive pointer motion events while any button is pressed
333  * @GDK_BUTTON1_MOTION_MASK: receive pointer motion events while 1 button is pressed
334  * @GDK_BUTTON2_MOTION_MASK: receive pointer motion events while 2 button is pressed
335  * @GDK_BUTTON3_MOTION_MASK: receive pointer motion events while 3 button is pressed
336  * @GDK_BUTTON_PRESS_MASK: receive button press events
337  * @GDK_BUTTON_RELEASE_MASK: receive button release events
338  * @GDK_KEY_PRESS_MASK: receive key press events
339  * @GDK_KEY_RELEASE_MASK: receive key release events
340  * @GDK_ENTER_NOTIFY_MASK: receive window enter events
341  * @GDK_LEAVE_NOTIFY_MASK: receive window leave events
342  * @GDK_FOCUS_CHANGE_MASK: receive focus change events
343  * @GDK_STRUCTURE_MASK: receive events about window configuration change
344  * @GDK_PROPERTY_CHANGE_MASK: receive property change events
345  * @GDK_VISIBILITY_NOTIFY_MASK: receive visibility change events
346  * @GDK_PROXIMITY_IN_MASK: receive proximity in events
347  * @GDK_PROXIMITY_OUT_MASK: receive proximity out events
348  * @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
349  *   child windows
350  * @GDK_SCROLL_MASK: receive scroll events
351  * @GDK_TOUCH_MASK: receive touch events. Since 3.4
352  * @GDK_SMOOTH_SCROLL_MASK: receive smooth scrolling events. Since 3.4
353  * @GDK_ALL_EVENTS_MASK: the combination of all the above event masks.
354  *
355  * A set of bit-flags to indicate which events a window is to receive.
356  * Most of these masks map onto one or more of the #GdkEventType event types
357  * above.
358  *
359  * %GDK_POINTER_MOTION_HINT_MASK is a special mask which is used to reduce the
360  * number of %GDK_MOTION_NOTIFY events received. Normally a %GDK_MOTION_NOTIFY
361  * event is received each time the mouse moves. However, if the application
362  * spends a lot of time processing the event (updating the display, for example),
363  * it can lag behind the position of the mouse. When using
364  * %GDK_POINTER_MOTION_HINT_MASK, fewer %GDK_MOTION_NOTIFY events will be sent,
365  * some of which are marked as a hint (the is_hint member is %TRUE).
366  * To receive more motion events after a motion hint event, the application
367  * needs to asks for more, by calling gdk_event_request_motions().
368  *
369  * If %GDK_TOUCH_MASK is enabled, the window will receive touch events
370  * from touch-enabled devices. Those will come as sequences of #GdkEventTouch
371  * with type %GDK_TOUCH_UPDATE, enclosed by two events with
372  * type %GDK_TOUCH_BEGIN and %GDK_TOUCH_END (or %GDK_TOUCH_CANCEL).
373  * gdk_event_get_event_sequence() returns the event sequence for these
374  * events, so different sequences may be distinguished.
375  */
376 typedef enum
377 {
378   GDK_EXPOSURE_MASK             = 1 << 1,
379   GDK_POINTER_MOTION_MASK       = 1 << 2,
380   GDK_POINTER_MOTION_HINT_MASK  = 1 << 3,
381   GDK_BUTTON_MOTION_MASK        = 1 << 4,
382   GDK_BUTTON1_MOTION_MASK       = 1 << 5,
383   GDK_BUTTON2_MOTION_MASK       = 1 << 6,
384   GDK_BUTTON3_MOTION_MASK       = 1 << 7,
385   GDK_BUTTON_PRESS_MASK         = 1 << 8,
386   GDK_BUTTON_RELEASE_MASK       = 1 << 9,
387   GDK_KEY_PRESS_MASK            = 1 << 10,
388   GDK_KEY_RELEASE_MASK          = 1 << 11,
389   GDK_ENTER_NOTIFY_MASK         = 1 << 12,
390   GDK_LEAVE_NOTIFY_MASK         = 1 << 13,
391   GDK_FOCUS_CHANGE_MASK         = 1 << 14,
392   GDK_STRUCTURE_MASK            = 1 << 15,
393   GDK_PROPERTY_CHANGE_MASK      = 1 << 16,
394   GDK_VISIBILITY_NOTIFY_MASK    = 1 << 17,
395   GDK_PROXIMITY_IN_MASK         = 1 << 18,
396   GDK_PROXIMITY_OUT_MASK        = 1 << 19,
397   GDK_SUBSTRUCTURE_MASK         = 1 << 20,
398   GDK_SCROLL_MASK               = 1 << 21,
399   GDK_TOUCH_MASK                = 1 << 22,
400   GDK_SMOOTH_SCROLL_MASK        = 1 << 23,
401   GDK_ALL_EVENTS_MASK           = 0xFFFFFE
402 } GdkEventMask;
403
404 /**
405  * GdkPoint:
406  * @x: the x coordinate of the point.
407  * @y: the y coordinate of the point.
408  *
409  * Defines the x and y coordinates of a point.
410  */
411 struct _GdkPoint
412 {
413   gint x;
414   gint y;
415 };
416
417
418 G_END_DECLS
419
420
421 #endif /* __GDK_TYPES_H__ */