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 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);
44 guint32 gdk_event_get_time (GdkEvent *event);
46 void gdk_event_handler_set (GdkEventFunc func,
48 GDestroyNotify notify);
50 void gdk_set_show_events (gint show_events);
51 void gdk_set_use_xshm (gint use_xshm);
53 gint gdk_get_show_events (void);
54 gint gdk_get_use_xshm (void);
55 gchar *gdk_get_display (void);
57 guint32 gdk_time_get (void);
58 guint32 gdk_timer_get (void);
59 void gdk_timer_set (guint32 milliseconds);
60 void gdk_timer_enable (void);
61 void gdk_timer_disable (void);
63 gint gdk_input_add_full (gint source,
64 GdkInputCondition condition,
65 GdkInputFunction function,
67 GdkDestroyNotify destroy);
68 #define gdk_input_add_interp gdk_input_add_full
69 gint gdk_input_add (gint source,
70 GdkInputCondition condition,
71 GdkInputFunction function,
73 void gdk_input_remove (gint tag);
75 gint gdk_pointer_grab (GdkWindow * window,
77 GdkEventMask event_mask,
78 GdkWindow * confine_to,
81 void gdk_pointer_ungrab (guint32 time);
83 gint gdk_keyboard_grab (GdkWindow * window,
86 void gdk_keyboard_ungrab (guint32 time);
88 gint gdk_pointer_is_grabbed (void);
90 gint gdk_screen_width (void);
91 gint gdk_screen_height (void);
93 gint gdk_screen_width_mm (void);
94 gint gdk_screen_height_mm (void);
96 void gdk_flush (void);
99 void gdk_key_repeat_disable (void);
100 void gdk_key_repeat_restore (void);
105 gint gdk_visual_get_best_depth (void);
106 GdkVisualType gdk_visual_get_best_type (void);
107 GdkVisual* gdk_visual_get_system (void);
108 GdkVisual* gdk_visual_get_best (void);
109 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
110 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
111 GdkVisual* gdk_visual_get_best_with_both (gint depth,
112 GdkVisualType visual_type);
114 /* Actually, these are no-ops... */
115 GdkVisual* gdk_visual_ref (GdkVisual *visual);
116 void gdk_visual_unref (GdkVisual *visual);
118 void gdk_query_depths (gint **depths,
120 void gdk_query_visual_types (GdkVisualType **visual_types,
123 GList* gdk_list_visuals (void);
128 GdkWindow* gdk_window_new (GdkWindow *parent,
129 GdkWindowAttr *attributes,
130 gint attributes_mask);
132 void gdk_window_destroy (GdkWindow *window);
133 GdkWindow* gdk_window_ref (GdkWindow *window);
134 void gdk_window_unref (GdkWindow *window);
136 GdkWindow* gdk_window_at_pointer (gint *win_x,
138 void gdk_window_show (GdkWindow *window);
139 void gdk_window_hide (GdkWindow *window);
140 void gdk_window_withdraw (GdkWindow *window);
141 void gdk_window_move (GdkWindow *window,
144 void gdk_window_resize (GdkWindow *window,
147 void gdk_window_move_resize (GdkWindow *window,
152 void gdk_window_reparent (GdkWindow *window,
153 GdkWindow *new_parent,
156 void gdk_window_clear (GdkWindow *window);
157 void gdk_window_clear_area (GdkWindow *window,
162 void gdk_window_clear_area_e(GdkWindow *window,
167 void gdk_window_copy_area (GdkWindow *window,
171 GdkWindow *source_window,
176 void gdk_window_raise (GdkWindow *window);
177 void gdk_window_lower (GdkWindow *window);
179 void gdk_window_set_user_data (GdkWindow *window,
181 void gdk_window_set_override_redirect(GdkWindow *window,
182 gboolean override_redirect);
184 void gdk_window_add_filter (GdkWindow *window,
185 GdkFilterFunc function,
187 void gdk_window_remove_filter (GdkWindow *window,
188 GdkFilterFunc function,
192 * This allows for making shaped (partially transparent) windows
193 * - cool feature, needed for Drag and Drag for example.
194 * The shape_mask can be the mask
195 * from gdk_pixmap_create_from_xpm. Stefan Wille
197 void gdk_window_shape_combine_mask (GdkWindow *window,
198 GdkBitmap *shape_mask,
202 * This routine allows you to quickly take the shapes of all the child windows
203 * of a window and use their shapes as the shape mask for this window - useful
204 * for container windows that dont want to look like a big box
208 void gdk_window_set_child_shapes (GdkWindow *window);
211 * This routine allows you to merge (ie ADD) child shapes to your
212 * own window's shape keeping its current shape and ADDING the shild
217 void gdk_window_merge_child_shapes (GdkWindow *window);
220 * The following function adds a global filter for all client
221 * messages of type message_type
223 void gdk_add_client_message_filter (GdkAtom message_type,
229 GdkDragContext * gdk_drag_context_new (void);
230 void gdk_drag_context_ref (GdkDragContext *context);
231 void gdk_drag_context_unref (GdkDragContext *context);
233 /* Destination side */
235 void gdk_drag_status (GdkDragContext *context,
236 GdkDragAction action,
238 void gdk_drop_reply (GdkDragContext *context,
241 void gdk_drop_finish (GdkDragContext *context,
244 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
248 GdkDragContext * gdk_drag_begin (GdkWindow *window,
250 GdkDragAction actions);
251 guint32 gdk_drag_get_protocol (guint32 xid,
252 GdkDragProtocol *protocol);
253 void gdk_drag_find_window (GdkDragContext *context,
254 GdkWindow *drag_window,
257 GdkWindow **dest_window,
258 GdkDragProtocol *protocol);
259 gboolean gdk_drag_motion (GdkDragContext *context,
260 GdkWindow *dest_window,
261 GdkDragProtocol protocol,
264 GdkDragAction action,
266 void gdk_drag_drop (GdkDragContext *context,
268 void gdk_drag_abort (GdkDragContext *context,
271 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
275 void gdk_window_set_hints (GdkWindow *window,
283 void gdk_window_set_geometry_hints (GdkWindow *window,
284 GdkGeometry *geometry,
285 GdkWindowHints flags);
286 void gdk_set_sm_client_id (const gchar *sm_client_id);
289 void gdk_window_set_title (GdkWindow *window,
291 void gdk_window_set_role (GdkWindow *window,
293 void gdk_window_set_transient_for (GdkWindow *window,
295 void gdk_window_set_background (GdkWindow *window,
297 void gdk_window_set_back_pixmap (GdkWindow *window,
299 gint parent_relative);
300 void gdk_window_set_cursor (GdkWindow *window,
302 void gdk_window_set_colormap (GdkWindow *window,
303 GdkColormap *colormap);
304 void gdk_window_get_user_data (GdkWindow *window,
306 void gdk_window_get_geometry (GdkWindow *window,
312 void gdk_window_get_position (GdkWindow *window,
315 void gdk_window_get_size (GdkWindow *window,
318 GdkVisual* gdk_window_get_visual (GdkWindow *window);
319 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
320 GdkWindowType gdk_window_get_type (GdkWindow *window);
321 gint gdk_window_get_origin (GdkWindow *window,
324 gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,
327 void gdk_window_get_root_origin (GdkWindow *window,
330 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
333 GdkModifierType *mask);
334 GdkWindow* gdk_window_get_parent (GdkWindow *window);
335 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
336 GList* gdk_window_get_children (GdkWindow *window);
337 GdkEventMask gdk_window_get_events (GdkWindow *window);
338 void gdk_window_set_events (GdkWindow *window,
339 GdkEventMask event_mask);
341 void gdk_window_set_icon (GdkWindow *window,
342 GdkWindow *icon_window,
345 void gdk_window_set_icon_name (GdkWindow *window,
347 void gdk_window_set_group (GdkWindow *window,
349 void gdk_window_set_decorations (GdkWindow *window,
350 GdkWMDecoration decorations);
351 void gdk_window_set_functions (GdkWindow *window,
352 GdkWMFunction functions);
353 GList * gdk_window_get_toplevels (void);
355 void gdk_window_register_dnd (GdkWindow *window);
357 void gdk_drawable_set_data (GdkDrawable *drawable,
360 GDestroyNotify destroy_func);
365 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
366 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
372 void gdk_cursor_destroy (GdkCursor *cursor);
377 GdkGC* gdk_gc_new (GdkWindow *window);
378 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
380 GdkGCValuesMask values_mask);
381 GdkGC* gdk_gc_ref (GdkGC *gc);
382 void gdk_gc_unref (GdkGC *gc);
383 void gdk_gc_destroy (GdkGC *gc);
384 void gdk_gc_get_values (GdkGC *gc,
385 GdkGCValues *values);
386 void gdk_gc_set_foreground (GdkGC *gc,
388 void gdk_gc_set_background (GdkGC *gc,
390 void gdk_gc_set_font (GdkGC *gc,
392 void gdk_gc_set_function (GdkGC *gc,
393 GdkFunction function);
394 void gdk_gc_set_fill (GdkGC *gc,
396 void gdk_gc_set_tile (GdkGC *gc,
398 void gdk_gc_set_stipple (GdkGC *gc,
400 void gdk_gc_set_ts_origin (GdkGC *gc,
403 void gdk_gc_set_clip_origin (GdkGC *gc,
406 void gdk_gc_set_clip_mask (GdkGC *gc,
408 void gdk_gc_set_clip_rectangle (GdkGC *gc,
409 GdkRectangle *rectangle);
410 void gdk_gc_set_clip_region (GdkGC *gc,
412 void gdk_gc_set_subwindow (GdkGC *gc,
413 GdkSubwindowMode mode);
414 void gdk_gc_set_exposures (GdkGC *gc,
416 void gdk_gc_set_line_attributes (GdkGC *gc,
418 GdkLineStyle line_style,
419 GdkCapStyle cap_style,
420 GdkJoinStyle join_style);
421 void gdk_gc_set_dashes (GdkGC *gc,
425 void gdk_gc_copy (GdkGC *dst_gc,
431 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
435 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
439 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
446 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
448 GdkColor *transparent_color,
449 const gchar *filename);
450 GdkPixmap* gdk_pixmap_colormap_create_from_xpm
452 GdkColormap *colormap,
454 GdkColor *transparent_color,
455 const gchar *filename);
456 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
458 GdkColor *transparent_color,
460 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
462 GdkColormap *colormap,
464 GdkColor *transparent_color,
466 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
467 void gdk_pixmap_unref (GdkPixmap *pixmap);
469 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
470 void gdk_bitmap_unref (GdkBitmap *pixmap);
475 GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
479 GdkImage* gdk_image_new (GdkImageType type,
483 GdkImage* gdk_image_get (GdkWindow *window,
488 void gdk_image_put_pixel (GdkImage *image,
492 guint32 gdk_image_get_pixel (GdkImage *image,
495 void gdk_image_destroy (GdkImage *image);
500 GdkColormap* gdk_colormap_new (GdkVisual *visual,
502 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
503 void gdk_colormap_unref (GdkColormap *cmap);
505 GdkColormap* gdk_colormap_get_system (void);
506 gint gdk_colormap_get_system_size (void);
508 void gdk_colormap_change (GdkColormap *colormap,
512 gint gdk_colormap_alloc_colors (GdkColormap *colormap,
518 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
521 gboolean best_match);
522 void gdk_colormap_free_colors (GdkColormap *colormap,
526 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
528 GdkColor *gdk_color_copy (GdkColor *color);
529 void gdk_color_free (GdkColor *color);
531 gint gdk_color_parse (const gchar *spec,
533 guint gdk_color_hash (const GdkColor *colora,
534 const GdkColor *colorb);
535 gint gdk_color_equal (const GdkColor *colora,
536 const GdkColor *colorb);
539 /* The following functions are deprecated */
540 void gdk_colors_store (GdkColormap *colormap,
543 gint gdk_colors_alloc (GdkColormap *colormap,
549 void gdk_colors_free (GdkColormap *colormap,
553 gint gdk_color_white (GdkColormap *colormap,
555 gint gdk_color_black (GdkColormap *colormap,
557 gint gdk_color_alloc (GdkColormap *colormap,
559 gint gdk_color_change (GdkColormap *colormap,
565 GdkFont* gdk_font_load (const gchar *font_name);
566 GdkFont* gdk_fontset_load (gchar *fontset_name);
567 GdkFont* gdk_font_ref (GdkFont *font);
568 void gdk_font_unref (GdkFont *font);
569 gint gdk_font_id (const GdkFont *font);
570 gint gdk_font_equal (const GdkFont *fonta,
571 const GdkFont *fontb);
572 gint gdk_string_width (GdkFont *font,
573 const gchar *string);
574 gint gdk_text_width (GdkFont *font,
577 gint gdk_text_width_wc (GdkFont *font,
578 const GdkWChar *text,
580 gint gdk_char_width (GdkFont *font,
582 gint gdk_char_width_wc (GdkFont *font,
584 gint gdk_string_measure (GdkFont *font,
585 const gchar *string);
586 gint gdk_text_measure (GdkFont *font,
589 gint gdk_char_measure (GdkFont *font,
591 gint gdk_string_height (GdkFont *font,
592 const gchar *string);
593 gint gdk_text_height (GdkFont *font,
596 gint gdk_char_height (GdkFont *font,
599 void gdk_text_extents (GdkFont *font,
607 void gdk_text_extents_wc (GdkFont *font,
608 const GdkWChar *text,
615 void gdk_string_extents (GdkFont *font,
625 void gdk_draw_point (GdkDrawable *drawable,
629 void gdk_draw_line (GdkDrawable *drawable,
635 void gdk_draw_rectangle (GdkDrawable *drawable,
642 void gdk_draw_arc (GdkDrawable *drawable,
651 void gdk_draw_polygon (GdkDrawable *drawable,
656 void gdk_draw_string (GdkDrawable *drawable,
661 const gchar *string);
662 void gdk_draw_text (GdkDrawable *drawable,
669 void gdk_draw_text_wc (GdkDrawable *drawable,
674 const GdkWChar *text,
676 void gdk_draw_pixmap (GdkDrawable *drawable,
685 void gdk_draw_bitmap (GdkDrawable *drawable,
694 void gdk_draw_image (GdkDrawable *drawable,
703 void gdk_draw_points (GdkDrawable *drawable,
707 void gdk_draw_segments (GdkDrawable *drawable,
711 void gdk_draw_lines (GdkDrawable *drawable,
721 gint gdk_selection_owner_set (GdkWindow *owner,
725 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
726 void gdk_selection_convert (GdkWindow *requestor,
730 gint gdk_selection_property_get (GdkWindow *requestor,
734 void gdk_selection_send_notify (guint32 requestor,
740 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
741 guchar *text, gint length,
743 void gdk_free_text_list (gchar **list);
744 gint gdk_string_to_compound_text (gchar *str,
745 GdkAtom *encoding, gint *format,
746 guchar **ctext, gint *length);
747 void gdk_free_compound_text (guchar *ctext);
751 GdkAtom gdk_atom_intern (const gchar *atom_name,
752 gint only_if_exists);
753 gchar* gdk_atom_name (GdkAtom atom);
754 gint gdk_property_get (GdkWindow *window,
760 GdkAtom *actual_property_type,
765 void gdk_property_change (GdkWindow *window,
772 void gdk_property_delete (GdkWindow *window,
776 /* Rectangle utilities
778 gint gdk_rectangle_intersect (GdkRectangle *src1,
781 void gdk_rectangle_union (GdkRectangle *src1,
788 void gdk_input_init (void);
789 void gdk_input_exit (void);
790 GList *gdk_input_list_devices (void);
791 void gdk_input_set_extension_events (GdkWindow *window,
793 GdkExtensionMode mode);
794 void gdk_input_set_source (guint32 deviceid,
795 GdkInputSource source);
796 gint gdk_input_set_mode (guint32 deviceid,
798 void gdk_input_set_axes (guint32 deviceid,
800 void gdk_input_set_key (guint32 deviceid,
803 GdkModifierType modifiers);
804 void gdk_input_window_get_pointer (GdkWindow *window,
811 GdkModifierType *mask);
813 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
817 gint *nevents_return);
819 /* International Input Method Support Functions
822 gint gdk_im_ready (void);
824 void gdk_im_begin (GdkIC *ic,
826 void gdk_im_end (void);
827 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
828 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
830 GdkIC* gdk_ic_new (GdkICAttr *attr,
831 GdkICAttributesType mask);
832 void gdk_ic_destroy (GdkIC *ic);
833 GdkIMStyle gdk_ic_get_style (GdkIC *ic);
834 GdkEventMask gdk_ic_get_events (GdkIC *ic);
836 GdkICAttr* gdk_ic_attr_new (void);
837 void gdk_ic_attr_destroy (GdkICAttr *attr);
839 GdkICAttributesType gdk_ic_set_attr (GdkIC *ic,
841 GdkICAttributesType mask);
842 GdkICAttributesType gdk_ic_get_attr (GdkIC *ic,
844 GdkICAttributesType mask);
846 /* Conversion functions between wide char and multibyte strings.
848 gchar *gdk_wcstombs (const GdkWChar *src);
849 gint gdk_mbstowcs (GdkWChar *dest,
856 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
857 GdkColormap *colormap);
859 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
860 GdkColormap *colormap);
862 void gdk_color_context_free (GdkColorContext *cc);
864 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
869 void gdk_color_context_get_pixels (GdkColorContext *cc,
876 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
885 gint gdk_color_context_query_color (GdkColorContext *cc,
887 gint gdk_color_context_query_colors (GdkColorContext *cc,
891 gint gdk_color_context_add_palette (GdkColorContext *cc,
895 void gdk_color_context_init_dither (GdkColorContext *cc);
896 void gdk_color_context_free_dither (GdkColorContext *cc);
898 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
903 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
911 GdkRegion* gdk_region_new (void);
912 void gdk_region_destroy (GdkRegion *region);
914 void gdk_region_get_clipbox(GdkRegion *region,
915 GdkRectangle *rectangle);
917 gboolean gdk_region_empty (GdkRegion *region);
918 gboolean gdk_region_equal (GdkRegion *region1,
920 gboolean gdk_region_point_in (GdkRegion *region,
923 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
926 GdkRegion* gdk_region_polygon (GdkPoint *points,
928 GdkFillRule fill_rule);
930 void gdk_region_offset (GdkRegion *region,
933 void gdk_region_shrink (GdkRegion *region,
937 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
939 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
941 GdkRegion* gdk_regions_union (GdkRegion *source1,
943 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
945 GdkRegion* gdk_regions_xor (GdkRegion *source1,
949 void gdk_event_send_clientmessage_toall (GdkEvent *event);
950 gboolean gdk_event_send_client_message (GdkEvent *event,
955 gchar* gdk_keyval_name (guint keyval);
956 guint gdk_keyval_from_name (const gchar *keyval_name);
957 guint gdk_keyval_to_upper (guint keyval);
958 guint gdk_keyval_to_lower (guint keyval);
959 gboolean gdk_keyval_is_upper (guint keyval);
960 gboolean gdk_keyval_is_lower (guint keyval);
963 #include <gdk/gdkrgb.h>
967 #endif /* __cplusplus */
970 #endif /* __GDK_H__ */