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 /* Push and pop error handlers for X errors
40 void gdk_error_trap_push (void);
41 gint gdk_error_trap_pop (void);
44 gboolean gdk_events_pending (void);
45 GdkEvent* gdk_event_get (void);
47 GdkEvent* gdk_event_peek (void);
48 GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
49 void gdk_event_put (GdkEvent *event);
51 GdkEvent* gdk_event_copy (GdkEvent *event);
52 void gdk_event_free (GdkEvent *event);
53 guint32 gdk_event_get_time (GdkEvent *event);
55 void gdk_event_handler_set (GdkEventFunc func,
57 GDestroyNotify notify);
59 void gdk_set_show_events (gint show_events);
60 void gdk_set_use_xshm (gint use_xshm);
62 gint gdk_get_show_events (void);
63 gint gdk_get_use_xshm (void);
64 gchar* gdk_get_display (void);
66 guint32 gdk_time_get (void);
67 guint32 gdk_timer_get (void);
68 void gdk_timer_set (guint32 milliseconds);
69 void gdk_timer_enable (void);
70 void gdk_timer_disable (void);
72 gint gdk_input_add_full (gint source,
73 GdkInputCondition condition,
74 GdkInputFunction function,
76 GdkDestroyNotify destroy);
77 gint gdk_input_add (gint source,
78 GdkInputCondition condition,
79 GdkInputFunction function,
81 void gdk_input_remove (gint tag);
83 gint gdk_pointer_grab (GdkWindow * window,
85 GdkEventMask event_mask,
86 GdkWindow * confine_to,
89 void gdk_pointer_ungrab (guint32 time);
91 gint gdk_keyboard_grab (GdkWindow * window,
94 void gdk_keyboard_ungrab (guint32 time);
96 gint gdk_pointer_is_grabbed (void);
98 gint gdk_screen_width (void);
99 gint gdk_screen_height (void);
101 gint gdk_screen_width_mm (void);
102 gint gdk_screen_height_mm (void);
104 void gdk_flush (void);
105 void gdk_beep (void);
107 void gdk_key_repeat_disable (void);
108 void gdk_key_repeat_restore (void);
113 gint gdk_visual_get_best_depth (void);
114 GdkVisualType gdk_visual_get_best_type (void);
115 GdkVisual* gdk_visual_get_system (void);
116 GdkVisual* gdk_visual_get_best (void);
117 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
118 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
119 GdkVisual* gdk_visual_get_best_with_both (gint depth,
120 GdkVisualType visual_type);
122 /* Actually, these are no-ops... */
123 GdkVisual* gdk_visual_ref (GdkVisual *visual);
124 void gdk_visual_unref (GdkVisual *visual);
126 void gdk_query_depths (gint **depths,
128 void gdk_query_visual_types (GdkVisualType **visual_types,
131 GList* gdk_list_visuals (void);
136 GdkWindow* gdk_window_new (GdkWindow *parent,
137 GdkWindowAttr *attributes,
138 gint attributes_mask);
140 void gdk_window_destroy (GdkWindow *window);
141 GdkWindow* gdk_window_ref (GdkWindow *window);
142 void gdk_window_unref (GdkWindow *window);
144 GdkWindow* gdk_window_at_pointer (gint *win_x,
146 void gdk_window_show (GdkWindow *window);
147 void gdk_window_hide (GdkWindow *window);
148 void gdk_window_withdraw (GdkWindow *window);
149 void gdk_window_move (GdkWindow *window,
152 void gdk_window_resize (GdkWindow *window,
155 void gdk_window_move_resize (GdkWindow *window,
160 void gdk_window_reparent (GdkWindow *window,
161 GdkWindow *new_parent,
164 void gdk_window_clear (GdkWindow *window);
165 void gdk_window_clear_area (GdkWindow *window,
170 void gdk_window_clear_area_e(GdkWindow *window,
175 void gdk_window_copy_area (GdkWindow *window,
179 GdkWindow *source_window,
184 void gdk_window_raise (GdkWindow *window);
185 void gdk_window_lower (GdkWindow *window);
187 void gdk_window_set_user_data (GdkWindow *window,
189 void gdk_window_set_override_redirect(GdkWindow *window,
190 gboolean override_redirect);
192 void gdk_window_add_filter (GdkWindow *window,
193 GdkFilterFunc function,
195 void gdk_window_remove_filter (GdkWindow *window,
196 GdkFilterFunc function,
200 * This allows for making shaped (partially transparent) windows
201 * - cool feature, needed for Drag and Drag for example.
202 * The shape_mask can be the mask
203 * from gdk_pixmap_create_from_xpm. Stefan Wille
205 void gdk_window_shape_combine_mask (GdkWindow *window,
206 GdkBitmap *shape_mask,
210 * This routine allows you to quickly take the shapes of all the child windows
211 * of a window and use their shapes as the shape mask for this window - useful
212 * for container windows that dont want to look like a big box
216 void gdk_window_set_child_shapes (GdkWindow *window);
219 * This routine allows you to merge (ie ADD) child shapes to your
220 * own window's shape keeping its current shape and ADDING the shild
225 void gdk_window_merge_child_shapes (GdkWindow *window);
228 * Check if a window has been shown, and whether all it's
229 * parents up to a toplevel have been shown, respectively.
230 * Note that a window that is_viewable below is not necessarily
231 * viewable in the X sense.
233 gboolean gdk_window_is_visible (GdkWindow *window);
234 gboolean gdk_window_is_viewable (GdkWindow *window);
236 /* Set static bit gravity on the parent, and static
237 * window gravity on all children.
239 gboolean gdk_window_set_static_gravities (GdkWindow *window,
240 gboolean use_static);
242 * The following function adds a global filter for all client
243 * messages of type message_type
245 void gdk_add_client_message_filter (GdkAtom message_type,
251 GdkDragContext * gdk_drag_context_new (void);
252 void gdk_drag_context_ref (GdkDragContext *context);
253 void gdk_drag_context_unref (GdkDragContext *context);
255 /* Destination side */
257 void gdk_drag_status (GdkDragContext *context,
258 GdkDragAction action,
260 void gdk_drop_reply (GdkDragContext *context,
263 void gdk_drop_finish (GdkDragContext *context,
266 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
270 GdkDragContext * gdk_drag_begin (GdkWindow *window,
272 guint32 gdk_drag_get_protocol (guint32 xid,
273 GdkDragProtocol *protocol);
274 void gdk_drag_find_window (GdkDragContext *context,
275 GdkWindow *drag_window,
278 GdkWindow **dest_window,
279 GdkDragProtocol *protocol);
280 gboolean gdk_drag_motion (GdkDragContext *context,
281 GdkWindow *dest_window,
282 GdkDragProtocol protocol,
285 GdkDragAction suggested_action,
286 GdkDragAction possible_actions,
288 void gdk_drag_drop (GdkDragContext *context,
290 void gdk_drag_abort (GdkDragContext *context,
293 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
297 void gdk_window_set_hints (GdkWindow *window,
305 void gdk_window_set_geometry_hints (GdkWindow *window,
306 GdkGeometry *geometry,
307 GdkWindowHints flags);
308 void gdk_set_sm_client_id (const gchar *sm_client_id);
311 void gdk_window_set_title (GdkWindow *window,
313 void gdk_window_set_role (GdkWindow *window,
315 void gdk_window_set_transient_for (GdkWindow *window,
317 void gdk_window_set_background (GdkWindow *window,
319 void gdk_window_set_back_pixmap (GdkWindow *window,
321 gint parent_relative);
322 void gdk_window_set_cursor (GdkWindow *window,
324 void gdk_window_set_colormap (GdkWindow *window,
325 GdkColormap *colormap);
326 void gdk_window_get_user_data (GdkWindow *window,
328 void gdk_window_get_geometry (GdkWindow *window,
334 void gdk_window_get_position (GdkWindow *window,
337 void gdk_window_get_size (GdkWindow *window,
340 GdkVisual* gdk_window_get_visual (GdkWindow *window);
341 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
342 GdkWindowType gdk_window_get_type (GdkWindow *window);
343 gint gdk_window_get_origin (GdkWindow *window,
346 gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,
349 void gdk_window_get_root_origin (GdkWindow *window,
352 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
355 GdkModifierType *mask);
356 GdkWindow* gdk_window_get_parent (GdkWindow *window);
357 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
358 GList* gdk_window_get_children (GdkWindow *window);
359 GdkEventMask gdk_window_get_events (GdkWindow *window);
360 void gdk_window_set_events (GdkWindow *window,
361 GdkEventMask event_mask);
363 void gdk_window_set_icon (GdkWindow *window,
364 GdkWindow *icon_window,
367 void gdk_window_set_icon_name (GdkWindow *window,
369 void gdk_window_set_group (GdkWindow *window,
371 void gdk_window_set_decorations (GdkWindow *window,
372 GdkWMDecoration decorations);
373 void gdk_window_set_functions (GdkWindow *window,
374 GdkWMFunction functions);
375 GList * gdk_window_get_toplevels (void);
377 void gdk_window_register_dnd (GdkWindow *window);
379 void gdk_drawable_set_data (GdkDrawable *drawable,
382 GDestroyNotify destroy_func);
387 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
388 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
394 void gdk_cursor_destroy (GdkCursor *cursor);
399 GdkGC* gdk_gc_new (GdkWindow *window);
400 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
402 GdkGCValuesMask values_mask);
403 GdkGC* gdk_gc_ref (GdkGC *gc);
404 void gdk_gc_unref (GdkGC *gc);
405 void gdk_gc_destroy (GdkGC *gc);
406 void gdk_gc_get_values (GdkGC *gc,
407 GdkGCValues *values);
408 void gdk_gc_set_foreground (GdkGC *gc,
410 void gdk_gc_set_background (GdkGC *gc,
412 void gdk_gc_set_font (GdkGC *gc,
414 void gdk_gc_set_function (GdkGC *gc,
415 GdkFunction function);
416 void gdk_gc_set_fill (GdkGC *gc,
418 void gdk_gc_set_tile (GdkGC *gc,
420 void gdk_gc_set_stipple (GdkGC *gc,
422 void gdk_gc_set_ts_origin (GdkGC *gc,
425 void gdk_gc_set_clip_origin (GdkGC *gc,
428 void gdk_gc_set_clip_mask (GdkGC *gc,
430 void gdk_gc_set_clip_rectangle (GdkGC *gc,
431 GdkRectangle *rectangle);
432 void gdk_gc_set_clip_region (GdkGC *gc,
434 void gdk_gc_set_subwindow (GdkGC *gc,
435 GdkSubwindowMode mode);
436 void gdk_gc_set_exposures (GdkGC *gc,
438 void gdk_gc_set_line_attributes (GdkGC *gc,
440 GdkLineStyle line_style,
441 GdkCapStyle cap_style,
442 GdkJoinStyle join_style);
443 void gdk_gc_set_dashes (GdkGC *gc,
447 void gdk_gc_copy (GdkGC *dst_gc,
453 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
457 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
461 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
468 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
470 GdkColor *transparent_color,
471 const gchar *filename);
472 GdkPixmap* gdk_pixmap_colormap_create_from_xpm
474 GdkColormap *colormap,
476 GdkColor *transparent_color,
477 const gchar *filename);
478 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
480 GdkColor *transparent_color,
482 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
484 GdkColormap *colormap,
486 GdkColor *transparent_color,
488 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
489 void gdk_pixmap_unref (GdkPixmap *pixmap);
491 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
492 void gdk_bitmap_unref (GdkBitmap *pixmap);
497 GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
501 GdkImage* gdk_image_new (GdkImageType type,
505 GdkImage* gdk_image_get (GdkWindow *window,
510 void gdk_image_put_pixel (GdkImage *image,
514 guint32 gdk_image_get_pixel (GdkImage *image,
517 void gdk_image_destroy (GdkImage *image);
522 GdkColormap* gdk_colormap_new (GdkVisual *visual,
524 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
525 void gdk_colormap_unref (GdkColormap *cmap);
527 GdkColormap* gdk_colormap_get_system (void);
528 gint gdk_colormap_get_system_size (void);
530 void gdk_colormap_change (GdkColormap *colormap,
534 gint gdk_colormap_alloc_colors (GdkColormap *colormap,
540 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
543 gboolean best_match);
544 void gdk_colormap_free_colors (GdkColormap *colormap,
548 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
550 GdkColor *gdk_color_copy (GdkColor *color);
551 void gdk_color_free (GdkColor *color);
553 gint gdk_color_parse (const gchar *spec,
555 guint gdk_color_hash (const GdkColor *colora,
556 const GdkColor *colorb);
557 gint gdk_color_equal (const GdkColor *colora,
558 const GdkColor *colorb);
561 /* The following functions are deprecated */
562 void gdk_colors_store (GdkColormap *colormap,
565 gint gdk_colors_alloc (GdkColormap *colormap,
571 void gdk_colors_free (GdkColormap *colormap,
575 gint gdk_color_white (GdkColormap *colormap,
577 gint gdk_color_black (GdkColormap *colormap,
579 gint gdk_color_alloc (GdkColormap *colormap,
581 gint gdk_color_change (GdkColormap *colormap,
587 GdkFont* gdk_font_load (const gchar *font_name);
588 GdkFont* gdk_fontset_load (gchar *fontset_name);
589 GdkFont* gdk_font_ref (GdkFont *font);
590 void gdk_font_unref (GdkFont *font);
591 gint gdk_font_id (const GdkFont *font);
592 gint gdk_font_equal (const GdkFont *fonta,
593 const GdkFont *fontb);
594 gint gdk_string_width (GdkFont *font,
595 const gchar *string);
596 gint gdk_text_width (GdkFont *font,
599 gint gdk_text_width_wc (GdkFont *font,
600 const GdkWChar *text,
602 gint gdk_char_width (GdkFont *font,
604 gint gdk_char_width_wc (GdkFont *font,
606 gint gdk_string_measure (GdkFont *font,
607 const gchar *string);
608 gint gdk_text_measure (GdkFont *font,
611 gint gdk_char_measure (GdkFont *font,
613 gint gdk_string_height (GdkFont *font,
614 const gchar *string);
615 gint gdk_text_height (GdkFont *font,
618 gint gdk_char_height (GdkFont *font,
621 void gdk_text_extents (GdkFont *font,
629 void gdk_text_extents_wc (GdkFont *font,
630 const GdkWChar *text,
637 void gdk_string_extents (GdkFont *font,
647 void gdk_draw_point (GdkDrawable *drawable,
651 void gdk_draw_line (GdkDrawable *drawable,
657 void gdk_draw_rectangle (GdkDrawable *drawable,
664 void gdk_draw_arc (GdkDrawable *drawable,
673 void gdk_draw_polygon (GdkDrawable *drawable,
678 void gdk_draw_string (GdkDrawable *drawable,
683 const gchar *string);
684 void gdk_draw_text (GdkDrawable *drawable,
691 void gdk_draw_text_wc (GdkDrawable *drawable,
696 const GdkWChar *text,
698 void gdk_draw_pixmap (GdkDrawable *drawable,
707 void gdk_draw_bitmap (GdkDrawable *drawable,
716 void gdk_draw_image (GdkDrawable *drawable,
725 void gdk_draw_points (GdkDrawable *drawable,
729 void gdk_draw_segments (GdkDrawable *drawable,
733 void gdk_draw_lines (GdkDrawable *drawable,
743 gint gdk_selection_owner_set (GdkWindow *owner,
747 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
748 void gdk_selection_convert (GdkWindow *requestor,
752 gint gdk_selection_property_get (GdkWindow *requestor,
756 void gdk_selection_send_notify (guint32 requestor,
762 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
763 guchar *text, gint length,
765 void gdk_free_text_list (gchar **list);
766 gint gdk_string_to_compound_text (gchar *str,
767 GdkAtom *encoding, gint *format,
768 guchar **ctext, gint *length);
769 void gdk_free_compound_text (guchar *ctext);
773 GdkAtom gdk_atom_intern (const gchar *atom_name,
774 gint only_if_exists);
775 gchar* gdk_atom_name (GdkAtom atom);
776 gint gdk_property_get (GdkWindow *window,
782 GdkAtom *actual_property_type,
787 void gdk_property_change (GdkWindow *window,
794 void gdk_property_delete (GdkWindow *window,
798 /* Rectangle utilities
800 gint gdk_rectangle_intersect (GdkRectangle *src1,
803 void gdk_rectangle_union (GdkRectangle *src1,
810 void gdk_input_init (void);
811 void gdk_input_exit (void);
812 GList *gdk_input_list_devices (void);
813 void gdk_input_set_extension_events (GdkWindow *window,
815 GdkExtensionMode mode);
816 void gdk_input_set_source (guint32 deviceid,
817 GdkInputSource source);
818 gint gdk_input_set_mode (guint32 deviceid,
820 void gdk_input_set_axes (guint32 deviceid,
822 void gdk_input_set_key (guint32 deviceid,
825 GdkModifierType modifiers);
826 void gdk_input_window_get_pointer (GdkWindow *window,
833 GdkModifierType *mask);
835 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
839 gint *nevents_return);
841 /* International Input Method Support Functions
844 gint gdk_im_ready (void);
846 void gdk_im_begin (GdkIC *ic,
848 void gdk_im_end (void);
849 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
850 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
852 GdkIC* gdk_ic_new (GdkICAttr *attr,
853 GdkICAttributesType mask);
854 void gdk_ic_destroy (GdkIC *ic);
855 GdkIMStyle gdk_ic_get_style (GdkIC *ic);
856 GdkEventMask gdk_ic_get_events (GdkIC *ic);
858 GdkICAttr* gdk_ic_attr_new (void);
859 void gdk_ic_attr_destroy (GdkICAttr *attr);
861 GdkICAttributesType gdk_ic_set_attr (GdkIC *ic,
863 GdkICAttributesType mask);
864 GdkICAttributesType gdk_ic_get_attr (GdkIC *ic,
866 GdkICAttributesType mask);
868 /* Conversion functions between wide char and multibyte strings.
870 gchar *gdk_wcstombs (const GdkWChar *src);
871 gint gdk_mbstowcs (GdkWChar *dest,
878 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
879 GdkColormap *colormap);
881 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
882 GdkColormap *colormap);
884 void gdk_color_context_free (GdkColorContext *cc);
886 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
891 void gdk_color_context_get_pixels (GdkColorContext *cc,
898 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
907 gint gdk_color_context_query_color (GdkColorContext *cc,
909 gint gdk_color_context_query_colors (GdkColorContext *cc,
913 gint gdk_color_context_add_palette (GdkColorContext *cc,
917 void gdk_color_context_init_dither (GdkColorContext *cc);
918 void gdk_color_context_free_dither (GdkColorContext *cc);
920 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
925 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
933 GdkRegion* gdk_region_new (void);
934 void gdk_region_destroy (GdkRegion *region);
936 void gdk_region_get_clipbox(GdkRegion *region,
937 GdkRectangle *rectangle);
939 gboolean gdk_region_empty (GdkRegion *region);
940 gboolean gdk_region_equal (GdkRegion *region1,
942 gboolean gdk_region_point_in (GdkRegion *region,
945 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
948 GdkRegion* gdk_region_polygon (GdkPoint *points,
950 GdkFillRule fill_rule);
952 void gdk_region_offset (GdkRegion *region,
955 void gdk_region_shrink (GdkRegion *region,
959 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
961 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
963 GdkRegion* gdk_regions_union (GdkRegion *source1,
965 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
967 GdkRegion* gdk_regions_xor (GdkRegion *source1,
971 void gdk_event_send_clientmessage_toall (GdkEvent *event);
972 gboolean gdk_event_send_client_message (GdkEvent *event,
977 gchar* gdk_keyval_name (guint keyval);
978 guint gdk_keyval_from_name (const gchar *keyval_name);
979 guint gdk_keyval_to_upper (guint keyval);
980 guint gdk_keyval_to_lower (guint keyval);
981 gboolean gdk_keyval_is_upper (guint keyval);
982 gboolean gdk_keyval_is_lower (guint keyval);
987 extern GMutex *gdk_threads_mutex;
989 void gdk_threads_enter (void);
990 void gdk_threads_leave (void);
992 #ifdef G_THREADS_ENABLED
993 # define GDK_THREADS_ENTER() G_STMT_START { \
994 if (gdk_threads_mutex) \
995 g_mutex_lock (gdk_threads_mutex); \
997 # define GDK_THREADS_LEAVE() G_STMT_START { \
998 if (gdk_threads_mutex) \
999 g_mutex_unlock (gdk_threads_mutex); \
1001 #else /* !G_THREADS_ENABLED */
1002 # define GDK_THREADS_ENTER()
1003 # define GDK_THREADS_LEAVE()
1004 #endif /* !G_THREADS_ENABLED */
1006 #include <gdk/gdkrgb.h>
1010 #endif /* __cplusplus */
1013 #endif /* __GDK_H__ */