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 Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gdk/gdktypes.h>
27 #endif /* __cplusplus */
30 /* Initialization, exit and events
32 void gdk_init (int *argc,
34 void gdk_exit (int error_code);
35 gchar* gdk_set_locale (void);
37 gint gdk_events_pending (void);
38 GdkEvent *gdk_event_get (void);
39 GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
40 void gdk_event_put (GdkEvent *event);
42 GdkEvent *gdk_event_copy (GdkEvent *event);
43 void gdk_event_free (GdkEvent *event);
45 void gdk_set_show_events (gint show_events);
46 void gdk_set_use_xshm (gint use_xshm);
48 gint gdk_get_show_events (void);
49 gint gdk_get_use_xshm (void);
50 gchar *gdk_get_display (void);
52 guint32 gdk_time_get (void);
53 guint32 gdk_timer_get (void);
54 void gdk_timer_set (guint32 milliseconds);
55 void gdk_timer_enable (void);
56 void gdk_timer_disable (void);
58 gint gdk_input_add_full (gint source,
59 GdkInputCondition condition,
60 GdkInputFunction function,
62 GdkDestroyNotify destroy);
63 #define gdk_input_add_interp gdk_input_add_full
64 gint gdk_input_add (gint source,
65 GdkInputCondition condition,
66 GdkInputFunction function,
68 void gdk_input_remove (gint tag);
70 gint gdk_pointer_grab (GdkWindow * window,
72 GdkEventMask event_mask,
73 GdkWindow * confine_to,
76 void gdk_pointer_ungrab (guint32 time);
78 gint gdk_keyboard_grab (GdkWindow * window,
81 void gdk_keyboard_ungrab (guint32 time);
83 gint gdk_pointer_is_grabbed (void);
85 gint gdk_screen_width (void);
86 gint gdk_screen_height (void);
88 void gdk_flush (void);
91 void gdk_key_repeat_disable (void);
92 void gdk_key_repeat_restore (void);
97 gint gdk_visual_get_best_depth (void);
98 GdkVisualType gdk_visual_get_best_type (void);
99 GdkVisual* gdk_visual_get_system (void);
100 GdkVisual* gdk_visual_get_best (void);
101 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
102 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
103 GdkVisual* gdk_visual_get_best_with_both (gint depth,
104 GdkVisualType visual_type);
106 /* Actually, these are no-ops... */
107 GdkVisual* gdk_visual_ref (GdkVisual *visual);
108 void gdk_visual_unref (GdkVisual *visual);
110 void gdk_query_depths (gint **depths,
112 void gdk_query_visual_types (GdkVisualType **visual_types,
114 void gdk_query_visuals (GdkVisual **visuals,
120 GdkWindow* gdk_window_new (GdkWindow *parent,
121 GdkWindowAttr *attributes,
122 gint attributes_mask);
124 GdkWindow * gdk_window_foreign_new (guint32 anid);
125 void gdk_window_destroy (GdkWindow *window);
126 GdkWindow* gdk_window_ref (GdkWindow *window);
127 void gdk_window_unref (GdkWindow *window);
129 void gdk_window_show (GdkWindow *window);
130 void gdk_window_hide (GdkWindow *window);
131 void gdk_window_withdraw (GdkWindow *window);
132 void gdk_window_move (GdkWindow *window,
135 void gdk_window_resize (GdkWindow *window,
138 void gdk_window_move_resize (GdkWindow *window,
143 void gdk_window_reparent (GdkWindow *window,
144 GdkWindow *new_parent,
147 void gdk_window_clear (GdkWindow *window);
148 void gdk_window_clear_area (GdkWindow *window,
153 void gdk_window_clear_area_e(GdkWindow *window,
158 void gdk_window_copy_area (GdkWindow *window,
162 GdkWindow *source_window,
167 void gdk_window_raise (GdkWindow *window);
168 void gdk_window_lower (GdkWindow *window);
170 void gdk_window_set_user_data (GdkWindow *window,
172 void gdk_window_set_override_redirect(GdkWindow *window,
173 gboolean override_redirect);
175 void gdk_window_add_filter (GdkWindow *window,
176 GdkFilterFunc function,
178 void gdk_window_remove_filter (GdkWindow *window,
179 GdkFilterFunc function,
183 * This allows for making shaped (partially transparent) windows
184 * - cool feature, needed for Drag and Drag for example.
185 * The shape_mask can be the mask
186 * from gdk_pixmap_create_from_xpm. Stefan Wille
188 void gdk_window_shape_combine_mask (GdkWindow *window,
189 GdkBitmap *shape_mask,
195 * Algorithm (drop source):
196 * A window being dragged will be sent a GDK_DRAG_BEGIN message.
197 * It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
199 * When we get a DROP_ENTER incoming, we send it on to the window in question.
200 * That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
201 * things (it must call that even if it's not going to accept the drop)
203 * These two turn on/off drag or drop, and if enabling it also
204 * sets the list of types supported. The list of types passed in
205 * should be in order of decreasing preference.
207 void gdk_window_dnd_drag_set (GdkWindow *window,
213 *XXX todo: add a GDK_DROP_ENTER which can look at actual data
215 void gdk_window_dnd_drop_set (GdkWindow *window,
219 guint8 destructive_op);
222 * This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
223 * file manager where multiple icons were selected and the drag began.
224 * The icon that the drag actually began on would gdk_dnd_drag_addwindow
225 * for all the other icons that were being dragged...
227 void gdk_dnd_drag_addwindow (GdkWindow *window);
228 void gdk_window_dnd_data_set (GdkWindow *window,
231 gulong data_numbytes);
232 void gdk_dnd_set_drag_cursors(GdkCursor *default_cursor,
233 GdkCursor *goahead_cursor);
234 void gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
235 GdkPoint *default_hotspot,
236 GdkWindow *goahead_pixmapwin,
237 GdkPoint *goahead_hotspot);
239 void gdk_window_set_hints (GdkWindow *window,
247 void gdk_window_set_title (GdkWindow *window,
249 void gdk_window_set_background (GdkWindow *window,
251 void gdk_window_set_back_pixmap (GdkWindow *window,
253 gint parent_relative);
254 void gdk_window_set_cursor (GdkWindow *window,
256 void gdk_window_set_colormap (GdkWindow *window,
257 GdkColormap *colormap);
258 void gdk_window_get_user_data (GdkWindow *window,
260 void gdk_window_get_geometry (GdkWindow *window,
266 void gdk_window_get_position (GdkWindow *window,
269 void gdk_window_get_size (GdkWindow *window,
272 GdkVisual* gdk_window_get_visual (GdkWindow *window);
273 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
274 GdkWindowType gdk_window_get_type (GdkWindow *window);
275 gint gdk_window_get_origin (GdkWindow *window,
278 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
281 GdkModifierType *mask);
282 GdkWindow* gdk_window_get_parent (GdkWindow *window);
283 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
284 GList* gdk_window_get_children (GdkWindow *window);
285 GdkEventMask gdk_window_get_events (GdkWindow *window);
286 void gdk_window_set_events (GdkWindow *window,
287 GdkEventMask event_mask);
289 void gdk_window_set_icon (GdkWindow *window,
290 GdkWindow *icon_window,
293 void gdk_window_set_icon_name (GdkWindow *window,
295 void gdk_window_set_group (GdkWindow *window,
297 void gdk_window_set_decorations (GdkWindow *window,
298 GdkWMDecoration decorations);
299 void gdk_window_set_functions (GdkWindow *window,
300 GdkWMFunction functions);
304 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
305 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
311 void gdk_cursor_destroy (GdkCursor *cursor);
316 GdkGC* gdk_gc_new (GdkWindow *window);
317 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
319 GdkGCValuesMask values_mask);
320 GdkGC* gdk_gc_ref (GdkGC *gc);
321 void gdk_gc_unref (GdkGC *gc);
322 void gdk_gc_destroy (GdkGC *gc);
323 void gdk_gc_get_values (GdkGC *gc,
324 GdkGCValues *values);
325 void gdk_gc_set_foreground (GdkGC *gc,
327 void gdk_gc_set_background (GdkGC *gc,
329 void gdk_gc_set_font (GdkGC *gc,
331 void gdk_gc_set_function (GdkGC *gc,
332 GdkFunction function);
333 void gdk_gc_set_fill (GdkGC *gc,
335 void gdk_gc_set_tile (GdkGC *gc,
337 void gdk_gc_set_stipple (GdkGC *gc,
339 void gdk_gc_set_ts_origin (GdkGC *gc,
342 void gdk_gc_set_clip_origin (GdkGC *gc,
345 void gdk_gc_set_clip_mask (GdkGC *gc,
347 void gdk_gc_set_clip_rectangle (GdkGC *gc,
348 GdkRectangle *rectangle);
349 void gdk_gc_set_clip_region (GdkGC *gc,
351 void gdk_gc_set_subwindow (GdkGC *gc,
352 GdkSubwindowMode mode);
353 void gdk_gc_set_exposures (GdkGC *gc,
355 void gdk_gc_set_line_attributes (GdkGC *gc,
357 GdkLineStyle line_style,
358 GdkCapStyle cap_style,
359 GdkJoinStyle join_style);
360 void gdk_gc_copy (GdkGC *dst_gc,
366 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
370 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
374 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
381 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
383 GdkColor *transparent_color,
384 const gchar *filename);
385 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
387 GdkColor *transparent_color,
389 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
390 void gdk_pixmap_unref (GdkPixmap *pixmap);
392 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
393 void gdk_bitmap_unref (GdkBitmap *pixmap);
398 GdkImage* gdk_image_new_bitmap(GdkVisual *,
402 GdkImage* gdk_image_new (GdkImageType type,
406 GdkImage* gdk_image_get (GdkWindow *window,
411 void gdk_image_put_pixel (GdkImage *image,
415 guint32 gdk_image_get_pixel (GdkImage *image,
418 void gdk_image_destroy (GdkImage *image);
423 GdkColormap* gdk_colormap_new (GdkVisual *visual,
425 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
426 void gdk_colormap_unref (GdkColormap *cmap);
428 GdkColormap* gdk_colormap_get_system (void);
429 gint gdk_colormap_get_system_size (void);
431 void gdk_colormap_change (GdkColormap *colormap,
433 void gdk_colors_store (GdkColormap *colormap,
436 gint gdk_colors_alloc (GdkColormap *colormap,
442 void gdk_colors_free (GdkColormap *colormap,
446 gint gdk_color_white (GdkColormap *colormap,
448 gint gdk_color_black (GdkColormap *colormap,
450 gint gdk_color_parse (const gchar *spec,
452 gint gdk_color_alloc (GdkColormap *colormap,
454 gint gdk_color_change (GdkColormap *colormap,
456 gint gdk_color_equal (GdkColor *colora,
462 GdkFont* gdk_font_load (const gchar *font_name);
463 GdkFont* gdk_fontset_load (gchar *fontset_name);
464 GdkFont* gdk_font_ref (GdkFont *font);
465 void gdk_font_unref (GdkFont *font);
466 gint gdk_font_id (GdkFont *font);
467 gint gdk_font_equal (GdkFont *fonta,
469 gint gdk_string_width (GdkFont *font,
470 const gchar *string);
471 gint gdk_text_width (GdkFont *font,
474 gint gdk_char_width (GdkFont *font,
476 gint gdk_string_measure (GdkFont *font,
477 const gchar *string);
478 gint gdk_text_measure (GdkFont *font,
481 gint gdk_char_measure (GdkFont *font,
487 void gdk_draw_point (GdkDrawable *drawable,
491 void gdk_draw_line (GdkDrawable *drawable,
497 void gdk_draw_rectangle (GdkDrawable *drawable,
504 void gdk_draw_arc (GdkDrawable *drawable,
513 void gdk_draw_polygon (GdkDrawable *drawable,
518 void gdk_draw_string (GdkDrawable *drawable,
523 const gchar *string);
524 void gdk_draw_text (GdkDrawable *drawable,
531 void gdk_draw_pixmap (GdkDrawable *drawable,
540 void gdk_draw_bitmap (GdkDrawable *drawable,
549 void gdk_draw_image (GdkDrawable *drawable,
558 void gdk_draw_points (GdkDrawable *drawable,
562 void gdk_draw_segments (GdkDrawable *drawable,
566 void gdk_draw_lines (GdkDrawable *drawable,
576 gint gdk_selection_owner_set (GdkWindow *owner,
580 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
581 void gdk_selection_convert (GdkWindow *requestor,
585 gint gdk_selection_property_get (GdkWindow *requestor,
589 void gdk_selection_send_notify (guint32 requestor,
595 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
596 guchar *text, gint length,
598 void gdk_free_text_list (gchar **list);
599 gint gdk_string_to_compound_text (gchar *str,
600 GdkAtom *encoding, gint *format,
601 guchar **ctext, gint *length);
602 void gdk_free_compound_text (guchar *ctext);
606 GdkAtom gdk_atom_intern (const gchar *atom_name,
607 gint only_if_exists);
608 gchar* gdk_atom_name (GdkAtom atom);
609 gint gdk_property_get (GdkWindow *window,
615 GdkAtom *actual_property_type,
620 void gdk_property_change (GdkWindow *window,
627 void gdk_property_delete (GdkWindow *window,
631 /* Rectangle utilities
633 gint gdk_rectangle_intersect (GdkRectangle *src1,
640 void gdk_input_init (void);
641 void gdk_input_exit (void);
642 GList *gdk_input_list_devices (void);
643 void gdk_input_set_extension_events (GdkWindow *window,
645 GdkExtensionMode mode);
646 void gdk_input_set_source (guint32 deviceid,
647 GdkInputSource source);
648 gint gdk_input_set_mode (guint32 deviceid,
650 void gdk_input_set_axes (guint32 deviceid,
652 void gdk_input_set_key (guint32 deviceid,
655 GdkModifierType modifiers);
656 void gdk_input_window_get_pointer (GdkWindow *window,
663 GdkModifierType *mask);
665 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
669 gint *nevents_return);
671 /* International Input Method Support Functions
674 gint gdk_im_ready (void);
676 void gdk_im_begin (GdkIC ic, GdkWindow* window);
677 void gdk_im_end (void);
678 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
679 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
680 GdkIC gdk_ic_new (GdkWindow* client_window,
681 GdkWindow* focus_window,
682 GdkIMStyle style, ...);
683 void gdk_ic_destroy (GdkIC ic);
684 GdkIMStyle gdk_ic_get_style (GdkIC ic);
685 void gdk_ic_set_values (GdkIC ic, ...);
686 void gdk_ic_get_values (GdkIC ic, ...);
687 void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
688 void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
689 GdkEventMask gdk_ic_get_events (GdkIC ic);
692 void gdk_event_send_clientmessage_toall(GdkEvent *event);
696 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
697 GdkColormap *colormap);
699 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
700 GdkColormap *colormap);
702 void gdk_color_context_free (GdkColorContext *cc);
704 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
709 void gdk_color_context_get_pixels (GdkColorContext *cc,
716 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
725 gint gdk_color_context_query_color (GdkColorContext *cc,
727 gint gdk_color_context_query_colors (GdkColorContext *cc,
731 gint gdk_color_context_add_palette (GdkColorContext *cc,
735 void gdk_color_context_init_dither (GdkColorContext *cc);
736 void gdk_color_context_free_dither (GdkColorContext *cc);
738 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
743 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
751 GdkRegion* gdk_region_new (void);
752 void gdk_region_destroy (GdkRegion *region);
754 gboolean gdk_region_empty (GdkRegion *region);
755 gboolean gdk_region_equal (GdkRegion *region1,
757 gboolean gdk_region_point_in (GdkRegion *region,
760 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
763 void gdk_region_offset (GdkRegion *region,
766 void gdk_region_shrink (GdkRegion *region,
770 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
772 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
774 GdkRegion* gdk_regions_union (GdkRegion *source1,
776 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
778 GdkRegion* gdk_regions_xor (GdkRegion *source1,
784 #endif /* __cplusplus */
787 #endif /* __GDK_H__ */