1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
23 #include <gdk/gdktypes.h>
28 #endif /* __cplusplus */
31 /* Initialization, exit and events
33 void gdk_init (int *argc,
35 void gdk_exit (int error_code);
36 gchar* gdk_set_locale (void);
38 gint gdk_events_pending (void);
39 GdkEvent *gdk_event_get (void);
40 GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
41 void gdk_event_put (GdkEvent *event);
43 GdkEvent *gdk_event_copy (GdkEvent *event);
44 void gdk_event_free (GdkEvent *event);
46 void gdk_set_show_events (gint show_events);
47 void gdk_set_use_xshm (gint use_xshm);
49 gint gdk_get_show_events (void);
50 gint gdk_get_use_xshm (void);
51 gchar *gdk_get_display (void);
53 guint32 gdk_time_get (void);
54 guint32 gdk_timer_get (void);
55 void gdk_timer_set (guint32 milliseconds);
56 void gdk_timer_enable (void);
57 void gdk_timer_disable (void);
59 gint gdk_input_add_full (gint source,
60 GdkInputCondition condition,
61 GdkInputFunction function,
63 GdkDestroyNotify destroy);
64 #define gdk_input_add_interp gdk_input_add_full
65 gint gdk_input_add (gint source,
66 GdkInputCondition condition,
67 GdkInputFunction function,
69 void gdk_input_remove (gint tag);
71 gint gdk_pointer_grab (GdkWindow * window,
73 GdkEventMask event_mask,
74 GdkWindow * confine_to,
77 void gdk_pointer_ungrab (guint32 time);
79 gint gdk_keyboard_grab (GdkWindow * window,
82 void gdk_keyboard_ungrab (guint32 time);
84 gint gdk_pointer_is_grabbed (void);
86 gint gdk_screen_width (void);
87 gint gdk_screen_height (void);
89 void gdk_flush (void);
92 void gdk_key_repeat_disable (void);
93 void gdk_key_repeat_restore (void);
98 gint gdk_visual_get_best_depth (void);
99 GdkVisualType gdk_visual_get_best_type (void);
100 GdkVisual* gdk_visual_get_system (void);
101 GdkVisual* gdk_visual_get_best (void);
102 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
103 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
104 GdkVisual* gdk_visual_get_best_with_both (gint depth,
105 GdkVisualType visual_type);
107 /* Actually, these are no-ops... */
108 GdkVisual* gdk_visual_ref (GdkVisual *visual);
109 void gdk_visual_unref (GdkVisual *visual);
111 void gdk_query_depths (gint **depths,
113 void gdk_query_visual_types (GdkVisualType **visual_types,
116 GList* gdk_list_visuals (void);
121 GdkWindow* gdk_window_new (GdkWindow *parent,
122 GdkWindowAttr *attributes,
123 gint attributes_mask);
125 GdkWindow * gdk_window_foreign_new (guint32 anid);
126 void gdk_window_destroy (GdkWindow *window);
127 GdkWindow* gdk_window_ref (GdkWindow *window);
128 void gdk_window_unref (GdkWindow *window);
130 void gdk_window_show (GdkWindow *window);
131 void gdk_window_hide (GdkWindow *window);
132 void gdk_window_withdraw (GdkWindow *window);
133 void gdk_window_move (GdkWindow *window,
136 void gdk_window_resize (GdkWindow *window,
139 void gdk_window_move_resize (GdkWindow *window,
144 void gdk_window_reparent (GdkWindow *window,
145 GdkWindow *new_parent,
148 void gdk_window_clear (GdkWindow *window);
149 void gdk_window_clear_area (GdkWindow *window,
154 void gdk_window_clear_area_e(GdkWindow *window,
159 void gdk_window_copy_area (GdkWindow *window,
163 GdkWindow *source_window,
168 void gdk_window_raise (GdkWindow *window);
169 void gdk_window_lower (GdkWindow *window);
171 void gdk_window_set_user_data (GdkWindow *window,
173 void gdk_window_set_override_redirect(GdkWindow *window,
174 gboolean override_redirect);
176 void gdk_window_add_filter (GdkWindow *window,
177 GdkFilterFunc function,
179 void gdk_window_remove_filter (GdkWindow *window,
180 GdkFilterFunc function,
184 * This allows for making shaped (partially transparent) windows
185 * - cool feature, needed for Drag and Drag for example.
186 * The shape_mask can be the mask
187 * from gdk_pixmap_create_from_xpm. Stefan Wille
189 void gdk_window_shape_combine_mask (GdkWindow *window,
190 GdkBitmap *shape_mask,
196 * Algorithm (drop source):
197 * A window being dragged will be sent a GDK_DRAG_BEGIN message.
198 * It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
200 * When we get a DROP_ENTER incoming, we send it on to the window in question.
201 * That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
202 * things (it must call that even if it's not going to accept the drop)
204 * These two turn on/off drag or drop, and if enabling it also
205 * sets the list of types supported. The list of types passed in
206 * should be in order of decreasing preference.
208 void gdk_window_dnd_drag_set (GdkWindow *window,
214 *XXX todo: add a GDK_DROP_ENTER which can look at actual data
216 void gdk_window_dnd_drop_set (GdkWindow *window,
220 guint8 destructive_op);
223 * This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
224 * file manager where multiple icons were selected and the drag began.
225 * The icon that the drag actually began on would gdk_dnd_drag_addwindow
226 * for all the other icons that were being dragged...
228 void gdk_dnd_drag_addwindow (GdkWindow *window);
229 void gdk_window_dnd_data_set (GdkWindow *window,
232 gulong data_numbytes);
233 void gdk_dnd_set_drag_cursors(GdkCursor *default_cursor,
234 GdkCursor *goahead_cursor);
235 void gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
236 GdkPoint *default_hotspot,
237 GdkWindow *goahead_pixmapwin,
238 GdkPoint *goahead_hotspot);
240 void gdk_window_set_hints (GdkWindow *window,
248 void gdk_window_set_title (GdkWindow *window,
250 void gdk_window_set_background (GdkWindow *window,
252 void gdk_window_set_back_pixmap (GdkWindow *window,
254 gint parent_relative);
255 void gdk_window_set_cursor (GdkWindow *window,
257 void gdk_window_set_colormap (GdkWindow *window,
258 GdkColormap *colormap);
259 void gdk_window_get_user_data (GdkWindow *window,
261 void gdk_window_get_geometry (GdkWindow *window,
267 void gdk_window_get_position (GdkWindow *window,
270 void gdk_window_get_size (GdkWindow *window,
273 GdkVisual* gdk_window_get_visual (GdkWindow *window);
274 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
275 GdkWindowType gdk_window_get_type (GdkWindow *window);
276 gint gdk_window_get_origin (GdkWindow *window,
279 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
282 GdkModifierType *mask);
283 GdkWindow* gdk_window_get_parent (GdkWindow *window);
284 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
285 GList* gdk_window_get_children (GdkWindow *window);
286 GdkEventMask gdk_window_get_events (GdkWindow *window);
287 void gdk_window_set_events (GdkWindow *window,
288 GdkEventMask event_mask);
290 void gdk_window_set_icon (GdkWindow *window,
291 GdkWindow *icon_window,
294 void gdk_window_set_icon_name (GdkWindow *window,
296 void gdk_window_set_group (GdkWindow *window,
298 void gdk_window_set_decorations (GdkWindow *window,
299 GdkWMDecoration decorations);
300 void gdk_window_set_functions (GdkWindow *window,
301 GdkWMFunction functions);
305 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
306 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
312 void gdk_cursor_destroy (GdkCursor *cursor);
317 GdkGC* gdk_gc_new (GdkWindow *window);
318 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
320 GdkGCValuesMask values_mask);
321 GdkGC* gdk_gc_ref (GdkGC *gc);
322 void gdk_gc_unref (GdkGC *gc);
323 void gdk_gc_destroy (GdkGC *gc);
324 void gdk_gc_get_values (GdkGC *gc,
325 GdkGCValues *values);
326 void gdk_gc_set_foreground (GdkGC *gc,
328 void gdk_gc_set_background (GdkGC *gc,
330 void gdk_gc_set_font (GdkGC *gc,
332 void gdk_gc_set_function (GdkGC *gc,
333 GdkFunction function);
334 void gdk_gc_set_fill (GdkGC *gc,
336 void gdk_gc_set_tile (GdkGC *gc,
338 void gdk_gc_set_stipple (GdkGC *gc,
340 void gdk_gc_set_ts_origin (GdkGC *gc,
343 void gdk_gc_set_clip_origin (GdkGC *gc,
346 void gdk_gc_set_clip_mask (GdkGC *gc,
348 void gdk_gc_set_clip_rectangle (GdkGC *gc,
349 GdkRectangle *rectangle);
350 void gdk_gc_set_clip_region (GdkGC *gc,
352 void gdk_gc_set_subwindow (GdkGC *gc,
353 GdkSubwindowMode mode);
354 void gdk_gc_set_exposures (GdkGC *gc,
356 void gdk_gc_set_line_attributes (GdkGC *gc,
358 GdkLineStyle line_style,
359 GdkCapStyle cap_style,
360 GdkJoinStyle join_style);
361 void gdk_gc_copy (GdkGC *dst_gc,
367 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
371 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
375 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
382 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
384 GdkColor *transparent_color,
385 const gchar *filename);
386 GdkPixmap* gdk_pixmap_colormap_create_from_xpm
388 GdkColormap *colormap,
390 GdkColor *transparent_color,
391 const gchar *filename);
392 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
394 GdkColor *transparent_color,
396 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
398 GdkColormap *colormap,
400 GdkColor *transparent_color,
402 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
403 void gdk_pixmap_unref (GdkPixmap *pixmap);
405 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
406 void gdk_bitmap_unref (GdkBitmap *pixmap);
411 GdkImage* gdk_image_new_bitmap(GdkVisual *,
415 GdkImage* gdk_image_new (GdkImageType type,
419 GdkImage* gdk_image_get (GdkWindow *window,
424 void gdk_image_put_pixel (GdkImage *image,
428 guint32 gdk_image_get_pixel (GdkImage *image,
431 void gdk_image_destroy (GdkImage *image);
436 GdkColormap* gdk_colormap_new (GdkVisual *visual,
438 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
439 void gdk_colormap_unref (GdkColormap *cmap);
441 GdkColormap* gdk_colormap_get_system (void);
442 gint gdk_colormap_get_system_size (void);
444 void gdk_colormap_change (GdkColormap *colormap,
446 void gdk_colors_store (GdkColormap *colormap,
449 gint gdk_colors_alloc (GdkColormap *colormap,
455 void gdk_colors_free (GdkColormap *colormap,
459 gint gdk_color_white (GdkColormap *colormap,
461 gint gdk_color_black (GdkColormap *colormap,
463 gint gdk_color_parse (const gchar *spec,
465 gint gdk_color_alloc (GdkColormap *colormap,
467 gint gdk_color_change (GdkColormap *colormap,
469 gint gdk_color_equal (GdkColor *colora,
475 GdkFont* gdk_font_load (const gchar *font_name);
476 GdkFont* gdk_fontset_load (gchar *fontset_name);
477 GdkFont* gdk_font_ref (GdkFont *font);
478 void gdk_font_unref (GdkFont *font);
479 gint gdk_font_id (GdkFont *font);
480 gint gdk_font_equal (GdkFont *fonta,
482 gint gdk_string_width (GdkFont *font,
483 const gchar *string);
484 gint gdk_text_width (GdkFont *font,
487 gint gdk_char_width (GdkFont *font,
489 gint gdk_string_measure (GdkFont *font,
490 const gchar *string);
491 gint gdk_text_measure (GdkFont *font,
494 gint gdk_char_measure (GdkFont *font,
500 void gdk_draw_point (GdkDrawable *drawable,
504 void gdk_draw_line (GdkDrawable *drawable,
510 void gdk_draw_rectangle (GdkDrawable *drawable,
517 void gdk_draw_arc (GdkDrawable *drawable,
526 void gdk_draw_polygon (GdkDrawable *drawable,
531 void gdk_draw_string (GdkDrawable *drawable,
536 const gchar *string);
537 void gdk_draw_text (GdkDrawable *drawable,
544 void gdk_draw_pixmap (GdkDrawable *drawable,
553 void gdk_draw_bitmap (GdkDrawable *drawable,
562 void gdk_draw_image (GdkDrawable *drawable,
571 void gdk_draw_points (GdkDrawable *drawable,
575 void gdk_draw_segments (GdkDrawable *drawable,
579 void gdk_draw_lines (GdkDrawable *drawable,
589 gint gdk_selection_owner_set (GdkWindow *owner,
593 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
594 void gdk_selection_convert (GdkWindow *requestor,
598 gint gdk_selection_property_get (GdkWindow *requestor,
602 void gdk_selection_send_notify (guint32 requestor,
608 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
609 guchar *text, gint length,
611 void gdk_free_text_list (gchar **list);
612 gint gdk_string_to_compound_text (gchar *str,
613 GdkAtom *encoding, gint *format,
614 guchar **ctext, gint *length);
615 void gdk_free_compound_text (guchar *ctext);
619 GdkAtom gdk_atom_intern (const gchar *atom_name,
620 gint only_if_exists);
621 gchar* gdk_atom_name (GdkAtom atom);
622 gint gdk_property_get (GdkWindow *window,
628 GdkAtom *actual_property_type,
633 void gdk_property_change (GdkWindow *window,
640 void gdk_property_delete (GdkWindow *window,
644 /* Rectangle utilities
646 gint gdk_rectangle_intersect (GdkRectangle *src1,
653 void gdk_input_init (void);
654 void gdk_input_exit (void);
655 GList *gdk_input_list_devices (void);
656 void gdk_input_set_extension_events (GdkWindow *window,
658 GdkExtensionMode mode);
659 void gdk_input_set_source (guint32 deviceid,
660 GdkInputSource source);
661 gint gdk_input_set_mode (guint32 deviceid,
663 void gdk_input_set_axes (guint32 deviceid,
665 void gdk_input_set_key (guint32 deviceid,
668 GdkModifierType modifiers);
669 void gdk_input_window_get_pointer (GdkWindow *window,
676 GdkModifierType *mask);
678 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
682 gint *nevents_return);
684 /* International Input Method Support Functions
687 gint gdk_im_ready (void);
689 void gdk_im_begin (GdkIC ic, GdkWindow* window);
690 void gdk_im_end (void);
691 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
692 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
693 GdkIC gdk_ic_new (GdkWindow* client_window,
694 GdkWindow* focus_window,
695 GdkIMStyle style, ...);
696 void gdk_ic_destroy (GdkIC ic);
697 GdkIMStyle gdk_ic_get_style (GdkIC ic);
698 void gdk_ic_set_values (GdkIC ic, ...);
699 void gdk_ic_get_values (GdkIC ic, ...);
700 void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
701 void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
702 GdkEventMask gdk_ic_get_events (GdkIC ic);
705 void gdk_event_send_clientmessage_toall(GdkEvent *event);
709 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
710 GdkColormap *colormap);
712 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
713 GdkColormap *colormap);
715 void gdk_color_context_free (GdkColorContext *cc);
717 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
722 void gdk_color_context_get_pixels (GdkColorContext *cc,
729 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
738 gint gdk_color_context_query_color (GdkColorContext *cc,
740 gint gdk_color_context_query_colors (GdkColorContext *cc,
744 gint gdk_color_context_add_palette (GdkColorContext *cc,
748 void gdk_color_context_init_dither (GdkColorContext *cc);
749 void gdk_color_context_free_dither (GdkColorContext *cc);
751 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
756 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
764 GdkRegion* gdk_region_new (void);
765 void gdk_region_destroy (GdkRegion *region);
767 gboolean gdk_region_empty (GdkRegion *region);
768 gboolean gdk_region_equal (GdkRegion *region1,
770 gboolean gdk_region_point_in (GdkRegion *region,
773 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
776 GdkRegion* gdk_region_polygon (GdkPoint *points,
778 GdkFillRule fill_rule);
780 void gdk_region_offset (GdkRegion *region,
783 void gdk_region_shrink (GdkRegion *region,
787 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
789 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
791 GdkRegion* gdk_regions_union (GdkRegion *source1,
793 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
795 GdkRegion* gdk_regions_xor (GdkRegion *source1,
801 #endif /* __cplusplus */
804 #endif /* __GDK_H__ */