]> Pileus Git - ~andy/gtk/blob - gdk/gdkwindow.h
Update.
[~andy/gtk] / gdk / gdkwindow.h
1 #ifndef __GDK_WINDOW_H__
2 #define __GDK_WINDOW_H__
3
4 #include <gdk/gdkdrawable.h>
5 #include <gdk/gdktypes.h>
6 #include <gdk/gdkwindow.h>
7 #include <gdk/gdkevents.h>
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif /* __cplusplus */
12
13 typedef struct _GdkGeometry           GdkGeometry;
14 typedef struct _GdkWindowAttr         GdkWindowAttr;
15
16 /* Classes of windows.
17  *   InputOutput: Almost every window should be of this type. Such windows
18  *                receive events and are also displayed on screen.
19  *   InputOnly: Used only in special circumstances when events need to be
20  *              stolen from another window or windows. Input only windows
21  *              have no visible output, so they are handy for placing over
22  *              top of a group of windows in order to grab the events (or
23  *              filter the events) from those windows.
24  */
25 typedef enum
26 {
27   GDK_INPUT_OUTPUT,
28   GDK_INPUT_ONLY
29 } GdkWindowClass;
30
31 /* Types of windows.
32  *   Root: There is only 1 root window and it is initialized
33  *         at startup. Creating a window of type GDK_WINDOW_ROOT
34  *         is an error.
35  *   Toplevel: Windows which interact with the window manager.
36  *   Child: Windows which are children of some other type of window.
37  *          (Any other type of window). Most windows are child windows.
38  *   Dialog: A special kind of toplevel window which interacts with
39  *           the window manager slightly differently than a regular
40  *           toplevel window. Dialog windows should be used for any
41  *           transient window.
42  *   Foreign: A window that actually belongs to another application
43  */
44 typedef enum
45 {
46   GDK_WINDOW_ROOT,
47   GDK_WINDOW_TOPLEVEL,
48   GDK_WINDOW_CHILD,
49   GDK_WINDOW_DIALOG,
50   GDK_WINDOW_TEMP,
51   GDK_WINDOW_FOREIGN
52 } GdkWindowType;
53
54 /* Window attribute mask values.
55  *   GDK_WA_TITLE: The "title" field is valid.
56  *   GDK_WA_X: The "x" field is valid.
57  *   GDK_WA_Y: The "y" field is valid.
58  *   GDK_WA_CURSOR: The "cursor" field is valid.
59  *   GDK_WA_COLORMAP: The "colormap" field is valid.
60  *   GDK_WA_VISUAL: The "visual" field is valid.
61  */
62 typedef enum
63 {
64   GDK_WA_TITLE    = 1 << 1,
65   GDK_WA_X        = 1 << 2,
66   GDK_WA_Y        = 1 << 3,
67   GDK_WA_CURSOR   = 1 << 4,
68   GDK_WA_COLORMAP = 1 << 5,
69   GDK_WA_VISUAL   = 1 << 6,
70   GDK_WA_WMCLASS  = 1 << 7,
71   GDK_WA_NOREDIR  = 1 << 8
72 } GdkWindowAttributesType;
73
74 /* Size restriction enumeration.
75  */
76 typedef enum
77 {
78   GDK_HINT_POS         = 1 << 0,
79   GDK_HINT_MIN_SIZE    = 1 << 1,
80   GDK_HINT_MAX_SIZE    = 1 << 2,
81   GDK_HINT_BASE_SIZE   = 1 << 3,
82   GDK_HINT_ASPECT      = 1 << 4,
83   GDK_HINT_RESIZE_INC  = 1 << 5,
84   GDK_HINT_WIN_GRAVITY = 1 << 6
85 } GdkWindowHints;
86
87 /* The next two enumeration values current match the
88  * Motif constants. If this is changed, the implementation
89  * of gdk_window_set_decorations/gdk_window_set_functions
90  * will need to change as well.
91  */
92 typedef enum
93 {
94   GDK_DECOR_ALL         = 1 << 0,
95   GDK_DECOR_BORDER      = 1 << 1,
96   GDK_DECOR_RESIZEH     = 1 << 2,
97   GDK_DECOR_TITLE       = 1 << 3,
98   GDK_DECOR_MENU        = 1 << 4,
99   GDK_DECOR_MINIMIZE    = 1 << 5,
100   GDK_DECOR_MAXIMIZE    = 1 << 6
101 } GdkWMDecoration;
102
103 typedef enum
104 {
105   GDK_FUNC_ALL          = 1 << 0,
106   GDK_FUNC_RESIZE       = 1 << 1,
107   GDK_FUNC_MOVE         = 1 << 2,
108   GDK_FUNC_MINIMIZE     = 1 << 3,
109   GDK_FUNC_MAXIMIZE     = 1 << 4,
110   GDK_FUNC_CLOSE        = 1 << 5
111 } GdkWMFunction;
112
113 /* Currently, these are the same values numerically as in the
114  * X protocol. If you change that, gdkwindow-x11.c/gdk_window_set_geometry_hints()
115  * will need fixing.
116  */
117 typedef enum
118 {
119   GDK_GRAVITY_NORTH_WEST = 1,
120   GDK_GRAVITY_NORTH,
121   GDK_GRAVITY_NORTH_EAST,
122   GDK_GRAVITY_WEST,
123   GDK_GRAVITY_CENTER,
124   GDK_GRAVITY_EAST,
125   GDK_GRAVITY_SOUTH_WEST,
126   GDK_GRAVITY_SOUTH,
127   GDK_GRAVITY_SOUTH_EAST,
128   GDK_GRAVITY_STATIC
129 } GdkGravity;
130
131 struct _GdkWindowAttr
132 {
133   gchar *title;
134   gint event_mask;
135   gint x, y;
136   gint width;
137   gint height;
138   GdkWindowClass wclass;
139   GdkVisual *visual;
140   GdkColormap *colormap;
141   GdkWindowType window_type;
142   GdkCursor *cursor;
143   gchar *wmclass_name;
144   gchar *wmclass_class;
145   gboolean override_redirect;
146 };
147
148 struct _GdkGeometry {
149   gint min_width;
150   gint min_height;
151   gint max_width;
152   gint max_height;
153   gint base_width;
154   gint base_height;
155   gint width_inc;
156   gint height_inc;
157   gdouble min_aspect;
158   gdouble max_aspect;
159   GdkGravity win_gravity;
160 };
161
162 typedef struct _GdkWindowObject GdkWindowObject;
163 typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
164
165 #define GDK_TYPE_WINDOW              (gdk_window_object_get_type ())
166 #define GDK_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
167 #define GDK_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
168 #define GDK_IS_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
169 #define GDK_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
170 #define GDK_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
171 #define GDK_WINDOW_OBJECT(object)    ((GdkWindowObject *) GDK_WINDOW (object))
172
173 struct _GdkWindowObject
174 {
175   GdkDrawable parent_instance;
176
177   GdkDrawable *impl; /* window-system-specific delegate object */  
178   
179   GdkWindowObject *parent;
180
181   gpointer user_data;
182
183   gint x;
184   gint y;
185   
186   gint extension_events;
187
188   GList *filters;
189   GList *children;
190
191   GdkColor bg_color;
192   GdkPixmap *bg_pixmap;
193   
194   GSList *paint_stack;
195   
196   GdkRegion *update_area;
197   guint update_freeze_count;
198   
199   guint8 window_type;
200   guint8 depth;
201   guint8 resize_count;
202   guint mapped : 1;
203   guint guffaw_gravity : 1;
204   guint input_only : 1;
205   
206   guint destroyed : 2;
207 };
208
209 struct _GdkWindowObjectClass
210 {
211   GdkDrawableClass parent_class;
212
213
214 };
215
216 /* Windows
217  */
218 GType         gdk_window_object_get_type       (void) G_GNUC_CONST;
219 GdkWindow*    gdk_window_new                   (GdkWindow     *parent,
220                                                 GdkWindowAttr *attributes,
221                                                 gint           attributes_mask);
222 void          gdk_window_destroy               (GdkWindow     *window);
223 GdkWindowType gdk_window_get_window_type       (GdkWindow     *window);
224 GdkWindow*    gdk_window_at_pointer            (gint          *win_x,
225                                                 gint          *win_y);
226 void          gdk_window_show                  (GdkWindow     *window);
227 void          gdk_window_hide                  (GdkWindow     *window);
228 void          gdk_window_withdraw              (GdkWindow     *window);
229 void          gdk_window_move                  (GdkWindow     *window,
230                                                 gint           x,
231                                                 gint           y);
232 void          gdk_window_resize                (GdkWindow     *window,
233                                                 gint           width,
234                                                 gint           height);
235 void          gdk_window_move_resize           (GdkWindow     *window,
236                                                 gint           x,
237                                                 gint           y,
238                                                 gint           width,
239                                                 gint           height);
240 void          gdk_window_reparent              (GdkWindow     *window,
241                                                 GdkWindow     *new_parent,
242                                                 gint           x,
243                                                 gint           y);
244 void          gdk_window_clear                 (GdkWindow     *window);
245 void          gdk_window_clear_area            (GdkWindow     *window,
246                                                 gint           x,
247                                                 gint           y,
248                                                 gint           width,
249                                                 gint           height);
250 void          gdk_window_clear_area_e          (GdkWindow     *window,
251                                                 gint           x,
252                                                 gint           y,
253                                                 gint           width,
254                                                 gint           height);
255 void          gdk_window_raise                 (GdkWindow     *window);
256 void          gdk_window_lower                 (GdkWindow     *window);
257 void          gdk_window_set_user_data         (GdkWindow     *window,
258                                                 gpointer       user_data);
259 void          gdk_window_set_override_redirect (GdkWindow     *window,
260                                                 gboolean       override_redirect);
261 void          gdk_window_add_filter            (GdkWindow     *window,
262                                                 GdkFilterFunc  function,
263                                                 gpointer       data);
264 void          gdk_window_remove_filter         (GdkWindow     *window,
265                                                 GdkFilterFunc  function,
266                                                 gpointer       data);
267 void          gdk_window_scroll                (GdkWindow *window,
268                                                 gint       dx,
269                                                 gint       dy);
270
271 /* 
272  * This allows for making shaped (partially transparent) windows
273  * - cool feature, needed for Drag and Drag for example.
274  *  The shape_mask can be the mask
275  *  from gdk_pixmap_create_from_xpm.   Stefan Wille
276  */
277 void gdk_window_shape_combine_mask (GdkWindow       *window,
278                                     GdkBitmap       *shape_mask,
279                                     gint             offset_x,
280                                     gint             offset_y);
281 /*
282  * This routine allows you to quickly take the shapes of all the child windows
283  * of a window and use their shapes as the shape mask for this window - useful
284  * for container windows that dont want to look like a big box
285  * 
286  * - Raster
287  */
288 void gdk_window_set_child_shapes (GdkWindow *window);
289
290 /*
291  * This routine allows you to merge (ie ADD) child shapes to your
292  * own window's shape keeping its current shape and ADDING the child
293  * shapes to it.
294  * 
295  * - Raster
296  */
297 void gdk_window_merge_child_shapes (GdkWindow *window);
298
299 /*
300  * Check if a window has been shown, and whether all its
301  * parents up to a toplevel have been shown, respectively.
302  * Note that a window that is_viewable below is not necessarily
303  * viewable in the X sense.
304  */
305 gboolean gdk_window_is_visible     (GdkWindow *window);
306 gboolean gdk_window_is_viewable    (GdkWindow *window);
307
308 /* Set static bit gravity on the parent, and static
309  * window gravity on all children.
310  */
311 gboolean gdk_window_set_static_gravities (GdkWindow *window,
312                                           gboolean   use_static);   
313
314 /* GdkWindow */
315
316 void          gdk_window_set_hints       (GdkWindow       *window,
317                                           gint             x,
318                                           gint             y,
319                                           gint             min_width,
320                                           gint             min_height,
321                                           gint             max_width,
322                                           gint             max_height,
323                                           gint             flags);
324 void          gdk_window_set_geometry_hints (GdkWindow        *window,
325                                              GdkGeometry      *geometry,
326                                              GdkWindowHints    flags);
327 void          gdk_set_sm_client_id         (const gchar *sm_client_id);
328
329 void          gdk_window_begin_paint_rect   (GdkWindow    *window,
330                                              GdkRectangle *rectangle);
331 void          gdk_window_begin_paint_region (GdkWindow    *window,
332                                              GdkRegion    *region);
333 void          gdk_window_end_paint          (GdkWindow    *window);
334
335 void          gdk_window_set_title         (GdkWindow     *window,
336                                             const gchar   *title);
337 void          gdk_window_set_role          (GdkWindow       *window,
338                                             const gchar     *role);
339 void          gdk_window_set_transient_for (GdkWindow       *window, 
340                                             GdkWindow       *leader);
341 void          gdk_window_set_background  (GdkWindow       *window,
342                                           GdkColor        *color);
343 void          gdk_window_set_back_pixmap (GdkWindow       *window,
344                                           GdkPixmap       *pixmap,
345                                           gboolean         parent_relative);
346 void          gdk_window_set_cursor      (GdkWindow       *window,
347                                           GdkCursor       *cursor);
348 void          gdk_window_get_user_data   (GdkWindow       *window,
349                                           gpointer        *data);
350 void          gdk_window_get_geometry    (GdkWindow       *window,
351                                           gint            *x,
352                                           gint            *y,
353                                           gint            *width,
354                                           gint            *height,
355                                           gint            *depth);
356 void          gdk_window_get_position    (GdkWindow       *window,
357                                           gint            *x,
358                                           gint            *y);
359 gint          gdk_window_get_origin      (GdkWindow       *window,
360                                           gint            *x,
361                                           gint            *y);
362 gboolean      gdk_window_get_deskrelative_origin (GdkWindow       *window,
363                                           gint            *x,
364                                           gint            *y);
365 void          gdk_window_get_root_origin (GdkWindow       *window,
366                                           gint            *x,
367                                           gint            *y);
368 GdkWindow*    gdk_window_get_pointer     (GdkWindow       *window,
369                                           gint            *x,
370                                           gint            *y,
371                                           GdkModifierType *mask);
372 GdkWindow *   gdk_window_get_parent      (GdkWindow       *window);
373 GdkWindow *   gdk_window_get_toplevel    (GdkWindow       *window);
374
375 GList *       gdk_window_get_children    (GdkWindow       *window);
376 GList *       gdk_window_peek_children   (GdkWindow       *window);
377 GdkEventMask  gdk_window_get_events      (GdkWindow       *window);
378 void          gdk_window_set_events      (GdkWindow       *window,
379                                           GdkEventMask     event_mask);
380
381 void          gdk_window_set_icon        (GdkWindow       *window, 
382                                           GdkWindow       *icon_window,
383                                           GdkPixmap       *pixmap,
384                                           GdkBitmap       *mask);
385 void          gdk_window_set_icon_name   (GdkWindow       *window, 
386                                           const gchar     *name);
387 void          gdk_window_set_group       (GdkWindow       *window, 
388                                           GdkWindow       *leader);
389 void          gdk_window_set_decorations (GdkWindow       *window,
390                                           GdkWMDecoration  decorations);
391 void          gdk_window_set_functions   (GdkWindow       *window,
392                                           GdkWMFunction    functions);
393 GList *       gdk_window_get_toplevels   (void);
394 void          gdk_window_iconify         (GdkWindow       *window);
395
396 void          gdk_window_register_dnd    (GdkWindow       *window);
397
398 /* Interface for dirty-region queueing */
399 void       gdk_window_invalidate_rect     (GdkWindow    *window,
400                                            GdkRectangle *rect,
401                                            gboolean      invalidate_children);
402 void       gdk_window_invalidate_region   (GdkWindow    *window,
403                                            GdkRegion    *region,
404                                            gboolean      invalidate_children);
405 GdkRegion *gdk_window_get_update_area     (GdkWindow    *window);
406
407 void       gdk_window_freeze_updates      (GdkWindow    *window);
408 void       gdk_window_thaw_updates        (GdkWindow    *window);
409
410 void       gdk_window_process_all_updates (void);
411 void       gdk_window_process_updates     (GdkWindow    *window,
412                                            gboolean      update_children);
413
414
415
416 #ifdef __cplusplus
417 }
418 #endif /* __cplusplus */
419
420 #endif /* __GDK_WINDOW_H__ */