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