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>
27 #endif /* __cplusplus */
30 /* Initialization, exit and events
32 #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
33 void gdk_init (gint *argc,
35 void gdk_exit (gint error_code);
36 gchar* gdk_set_locale (void);
38 gboolean gdk_events_pending (void);
39 GdkEvent* gdk_event_get (void);
41 GdkEvent* gdk_event_peek (void);
42 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
43 void gdk_event_put (GdkEvent *event);
45 GdkEvent* gdk_event_copy (GdkEvent *event);
46 void gdk_event_free (GdkEvent *event);
47 guint32 gdk_event_get_time (GdkEvent *event);
49 void gdk_event_handler_set (GdkEventFunc func,
51 GDestroyNotify notify);
53 void gdk_set_show_events (gint show_events);
54 void gdk_set_use_xshm (gint use_xshm);
56 gint gdk_get_show_events (void);
57 gint gdk_get_use_xshm (void);
58 gchar* gdk_get_display (void);
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);
66 gint gdk_input_add_full (gint source,
67 GdkInputCondition condition,
68 GdkInputFunction function,
70 GdkDestroyNotify destroy);
71 gint gdk_input_add (gint source,
72 GdkInputCondition condition,
73 GdkInputFunction function,
75 void gdk_input_remove (gint tag);
77 gint gdk_pointer_grab (GdkWindow * window,
79 GdkEventMask event_mask,
80 GdkWindow * confine_to,
83 void gdk_pointer_ungrab (guint32 time);
85 gint gdk_keyboard_grab (GdkWindow * window,
88 void gdk_keyboard_ungrab (guint32 time);
90 gint gdk_pointer_is_grabbed (void);
92 gint gdk_screen_width (void);
93 gint gdk_screen_height (void);
95 gint gdk_screen_width_mm (void);
96 gint gdk_screen_height_mm (void);
98 void gdk_flush (void);
101 void gdk_key_repeat_disable (void);
102 void gdk_key_repeat_restore (void);
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);
116 /* Actually, these are no-ops... */
117 GdkVisual* gdk_visual_ref (GdkVisual *visual);
118 void gdk_visual_unref (GdkVisual *visual);
120 void gdk_query_depths (gint **depths,
122 void gdk_query_visual_types (GdkVisualType **visual_types,
125 GList* gdk_list_visuals (void);
130 GdkWindow* gdk_window_new (GdkWindow *parent,
131 GdkWindowAttr *attributes,
132 gint attributes_mask);
134 void gdk_window_destroy (GdkWindow *window);
135 GdkWindow* gdk_window_ref (GdkWindow *window);
136 void gdk_window_unref (GdkWindow *window);
138 GdkWindow* gdk_window_at_pointer (gint *win_x,
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,
146 void gdk_window_resize (GdkWindow *window,
149 void gdk_window_move_resize (GdkWindow *window,
154 void gdk_window_reparent (GdkWindow *window,
155 GdkWindow *new_parent,
158 void gdk_window_clear (GdkWindow *window);
159 void gdk_window_clear_area (GdkWindow *window,
164 void gdk_window_clear_area_e(GdkWindow *window,
169 void gdk_window_copy_area (GdkWindow *window,
173 GdkWindow *source_window,
178 void gdk_window_raise (GdkWindow *window);
179 void gdk_window_lower (GdkWindow *window);
181 void gdk_window_set_user_data (GdkWindow *window,
183 void gdk_window_set_override_redirect(GdkWindow *window,
184 gboolean override_redirect);
186 void gdk_window_add_filter (GdkWindow *window,
187 GdkFilterFunc function,
189 void gdk_window_remove_filter (GdkWindow *window,
190 GdkFilterFunc function,
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
199 void gdk_window_shape_combine_mask (GdkWindow *window,
200 GdkBitmap *shape_mask,
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
210 void gdk_window_set_child_shapes (GdkWindow *window);
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
219 void gdk_window_merge_child_shapes (GdkWindow *window);
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.
227 gboolean gdk_window_is_visible (GdkWindow *window);
228 gboolean gdk_window_is_viewable (GdkWindow *window);
230 /* Set static bit gravity on the parent, and static
231 * window gravity on all children.
233 gboolean gdk_window_set_static_gravities (GdkWindow *window,
234 gboolean use_static);
236 * The following function adds a global filter for all client
237 * messages of type message_type
239 void gdk_add_client_message_filter (GdkAtom message_type,
245 GdkDragContext * gdk_drag_context_new (void);
246 void gdk_drag_context_ref (GdkDragContext *context);
247 void gdk_drag_context_unref (GdkDragContext *context);
249 /* Destination side */
251 void gdk_drag_status (GdkDragContext *context,
252 GdkDragAction action,
254 void gdk_drop_reply (GdkDragContext *context,
257 void gdk_drop_finish (GdkDragContext *context,
260 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
264 GdkDragContext * gdk_drag_begin (GdkWindow *window,
266 guint32 gdk_drag_get_protocol (guint32 xid,
267 GdkDragProtocol *protocol);
268 void gdk_drag_find_window (GdkDragContext *context,
269 GdkWindow *drag_window,
272 GdkWindow **dest_window,
273 GdkDragProtocol *protocol);
274 gboolean gdk_drag_motion (GdkDragContext *context,
275 GdkWindow *dest_window,
276 GdkDragProtocol protocol,
279 GdkDragAction suggested_action,
280 GdkDragAction possible_actions,
282 void gdk_drag_drop (GdkDragContext *context,
284 void gdk_drag_abort (GdkDragContext *context,
287 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
291 void gdk_window_set_hints (GdkWindow *window,
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);
305 void gdk_window_set_title (GdkWindow *window,
307 void gdk_window_set_role (GdkWindow *window,
309 void gdk_window_set_transient_for (GdkWindow *window,
311 void gdk_window_set_background (GdkWindow *window,
313 void gdk_window_set_back_pixmap (GdkWindow *window,
315 gint parent_relative);
316 void gdk_window_set_cursor (GdkWindow *window,
318 void gdk_window_set_colormap (GdkWindow *window,
319 GdkColormap *colormap);
320 void gdk_window_get_user_data (GdkWindow *window,
322 void gdk_window_get_geometry (GdkWindow *window,
328 void gdk_window_get_position (GdkWindow *window,
331 void gdk_window_get_size (GdkWindow *window,
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,
340 gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,
343 void gdk_window_get_root_origin (GdkWindow *window,
346 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
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);
357 void gdk_window_set_icon (GdkWindow *window,
358 GdkWindow *icon_window,
361 void gdk_window_set_icon_name (GdkWindow *window,
363 void gdk_window_set_group (GdkWindow *window,
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);
371 void gdk_window_register_dnd (GdkWindow *window);
373 void gdk_drawable_set_data (GdkDrawable *drawable,
376 GDestroyNotify destroy_func);
381 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
382 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
388 void gdk_cursor_destroy (GdkCursor *cursor);
393 GdkGC* gdk_gc_new (GdkWindow *window);
394 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
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,
404 void gdk_gc_set_background (GdkGC *gc,
406 void gdk_gc_set_font (GdkGC *gc,
408 void gdk_gc_set_function (GdkGC *gc,
409 GdkFunction function);
410 void gdk_gc_set_fill (GdkGC *gc,
412 void gdk_gc_set_tile (GdkGC *gc,
414 void gdk_gc_set_stipple (GdkGC *gc,
416 void gdk_gc_set_ts_origin (GdkGC *gc,
419 void gdk_gc_set_clip_origin (GdkGC *gc,
422 void gdk_gc_set_clip_mask (GdkGC *gc,
424 void gdk_gc_set_clip_rectangle (GdkGC *gc,
425 GdkRectangle *rectangle);
426 void gdk_gc_set_clip_region (GdkGC *gc,
428 void gdk_gc_set_subwindow (GdkGC *gc,
429 GdkSubwindowMode mode);
430 void gdk_gc_set_exposures (GdkGC *gc,
432 void gdk_gc_set_line_attributes (GdkGC *gc,
434 GdkLineStyle line_style,
435 GdkCapStyle cap_style,
436 GdkJoinStyle join_style);
437 void gdk_gc_set_dashes (GdkGC *gc,
441 void gdk_gc_copy (GdkGC *dst_gc,
447 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
451 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
455 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
462 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
464 GdkColor *transparent_color,
465 const gchar *filename);
466 GdkPixmap* gdk_pixmap_colormap_create_from_xpm
468 GdkColormap *colormap,
470 GdkColor *transparent_color,
471 const gchar *filename);
472 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
474 GdkColor *transparent_color,
476 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
478 GdkColormap *colormap,
480 GdkColor *transparent_color,
482 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
483 void gdk_pixmap_unref (GdkPixmap *pixmap);
485 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
486 void gdk_bitmap_unref (GdkBitmap *pixmap);
491 GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
495 GdkImage* gdk_image_new (GdkImageType type,
499 GdkImage* gdk_image_get (GdkWindow *window,
504 void gdk_image_put_pixel (GdkImage *image,
508 guint32 gdk_image_get_pixel (GdkImage *image,
511 void gdk_image_destroy (GdkImage *image);
516 GdkColormap* gdk_colormap_new (GdkVisual *visual,
518 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
519 void gdk_colormap_unref (GdkColormap *cmap);
521 GdkColormap* gdk_colormap_get_system (void);
522 gint gdk_colormap_get_system_size (void);
524 void gdk_colormap_change (GdkColormap *colormap,
528 gint gdk_colormap_alloc_colors (GdkColormap *colormap,
534 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
537 gboolean best_match);
538 void gdk_colormap_free_colors (GdkColormap *colormap,
542 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
544 GdkColor *gdk_color_copy (GdkColor *color);
545 void gdk_color_free (GdkColor *color);
547 gint gdk_color_parse (const gchar *spec,
549 guint gdk_color_hash (const GdkColor *colora,
550 const GdkColor *colorb);
551 gint gdk_color_equal (const GdkColor *colora,
552 const GdkColor *colorb);
555 /* The following functions are deprecated */
556 void gdk_colors_store (GdkColormap *colormap,
559 gint gdk_colors_alloc (GdkColormap *colormap,
565 void gdk_colors_free (GdkColormap *colormap,
569 gint gdk_color_white (GdkColormap *colormap,
571 gint gdk_color_black (GdkColormap *colormap,
573 gint gdk_color_alloc (GdkColormap *colormap,
575 gint gdk_color_change (GdkColormap *colormap,
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,
593 gint gdk_text_width_wc (GdkFont *font,
594 const GdkWChar *text,
596 gint gdk_char_width (GdkFont *font,
598 gint gdk_char_width_wc (GdkFont *font,
600 gint gdk_string_measure (GdkFont *font,
601 const gchar *string);
602 gint gdk_text_measure (GdkFont *font,
605 gint gdk_char_measure (GdkFont *font,
607 gint gdk_string_height (GdkFont *font,
608 const gchar *string);
609 gint gdk_text_height (GdkFont *font,
612 gint gdk_char_height (GdkFont *font,
615 void gdk_text_extents (GdkFont *font,
623 void gdk_text_extents_wc (GdkFont *font,
624 const GdkWChar *text,
631 void gdk_string_extents (GdkFont *font,
641 void gdk_draw_point (GdkDrawable *drawable,
645 void gdk_draw_line (GdkDrawable *drawable,
651 void gdk_draw_rectangle (GdkDrawable *drawable,
658 void gdk_draw_arc (GdkDrawable *drawable,
667 void gdk_draw_polygon (GdkDrawable *drawable,
672 void gdk_draw_string (GdkDrawable *drawable,
677 const gchar *string);
678 void gdk_draw_text (GdkDrawable *drawable,
685 void gdk_draw_text_wc (GdkDrawable *drawable,
690 const GdkWChar *text,
692 void gdk_draw_pixmap (GdkDrawable *drawable,
701 void gdk_draw_bitmap (GdkDrawable *drawable,
710 void gdk_draw_image (GdkDrawable *drawable,
719 void gdk_draw_points (GdkDrawable *drawable,
723 void gdk_draw_segments (GdkDrawable *drawable,
727 void gdk_draw_lines (GdkDrawable *drawable,
737 gint gdk_selection_owner_set (GdkWindow *owner,
741 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
742 void gdk_selection_convert (GdkWindow *requestor,
746 gint gdk_selection_property_get (GdkWindow *requestor,
750 void gdk_selection_send_notify (guint32 requestor,
756 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
757 guchar *text, gint length,
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);
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,
776 GdkAtom *actual_property_type,
781 void gdk_property_change (GdkWindow *window,
788 void gdk_property_delete (GdkWindow *window,
792 /* Rectangle utilities
794 gint gdk_rectangle_intersect (GdkRectangle *src1,
797 void gdk_rectangle_union (GdkRectangle *src1,
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,
809 GdkExtensionMode mode);
810 void gdk_input_set_source (guint32 deviceid,
811 GdkInputSource source);
812 gint gdk_input_set_mode (guint32 deviceid,
814 void gdk_input_set_axes (guint32 deviceid,
816 void gdk_input_set_key (guint32 deviceid,
819 GdkModifierType modifiers);
820 void gdk_input_window_get_pointer (GdkWindow *window,
827 GdkModifierType *mask);
829 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
833 gint *nevents_return);
835 /* International Input Method Support Functions
838 gint gdk_im_ready (void);
840 void gdk_im_begin (GdkIC *ic,
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);
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);
852 GdkICAttr* gdk_ic_attr_new (void);
853 void gdk_ic_attr_destroy (GdkICAttr *attr);
855 GdkICAttributesType gdk_ic_set_attr (GdkIC *ic,
857 GdkICAttributesType mask);
858 GdkICAttributesType gdk_ic_get_attr (GdkIC *ic,
860 GdkICAttributesType mask);
862 /* Conversion functions between wide char and multibyte strings.
864 gchar *gdk_wcstombs (const GdkWChar *src);
865 gint gdk_mbstowcs (GdkWChar *dest,
872 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
873 GdkColormap *colormap);
875 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
876 GdkColormap *colormap);
878 void gdk_color_context_free (GdkColorContext *cc);
880 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
885 void gdk_color_context_get_pixels (GdkColorContext *cc,
892 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
901 gint gdk_color_context_query_color (GdkColorContext *cc,
903 gint gdk_color_context_query_colors (GdkColorContext *cc,
907 gint gdk_color_context_add_palette (GdkColorContext *cc,
911 void gdk_color_context_init_dither (GdkColorContext *cc);
912 void gdk_color_context_free_dither (GdkColorContext *cc);
914 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
919 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
927 GdkRegion* gdk_region_new (void);
928 void gdk_region_destroy (GdkRegion *region);
930 void gdk_region_get_clipbox(GdkRegion *region,
931 GdkRectangle *rectangle);
933 gboolean gdk_region_empty (GdkRegion *region);
934 gboolean gdk_region_equal (GdkRegion *region1,
936 gboolean gdk_region_point_in (GdkRegion *region,
939 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
942 GdkRegion* gdk_region_polygon (GdkPoint *points,
944 GdkFillRule fill_rule);
946 void gdk_region_offset (GdkRegion *region,
949 void gdk_region_shrink (GdkRegion *region,
953 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
955 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
957 GdkRegion* gdk_regions_union (GdkRegion *source1,
959 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
961 GdkRegion* gdk_regions_xor (GdkRegion *source1,
965 void gdk_event_send_clientmessage_toall (GdkEvent *event);
966 gboolean gdk_event_send_client_message (GdkEvent *event,
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);
981 extern GMutex *gdk_threads_mutex;
983 void gdk_threads_enter (void);
984 void gdk_threads_leave (void);
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); \
991 # define GDK_THREADS_LEAVE() G_STMT_START { \
992 if (gdk_threads_mutex) \
993 g_mutex_unlock (gdk_threads_mutex); \
995 #else /* !G_THREADS_ENABLED */
996 # define GDK_THREADS_ENTER()
997 # define GDK_THREADS_LEAVE()
998 #endif /* !G_THREADS_ENABLED */
1000 #include <gdk/gdkrgb.h>
1004 #endif /* __cplusplus */
1007 #endif /* __GDK_H__ */