]> Pileus Git - ~andy/gtk/blob - gdk/gdk.h
Change signatures for gdk_drag_begin() and gdk_drag_motion() so that the
[~andy/gtk] / gdk / gdk.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_H__
20 #define __GDK_H__
21
22
23 #include <gdk/gdktypes.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29
30 /* Initialization, exit and events
31  */
32 #define   GDK_PRIORITY_EVENTS           (G_PRIORITY_DEFAULT)
33 void      gdk_init                      (gint           *argc,
34                                          gchar        ***argv);
35 void      gdk_exit                      (gint            error_code);
36 gchar*    gdk_set_locale                (void);
37
38 gboolean  gdk_events_pending            (void);
39 GdkEvent* gdk_event_get                 (void);
40
41 GdkEvent* gdk_event_peek                (void);
42 GdkEvent* gdk_event_get_graphics_expose (GdkWindow      *window);
43 void      gdk_event_put                 (GdkEvent       *event);
44
45 GdkEvent* gdk_event_copy                (GdkEvent       *event);
46 void      gdk_event_free                (GdkEvent       *event);
47 guint32   gdk_event_get_time            (GdkEvent       *event);
48
49 void      gdk_event_handler_set         (GdkEventFunc    func,
50                                          gpointer        data,
51                                          GDestroyNotify  notify);
52
53 void      gdk_set_show_events           (gint            show_events);
54 void      gdk_set_use_xshm              (gint            use_xshm);
55
56 gint      gdk_get_show_events           (void);
57 gint      gdk_get_use_xshm              (void);
58 gchar*    gdk_get_display               (void);
59
60 guint32 gdk_time_get      (void);
61 guint32 gdk_timer_get     (void);
62 void    gdk_timer_set     (guint32 milliseconds);
63 void    gdk_timer_enable  (void);
64 void    gdk_timer_disable (void);
65
66 gint gdk_input_add_full   (gint              source,
67                            GdkInputCondition condition,
68                            GdkInputFunction  function,
69                            gpointer          data,
70                            GdkDestroyNotify  destroy);
71 gint gdk_input_add        (gint              source,
72                            GdkInputCondition condition,
73                            GdkInputFunction  function,
74                            gpointer          data);
75 void gdk_input_remove     (gint              tag);
76
77 gint gdk_pointer_grab   (GdkWindow *     window,
78                          gint            owner_events,
79                          GdkEventMask    event_mask,
80                          GdkWindow *     confine_to,
81                          GdkCursor *     cursor,
82                          guint32         time);
83 void gdk_pointer_ungrab (guint32         time);
84
85 gint gdk_keyboard_grab   (GdkWindow *     window,
86                           gint            owner_events,
87                           guint32         time);
88 void gdk_keyboard_ungrab (guint32         time);
89
90 gint gdk_pointer_is_grabbed (void);
91
92 gint gdk_screen_width  (void);
93 gint gdk_screen_height (void);
94
95 gint gdk_screen_width_mm  (void);
96 gint gdk_screen_height_mm (void);
97
98 void gdk_flush (void);
99 void gdk_beep (void);
100
101 void gdk_key_repeat_disable (void);
102 void gdk_key_repeat_restore (void);
103
104
105 /* Visuals
106  */
107 gint          gdk_visual_get_best_depth      (void);
108 GdkVisualType gdk_visual_get_best_type       (void);
109 GdkVisual*    gdk_visual_get_system          (void);
110 GdkVisual*    gdk_visual_get_best            (void);
111 GdkVisual*    gdk_visual_get_best_with_depth (gint           depth);
112 GdkVisual*    gdk_visual_get_best_with_type  (GdkVisualType  visual_type);
113 GdkVisual*    gdk_visual_get_best_with_both  (gint           depth,
114                                               GdkVisualType  visual_type);
115
116 /* Actually, these are no-ops... */
117 GdkVisual* gdk_visual_ref (GdkVisual *visual);
118 void       gdk_visual_unref (GdkVisual *visual);
119
120 void gdk_query_depths       (gint           **depths,
121                              gint            *count);
122 void gdk_query_visual_types (GdkVisualType  **visual_types,
123                              gint            *count);
124
125 GList* gdk_list_visuals (void);
126
127
128 /* Windows
129  */
130 GdkWindow*    gdk_window_new         (GdkWindow     *parent,
131                                       GdkWindowAttr *attributes,
132                                       gint           attributes_mask);
133
134 void          gdk_window_destroy     (GdkWindow     *window);
135 GdkWindow*    gdk_window_ref         (GdkWindow     *window);
136 void          gdk_window_unref       (GdkWindow     *window);
137
138 GdkWindow*    gdk_window_at_pointer  (gint         *win_x,
139                                       gint         *win_y);
140 void          gdk_window_show        (GdkWindow    *window);
141 void          gdk_window_hide        (GdkWindow    *window);
142 void          gdk_window_withdraw    (GdkWindow    *window);
143 void          gdk_window_move        (GdkWindow    *window,
144                                       gint          x,
145                                       gint          y);
146 void          gdk_window_resize      (GdkWindow    *window,
147                                       gint          width,
148                                       gint          height);
149 void          gdk_window_move_resize (GdkWindow    *window,
150                                       gint          x,
151                                       gint          y,
152                                       gint          width,
153                                       gint          height);
154 void          gdk_window_reparent    (GdkWindow    *window,
155                                       GdkWindow    *new_parent,
156                                       gint          x,
157                                       gint          y);
158 void          gdk_window_clear       (GdkWindow    *window);
159 void          gdk_window_clear_area  (GdkWindow    *window,
160                                       gint          x,
161                                       gint          y,
162                                       gint          width,
163                                       gint          height);
164 void          gdk_window_clear_area_e(GdkWindow    *window,
165                                       gint          x,
166                                       gint          y,
167                                       gint          width,
168                                       gint          height);
169 void          gdk_window_copy_area   (GdkWindow    *window,
170                                       GdkGC        *gc,
171                                       gint          x,
172                                       gint          y,
173                                       GdkWindow    *source_window,
174                                       gint          source_x,
175                                       gint          source_y,
176                                       gint          width,
177                                       gint          height);
178 void          gdk_window_raise       (GdkWindow    *window);
179 void          gdk_window_lower       (GdkWindow    *window);
180
181 void          gdk_window_set_user_data   (GdkWindow       *window,
182                                           gpointer         user_data);
183 void          gdk_window_set_override_redirect(GdkWindow  *window,
184                                                gboolean override_redirect);
185
186 void          gdk_window_add_filter     (GdkWindow     *window,
187                                          GdkFilterFunc  function,
188                                          gpointer       data);
189 void          gdk_window_remove_filter  (GdkWindow     *window,
190                                          GdkFilterFunc  function,
191                                          gpointer       data);
192
193 /* 
194  * This allows for making shaped (partially transparent) windows
195  * - cool feature, needed for Drag and Drag for example.
196  *  The shape_mask can be the mask
197  *  from gdk_pixmap_create_from_xpm.   Stefan Wille
198  */
199 void gdk_window_shape_combine_mask (GdkWindow       *window,
200                                     GdkBitmap       *shape_mask,
201                                     gint             offset_x,
202                                     gint             offset_y);
203 /*
204  * This routine allows you to quickly take the shapes of all the child windows
205  * of a window and use their shapes as the shape mask for this window - useful
206  * for container windows that dont want to look like a big box
207  * 
208  * - Raster
209  */
210 void gdk_window_set_child_shapes (GdkWindow *window);
211
212 /*
213  * This routine allows you to merge (ie ADD) child shapes to your
214  * own window's shape keeping its current shape and ADDING the shild
215  * shapes to it.
216  * 
217  * - Raster
218  */
219 void gdk_window_merge_child_shapes (GdkWindow *window);
220
221 /*
222  * Check if a window has been shown, and whether all it's
223  * parents up to a toplevel have been shown, respectively.
224  * Note that a window that is_viewable below is not necessarily
225  * viewable in the X sense.
226  */
227 gboolean gdk_window_is_visible     (GdkWindow *window);
228 gboolean gdk_window_is_viewable    (GdkWindow *window);
229
230 /* Set static bit gravity on the parent, and static
231  * window gravity on all children.
232  */
233 gboolean gdk_window_set_static_gravities (GdkWindow *window,
234                                           gboolean   use_static);   
235 /*
236  * The following function adds a global filter for all client
237  * messages of type message_type
238  */
239 void gdk_add_client_message_filter (GdkAtom       message_type,
240                                     GdkFilterFunc func,
241                                     gpointer      data);
242
243 /* Drag and Drop */
244
245 GdkDragContext * gdk_drag_context_new        (void);
246 void             gdk_drag_context_ref        (GdkDragContext *context);
247 void             gdk_drag_context_unref      (GdkDragContext *context);
248
249 /* Destination side */
250
251 void             gdk_drag_status        (GdkDragContext   *context,
252                                          GdkDragAction     action,
253                                          guint32           time);
254 void             gdk_drop_reply         (GdkDragContext   *context,
255                                          gboolean          ok,
256                                          guint32           time);
257 void             gdk_drop_finish        (GdkDragContext   *context,
258                                          gboolean          success,
259                                          guint32           time);
260 GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
261
262 /* Source side */
263
264 GdkDragContext * gdk_drag_begin      (GdkWindow      *window,
265                                       GList          *targets);
266 guint32         gdk_drag_get_protocol (guint32          xid,
267                                        GdkDragProtocol *protocol);
268 void             gdk_drag_find_window (GdkDragContext   *context,
269                                        GdkWindow       *drag_window,
270                                        gint             x_root,
271                                        gint             y_root,
272                                        GdkWindow      **dest_window,
273                                        GdkDragProtocol *protocol);
274 gboolean        gdk_drag_motion      (GdkDragContext *context,
275                                       GdkWindow      *dest_window,
276                                       GdkDragProtocol protocol,
277                                       gint            x_root, 
278                                       gint            y_root,
279                                       GdkDragAction   suggested_action,
280                                       GdkDragAction   possible_actions,
281                                       guint32         time);
282 void            gdk_drag_drop        (GdkDragContext *context,
283                                       guint32         time);
284 void            gdk_drag_abort       (GdkDragContext *context,
285                                       guint32         time);
286
287 GdkAtom       gdk_drag_get_selection (GdkDragContext *context);
288
289 /* GdkWindow */
290
291 void          gdk_window_set_hints       (GdkWindow       *window,
292                                           gint             x,
293                                           gint             y,
294                                           gint             min_width,
295                                           gint             min_height,
296                                           gint             max_width,
297                                           gint             max_height,
298                                           gint             flags);
299 void          gdk_window_set_geometry_hints (GdkWindow        *window,
300                                              GdkGeometry      *geometry,
301                                              GdkWindowHints    flags);
302 void          gdk_set_sm_client_id         (const gchar *sm_client_id);
303
304
305 void          gdk_window_set_title         (GdkWindow     *window,
306                                             const gchar   *title);
307 void          gdk_window_set_role          (GdkWindow       *window,
308                                             const gchar     *role);
309 void          gdk_window_set_transient_for (GdkWindow       *window, 
310                                             GdkWindow       *leader);
311 void          gdk_window_set_background  (GdkWindow       *window,
312                                           GdkColor        *color);
313 void          gdk_window_set_back_pixmap (GdkWindow       *window,
314                                           GdkPixmap       *pixmap,
315                                           gint             parent_relative);
316 void          gdk_window_set_cursor      (GdkWindow       *window,
317                                           GdkCursor       *cursor);
318 void          gdk_window_set_colormap    (GdkWindow       *window,
319                                           GdkColormap     *colormap);
320 void          gdk_window_get_user_data   (GdkWindow       *window,
321                                           gpointer        *data);
322 void          gdk_window_get_geometry    (GdkWindow       *window,
323                                           gint            *x,
324                                           gint            *y,
325                                           gint            *width,
326                                           gint            *height,
327                                           gint            *depth);
328 void          gdk_window_get_position    (GdkWindow       *window,
329                                           gint            *x,
330                                           gint            *y);
331 void          gdk_window_get_size        (GdkWindow       *window,
332                                           gint            *width,
333                                           gint            *height);
334 GdkVisual*    gdk_window_get_visual      (GdkWindow       *window);
335 GdkColormap*  gdk_window_get_colormap    (GdkWindow       *window);
336 GdkWindowType gdk_window_get_type        (GdkWindow       *window);
337 gint          gdk_window_get_origin      (GdkWindow       *window,
338                                           gint            *x,
339                                           gint            *y);
340 gboolean      gdk_window_get_deskrelative_origin (GdkWindow       *window,
341                                           gint            *x,
342                                           gint            *y);
343 void          gdk_window_get_root_origin (GdkWindow       *window,
344                                           gint            *x,
345                                           gint            *y);
346 GdkWindow*    gdk_window_get_pointer     (GdkWindow       *window,
347                                           gint            *x,
348                                           gint            *y,
349                                           GdkModifierType *mask);
350 GdkWindow*    gdk_window_get_parent      (GdkWindow       *window);
351 GdkWindow*    gdk_window_get_toplevel    (GdkWindow       *window);
352 GList*        gdk_window_get_children    (GdkWindow       *window);
353 GdkEventMask  gdk_window_get_events      (GdkWindow       *window);
354 void          gdk_window_set_events      (GdkWindow       *window,
355                                           GdkEventMask     event_mask);
356
357 void          gdk_window_set_icon        (GdkWindow       *window, 
358                                           GdkWindow       *icon_window,
359                                           GdkPixmap       *pixmap,
360                                           GdkBitmap       *mask);
361 void          gdk_window_set_icon_name   (GdkWindow       *window, 
362                                           gchar           *name);
363 void          gdk_window_set_group       (GdkWindow       *window, 
364                                           GdkWindow       *leader);
365 void          gdk_window_set_decorations (GdkWindow       *window,
366                                           GdkWMDecoration  decorations);
367 void          gdk_window_set_functions   (GdkWindow       *window,
368                                           GdkWMFunction    functions);
369 GList *       gdk_window_get_toplevels   (void);
370
371 void          gdk_window_register_dnd    (GdkWindow       *window);
372
373 void          gdk_drawable_set_data      (GdkDrawable     *drawable,
374                                           const gchar     *key,
375                                           gpointer         data,
376                                           GDestroyNotify   destroy_func);
377                                           
378
379 /* Cursors
380  */
381 GdkCursor* gdk_cursor_new                (GdkCursorType   cursor_type);
382 GdkCursor* gdk_cursor_new_from_pixmap    (GdkPixmap       *source,
383                                           GdkPixmap       *mask,
384                                           GdkColor        *fg,
385                                           GdkColor        *bg,
386                                           gint             x,
387                                           gint             y);
388 void       gdk_cursor_destroy            (GdkCursor      *cursor);
389
390
391 /* GCs
392  */
393 GdkGC* gdk_gc_new                 (GdkWindow        *window);
394 GdkGC* gdk_gc_new_with_values     (GdkWindow        *window,
395                                    GdkGCValues      *values,
396                                    GdkGCValuesMask   values_mask);
397 GdkGC* gdk_gc_ref                 (GdkGC            *gc);
398 void   gdk_gc_unref               (GdkGC            *gc);
399 void   gdk_gc_destroy             (GdkGC            *gc);
400 void   gdk_gc_get_values          (GdkGC            *gc,
401                                    GdkGCValues      *values);
402 void   gdk_gc_set_foreground      (GdkGC            *gc,
403                                    GdkColor         *color);
404 void   gdk_gc_set_background      (GdkGC            *gc,
405                                    GdkColor         *color);
406 void   gdk_gc_set_font            (GdkGC            *gc,
407                                    GdkFont          *font);
408 void   gdk_gc_set_function        (GdkGC            *gc,
409                                    GdkFunction       function);
410 void   gdk_gc_set_fill            (GdkGC            *gc,
411                                    GdkFill           fill);
412 void   gdk_gc_set_tile            (GdkGC            *gc,
413                                    GdkPixmap        *tile);
414 void   gdk_gc_set_stipple         (GdkGC            *gc,
415                                    GdkPixmap        *stipple);
416 void   gdk_gc_set_ts_origin       (GdkGC            *gc,
417                                    gint              x,
418                                    gint              y);
419 void   gdk_gc_set_clip_origin     (GdkGC            *gc,
420                                    gint              x,
421                                    gint              y);
422 void   gdk_gc_set_clip_mask       (GdkGC            *gc,
423                                    GdkBitmap        *mask);
424 void   gdk_gc_set_clip_rectangle  (GdkGC            *gc,
425                                    GdkRectangle     *rectangle);
426 void   gdk_gc_set_clip_region     (GdkGC            *gc,
427                                    GdkRegion        *region);
428 void   gdk_gc_set_subwindow       (GdkGC            *gc,
429                                    GdkSubwindowMode  mode);
430 void   gdk_gc_set_exposures       (GdkGC            *gc,
431                                    gint              exposures);
432 void   gdk_gc_set_line_attributes (GdkGC            *gc,
433                                    gint              line_width,
434                                    GdkLineStyle      line_style,
435                                    GdkCapStyle       cap_style,
436                                    GdkJoinStyle      join_style);
437 void   gdk_gc_set_dashes          (GdkGC            *gc,
438                                    gint              dash_offset,
439                                    gchar             dash_list[],
440                                    gint              n);
441 void   gdk_gc_copy                (GdkGC             *dst_gc,
442                                    GdkGC             *src_gc);
443
444
445 /* Pixmaps
446  */
447 GdkPixmap* gdk_pixmap_new               (GdkWindow  *window,
448                                          gint        width,
449                                          gint        height,
450                                          gint        depth);
451 GdkBitmap* gdk_bitmap_create_from_data  (GdkWindow   *window,
452                                          const gchar *data,
453                                          gint         width,
454                                          gint         height);
455 GdkPixmap* gdk_pixmap_create_from_data  (GdkWindow   *window,
456                                          const gchar *data,
457                                          gint         width,
458                                          gint         height,
459                                          gint         depth,
460                                          GdkColor    *fg,
461                                          GdkColor    *bg);
462 GdkPixmap* gdk_pixmap_create_from_xpm   (GdkWindow  *window,
463                                          GdkBitmap **mask,
464                                          GdkColor   *transparent_color,
465                                          const gchar *filename);
466 GdkPixmap* gdk_pixmap_colormap_create_from_xpm 
467                                         (GdkWindow   *window,
468                                          GdkColormap *colormap,
469                                          GdkBitmap  **mask,
470                                          GdkColor    *transparent_color,
471                                          const gchar *filename);
472 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow  *window,
473                                          GdkBitmap **mask,
474                                          GdkColor   *transparent_color,
475                                          gchar     **data);
476 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d 
477                                         (GdkWindow   *window,
478                                          GdkColormap *colormap,
479                                          GdkBitmap  **mask,
480                                          GdkColor    *transparent_color,
481                                          gchar     **data);
482 GdkPixmap *gdk_pixmap_ref               (GdkPixmap  *pixmap);
483 void       gdk_pixmap_unref             (GdkPixmap  *pixmap);
484
485 GdkBitmap *gdk_bitmap_ref               (GdkBitmap  *pixmap);
486 void       gdk_bitmap_unref             (GdkBitmap  *pixmap);
487
488
489 /* Images
490  */
491 GdkImage* gdk_image_new_bitmap(GdkVisual     *visual,
492                                 gpointer      data,
493                                 gint          width,
494                                 gint          height);
495 GdkImage*  gdk_image_new       (GdkImageType  type,
496                                 GdkVisual    *visual,
497                                 gint          width,
498                                 gint          height);
499 GdkImage*  gdk_image_get       (GdkWindow    *window,
500                                 gint          x,
501                                 gint          y,
502                                 gint          width,
503                                 gint          height);
504 void       gdk_image_put_pixel (GdkImage     *image,
505                                 gint          x,
506                                 gint          y,
507                                 guint32       pixel);
508 guint32    gdk_image_get_pixel (GdkImage     *image,
509                                 gint          x,
510                                 gint          y);
511 void       gdk_image_destroy   (GdkImage     *image);
512
513
514 /* Color
515  */
516 GdkColormap* gdk_colormap_new     (GdkVisual   *visual,
517                                    gint         allocate);
518 GdkColormap* gdk_colormap_ref     (GdkColormap *cmap);
519 void         gdk_colormap_unref   (GdkColormap *cmap);
520
521 GdkColormap* gdk_colormap_get_system       (void);
522 gint         gdk_colormap_get_system_size  (void);
523
524 void gdk_colormap_change (GdkColormap   *colormap,
525                           gint           ncolors);
526
527
528 gint  gdk_colormap_alloc_colors   (GdkColormap *colormap,
529                                    GdkColor    *colors,
530                                    gint         ncolors,
531                                    gboolean     writeable,
532                                    gboolean     best_match,
533                                    gboolean    *success);
534 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
535                                    GdkColor    *color,
536                                    gboolean     writeable,
537                                    gboolean     best_match);
538 void     gdk_colormap_free_colors (GdkColormap *colormap,
539                                    GdkColor    *colors,
540                                    gint         ncolors);
541
542 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
543      
544 GdkColor *gdk_color_copy (GdkColor *color);
545 void      gdk_color_free (GdkColor *color);
546
547 gint gdk_color_parse     (const gchar   *spec,
548                           GdkColor      *color);
549 guint gdk_color_hash     (const GdkColor *colora,
550                           const GdkColor *colorb);
551 gint gdk_color_equal     (const GdkColor *colora,
552                           const GdkColor *colorb);
553
554
555 /* The following functions are deprecated */
556 void gdk_colors_store    (GdkColormap   *colormap,
557                           GdkColor      *colors,
558                           gint           ncolors);
559 gint gdk_colors_alloc    (GdkColormap   *colormap,
560                           gint           contiguous,
561                           gulong        *planes,
562                           gint           nplanes,
563                           gulong        *pixels,
564                           gint           npixels);
565 void gdk_colors_free     (GdkColormap   *colormap,
566                           gulong        *pixels,
567                           gint           npixels,
568                           gulong         planes);
569 gint gdk_color_white     (GdkColormap   *colormap,
570                           GdkColor      *color);
571 gint gdk_color_black     (GdkColormap   *colormap,
572                           GdkColor      *color);
573 gint gdk_color_alloc     (GdkColormap   *colormap,
574                           GdkColor      *color);
575 gint gdk_color_change    (GdkColormap   *colormap,
576                           GdkColor      *color);
577
578
579 /* Fonts
580  */
581 GdkFont* gdk_font_load      (const gchar    *font_name);
582 GdkFont* gdk_fontset_load   (gchar          *fontset_name);
583 GdkFont* gdk_font_ref       (GdkFont        *font);
584 void     gdk_font_unref     (GdkFont        *font);
585 gint     gdk_font_id        (const GdkFont  *font);
586 gint     gdk_font_equal     (const GdkFont  *fonta,
587                              const GdkFont  *fontb);
588 gint     gdk_string_width   (GdkFont        *font,
589                              const gchar    *string);
590 gint     gdk_text_width     (GdkFont        *font,
591                              const gchar    *text,
592                              gint            text_length);
593 gint     gdk_text_width_wc  (GdkFont        *font,
594                              const GdkWChar *text,
595                              gint            text_length);
596 gint     gdk_char_width     (GdkFont        *font,
597                              gchar           character);
598 gint     gdk_char_width_wc  (GdkFont        *font,
599                              GdkWChar        character);
600 gint     gdk_string_measure (GdkFont        *font,
601                              const gchar    *string);
602 gint     gdk_text_measure   (GdkFont        *font,
603                              const gchar    *text,
604                              gint            text_length);
605 gint     gdk_char_measure   (GdkFont        *font,
606                              gchar           character);
607 gint     gdk_string_height  (GdkFont        *font,
608                              const gchar    *string);
609 gint     gdk_text_height    (GdkFont        *font,
610                              const gchar    *text,
611                              gint            text_length);
612 gint     gdk_char_height    (GdkFont        *font,
613                              gchar           character);
614
615 void     gdk_text_extents   (GdkFont     *font,
616                              const gchar *text,
617                              gint         text_length,
618                              gint        *lbearing,
619                              gint        *rbearing,
620                              gint        *width,
621                              gint        *ascent,
622                              gint        *descent);
623 void    gdk_text_extents_wc (GdkFont        *font,
624                              const GdkWChar *text,
625                              gint            text_length,
626                              gint           *lbearing,
627                              gint           *rbearing,
628                              gint           *width,
629                              gint           *ascent,
630                              gint           *descent);
631 void     gdk_string_extents (GdkFont     *font,
632                              const gchar *string,
633                              gint        *lbearing,
634                              gint        *rbearing,
635                              gint        *width,
636                              gint        *ascent,
637                              gint        *descent);
638
639 /* Drawing
640  */
641 void gdk_draw_point      (GdkDrawable  *drawable,
642                           GdkGC        *gc,
643                           gint          x,
644                           gint          y);
645 void gdk_draw_line       (GdkDrawable  *drawable,
646                           GdkGC        *gc,
647                           gint          x1,
648                           gint          y1,
649                           gint          x2,
650                           gint          y2);
651 void gdk_draw_rectangle  (GdkDrawable  *drawable,
652                           GdkGC        *gc,
653                           gint          filled,
654                           gint          x,
655                           gint          y,
656                           gint          width,
657                           gint          height);
658 void gdk_draw_arc        (GdkDrawable  *drawable,
659                           GdkGC        *gc,
660                           gint          filled,
661                           gint          x,
662                           gint          y,
663                           gint          width,
664                           gint          height,
665                           gint          angle1,
666                           gint          angle2);
667 void gdk_draw_polygon    (GdkDrawable  *drawable,
668                           GdkGC        *gc,
669                           gint          filled,
670                           GdkPoint     *points,
671                           gint          npoints);
672 void gdk_draw_string     (GdkDrawable  *drawable,
673                           GdkFont      *font,
674                           GdkGC        *gc,
675                           gint          x,
676                           gint          y,
677                           const gchar  *string);
678 void gdk_draw_text       (GdkDrawable  *drawable,
679                           GdkFont      *font,
680                           GdkGC        *gc,
681                           gint          x,
682                           gint          y,
683                           const gchar  *text,
684                           gint          text_length);
685 void gdk_draw_text_wc    (GdkDrawable    *drawable,
686                           GdkFont        *font,
687                           GdkGC          *gc,
688                           gint            x,
689                           gint            y,
690                           const GdkWChar *text,
691                           gint            text_length);
692 void gdk_draw_pixmap     (GdkDrawable  *drawable,
693                           GdkGC        *gc,
694                           GdkDrawable  *src,
695                           gint          xsrc,
696                           gint          ysrc,
697                           gint          xdest,
698                           gint          ydest,
699                           gint          width,
700                           gint          height);
701 void gdk_draw_bitmap     (GdkDrawable  *drawable,
702                           GdkGC        *gc,
703                           GdkDrawable  *src,
704                           gint          xsrc,
705                           gint          ysrc,
706                           gint          xdest,
707                           gint          ydest,
708                           gint          width,
709                           gint          height);
710 void gdk_draw_image      (GdkDrawable  *drawable,
711                           GdkGC        *gc,
712                           GdkImage     *image,
713                           gint          xsrc,
714                           gint          ysrc,
715                           gint          xdest,
716                           gint          ydest,
717                           gint          width,
718                           gint          height);
719 void gdk_draw_points     (GdkDrawable  *drawable,
720                           GdkGC        *gc,
721                           GdkPoint     *points,
722                           gint          npoints);
723 void gdk_draw_segments   (GdkDrawable  *drawable,
724                           GdkGC        *gc,
725                           GdkSegment   *segs,
726                           gint          nsegs);
727 void gdk_draw_lines      (GdkDrawable  *drawable,
728                           GdkGC        *gc,
729                           GdkPoint     *points,
730                           gint          npoints);
731  
732
733
734
735 /* Selections
736  */
737 gint       gdk_selection_owner_set (GdkWindow    *owner,
738                                     GdkAtom       selection,
739                                     guint32       time,
740                                     gint          send_event);
741 GdkWindow* gdk_selection_owner_get (GdkAtom       selection);
742 void       gdk_selection_convert   (GdkWindow    *requestor,
743                                     GdkAtom       selection,
744                                     GdkAtom       target,
745                                     guint32       time);
746 gint       gdk_selection_property_get (GdkWindow  *requestor,
747                                        guchar    **data,
748                                        GdkAtom    *prop_type,
749                                        gint       *prop_format);
750 void       gdk_selection_send_notify (guint32       requestor,
751                                       GdkAtom       selection,
752                                       GdkAtom       target,
753                                       GdkAtom       property,
754                                       guint32       time);
755
756 gint       gdk_text_property_to_text_list (GdkAtom encoding, gint format,
757                                            guchar *text, gint length,
758                                            gchar ***list);
759 void       gdk_free_text_list             (gchar **list);
760 gint       gdk_string_to_compound_text    (gchar *str,
761                                            GdkAtom *encoding, gint *format,
762                                            guchar **ctext, gint *length);
763 void       gdk_free_compound_text         (guchar *ctext);
764
765 /* Properties
766  */
767 GdkAtom gdk_atom_intern     (const gchar *atom_name,
768                              gint         only_if_exists);
769 gchar*  gdk_atom_name       (GdkAtom atom);
770 gint    gdk_property_get    (GdkWindow   *window,
771                              GdkAtom      property,
772                              GdkAtom      type,
773                              gulong       offset,
774                              gulong       length,
775                              gint         pdelete,
776                              GdkAtom     *actual_property_type,
777                              gint        *actual_format,
778                              gint        *actual_length,
779                              guchar     **data);
780
781 void    gdk_property_change (GdkWindow   *window,
782                              GdkAtom      property,
783                              GdkAtom      type,
784                              gint         format,
785                              GdkPropMode  mode,
786                              guchar      *data,
787                              gint         nelements);
788 void    gdk_property_delete (GdkWindow   *window,
789                              GdkAtom      property);
790
791
792 /* Rectangle utilities
793  */
794 gint gdk_rectangle_intersect (GdkRectangle *src1,
795                               GdkRectangle *src2,
796                               GdkRectangle *dest);
797 void gdk_rectangle_union     (GdkRectangle *src1,
798                               GdkRectangle *src2,
799                               GdkRectangle *dest);
800
801 /* XInput support
802  */
803
804 void gdk_input_init                         (void);
805 void gdk_input_exit                         (void);
806 GList *gdk_input_list_devices               (void);
807 void gdk_input_set_extension_events         (GdkWindow *window,
808                                              gint mask,
809                                              GdkExtensionMode mode);
810 void gdk_input_set_source                   (guint32 deviceid,
811                                              GdkInputSource source);
812 gint gdk_input_set_mode                     (guint32 deviceid,
813                                              GdkInputMode mode);
814 void gdk_input_set_axes                     (guint32 deviceid,
815                                              GdkAxisUse *axes);
816 void gdk_input_set_key                      (guint32 deviceid,
817                                              guint   index,
818                                              guint   keyval,
819                                              GdkModifierType modifiers);
820 void gdk_input_window_get_pointer     (GdkWindow       *window,
821                                        guint32         deviceid,
822                                        gdouble         *x,
823                                        gdouble         *y,
824                                        gdouble         *pressure,
825                                        gdouble         *xtilt,
826                                        gdouble         *ytilt,
827                                        GdkModifierType *mask);
828
829 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
830                                        guint32 deviceid,
831                                        guint32 start,
832                                        guint32 stop,
833                                        gint *nevents_return);
834
835 /* International Input Method Support Functions
836  */
837
838 gint         gdk_im_ready          (void);
839
840 void         gdk_im_begin          (GdkIC               *ic, 
841                                     GdkWindow           *window);
842 void         gdk_im_end            (void);
843 GdkIMStyle   gdk_im_decide_style   (GdkIMStyle           supported_style);
844 GdkIMStyle   gdk_im_set_best_style (GdkIMStyle           best_allowed_style);
845
846 GdkIC*       gdk_ic_new            (GdkICAttr           *attr,
847                                     GdkICAttributesType mask);
848 void         gdk_ic_destroy        (GdkIC               *ic);
849 GdkIMStyle   gdk_ic_get_style      (GdkIC               *ic);
850 GdkEventMask gdk_ic_get_events     (GdkIC               *ic);
851
852 GdkICAttr*   gdk_ic_attr_new       (void);
853 void         gdk_ic_attr_destroy   (GdkICAttr *attr);
854
855 GdkICAttributesType  gdk_ic_set_attr (GdkIC              *ic,  
856                                       GdkICAttr          *attr,
857                                       GdkICAttributesType mask);
858 GdkICAttributesType  gdk_ic_get_attr (GdkIC              *ic, 
859                                       GdkICAttr          *attr,
860                                       GdkICAttributesType mask);
861
862 /* Conversion functions between wide char and multibyte strings. 
863  */
864 gchar     *gdk_wcstombs          (const GdkWChar   *src);
865 gint       gdk_mbstowcs          (GdkWChar         *dest,
866                                   const gchar      *src,
867                                   gint              dest_max);
868
869
870 /* Color Context */
871
872 GdkColorContext *gdk_color_context_new                    (GdkVisual   *visual,
873                                                            GdkColormap *colormap);
874
875 GdkColorContext *gdk_color_context_new_mono               (GdkVisual   *visual,
876                                                            GdkColormap *colormap);
877
878 void             gdk_color_context_free                   (GdkColorContext *cc);
879
880 gulong           gdk_color_context_get_pixel              (GdkColorContext *cc,
881                                                            gushort          red,
882                                                            gushort          green,
883                                                            gushort          blue,
884                                                            gint            *failed);
885 void             gdk_color_context_get_pixels             (GdkColorContext *cc,
886                                                            gushort         *reds,
887                                                            gushort         *greens,
888                                                            gushort         *blues,
889                                                            gint             ncolors,
890                                                            gulong          *colors,
891                                                            gint            *nallocated);
892 void             gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
893                                                            gushort         *reds,
894                                                            gushort         *greens,
895                                                            gushort         *blues,
896                                                            gint             ncolors,
897                                                            gint            *used,
898                                                            gulong          *colors,
899                                                            gint            *nallocated);
900
901 gint             gdk_color_context_query_color            (GdkColorContext *cc,
902                                                            GdkColor        *color);
903 gint             gdk_color_context_query_colors           (GdkColorContext *cc,
904                                                            GdkColor        *colors,
905                                                            gint             num_colors);
906
907 gint             gdk_color_context_add_palette            (GdkColorContext *cc,
908                                                            GdkColor        *palette,
909                                                            gint             num_palette);
910
911 void             gdk_color_context_init_dither            (GdkColorContext *cc);
912 void             gdk_color_context_free_dither            (GdkColorContext *cc);
913
914 gulong           gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
915                                                            gushort         *red,
916                                                            gushort         *green,
917                                                            gushort         *blue,
918                                                            gint            *failed);
919 guchar           gdk_color_context_get_index_from_palette (GdkColorContext *cc,
920                                                            gint            *red,
921                                                            gint            *green,
922                                                            gint            *blue,
923                                                            gint            *failed);
924 /* Regions
925  */
926
927 GdkRegion*     gdk_region_new       (void);
928 void           gdk_region_destroy   (GdkRegion     *region);
929
930 void           gdk_region_get_clipbox(GdkRegion    *region,
931                                       GdkRectangle *rectangle);
932
933 gboolean       gdk_region_empty     (GdkRegion     *region);
934 gboolean       gdk_region_equal     (GdkRegion     *region1,
935                                      GdkRegion     *region2);
936 gboolean       gdk_region_point_in  (GdkRegion     *region,
937                                      int                   x,
938                                      int                   y);
939 GdkOverlapType gdk_region_rect_in   (GdkRegion     *region,
940                                      GdkRectangle  *rect);
941
942 GdkRegion*     gdk_region_polygon   (GdkPoint      *points,
943                                      gint           npoints,
944                                      GdkFillRule    fill_rule);
945
946 void           gdk_region_offset   (GdkRegion      *region,
947                                     gint           dx,
948                                     gint           dy);
949 void           gdk_region_shrink   (GdkRegion      *region,
950                                     gint           dx,
951                                     gint           dy);
952
953 GdkRegion*    gdk_region_union_with_rect  (GdkRegion      *region,
954                                            GdkRectangle   *rect);
955 GdkRegion*    gdk_regions_intersect       (GdkRegion      *source1,
956                                            GdkRegion      *source2);
957 GdkRegion*    gdk_regions_union           (GdkRegion      *source1,
958                                            GdkRegion      *source2);
959 GdkRegion*    gdk_regions_subtract        (GdkRegion      *source1,
960                                            GdkRegion      *source2);
961 GdkRegion*    gdk_regions_xor             (GdkRegion      *source1,
962                                            GdkRegion      *source2);
963
964 /* Miscellaneous */
965 void     gdk_event_send_clientmessage_toall (GdkEvent    *event);
966 gboolean gdk_event_send_client_message (GdkEvent    *event,
967                                         guint32      xid);
968
969 /* Key values
970  */
971 gchar*   gdk_keyval_name                  (guint        keyval);
972 guint    gdk_keyval_from_name             (const gchar *keyval_name);
973 guint    gdk_keyval_to_upper              (guint        keyval);
974 guint    gdk_keyval_to_lower              (guint        keyval);
975 gboolean gdk_keyval_is_upper              (guint        keyval);
976 gboolean gdk_keyval_is_lower              (guint        keyval);
977
978 /* Threading
979  */
980
981 extern GMutex *gdk_threads_mutex;
982
983 void     gdk_threads_enter                (void);
984 void     gdk_threads_leave                (void);
985
986 #ifdef  G_THREADS_ENABLED
987 #  define GDK_THREADS_ENTER()   G_STMT_START {  \
988       if (gdk_threads_mutex)                    \
989         g_mutex_lock (gdk_threads_mutex);       \
990    } G_STMT_END
991 #  define GDK_THREADS_LEAVE()   G_STMT_START {  \
992       if (gdk_threads_mutex)                    \
993         g_mutex_unlock (gdk_threads_mutex);     \
994    } G_STMT_END
995 #else   /* !G_THREADS_ENABLED */
996 #  define GDK_THREADS_ENTER()
997 #  define GDK_THREADS_LEAVE()
998 #endif  /* !G_THREADS_ENABLED */
999
1000 #include <gdk/gdkrgb.h>
1001
1002 #ifdef __cplusplus
1003 }
1004 #endif /* __cplusplus */
1005
1006
1007 #endif /* __GDK_H__ */