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);
45 guint32 gdk_event_get_time (GdkEvent *event);
47 void gdk_set_show_events (gint show_events);
48 void gdk_set_use_xshm (gint use_xshm);
50 gint gdk_get_show_events (void);
51 gint gdk_get_use_xshm (void);
52 gchar *gdk_get_display (void);
54 guint32 gdk_time_get (void);
55 guint32 gdk_timer_get (void);
56 void gdk_timer_set (guint32 milliseconds);
57 void gdk_timer_enable (void);
58 void gdk_timer_disable (void);
60 gint gdk_input_add_full (gint source,
61 GdkInputCondition condition,
62 GdkInputFunction function,
64 GdkDestroyNotify destroy);
65 #define gdk_input_add_interp gdk_input_add_full
66 gint gdk_input_add (gint source,
67 GdkInputCondition condition,
68 GdkInputFunction function,
70 void gdk_input_remove (gint tag);
72 gint gdk_pointer_grab (GdkWindow * window,
74 GdkEventMask event_mask,
75 GdkWindow * confine_to,
78 void gdk_pointer_ungrab (guint32 time);
80 gint gdk_keyboard_grab (GdkWindow * window,
83 void gdk_keyboard_ungrab (guint32 time);
85 gint gdk_pointer_is_grabbed (void);
87 gint gdk_screen_width (void);
88 gint gdk_screen_height (void);
90 gint gdk_screen_width_mm (void);
91 gint gdk_screen_height_mm (void);
93 void gdk_flush (void);
96 void gdk_key_repeat_disable (void);
97 void gdk_key_repeat_restore (void);
102 gint gdk_visual_get_best_depth (void);
103 GdkVisualType gdk_visual_get_best_type (void);
104 GdkVisual* gdk_visual_get_system (void);
105 GdkVisual* gdk_visual_get_best (void);
106 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
107 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
108 GdkVisual* gdk_visual_get_best_with_both (gint depth,
109 GdkVisualType visual_type);
111 /* Actually, these are no-ops... */
112 GdkVisual* gdk_visual_ref (GdkVisual *visual);
113 void gdk_visual_unref (GdkVisual *visual);
115 void gdk_query_depths (gint **depths,
117 void gdk_query_visual_types (GdkVisualType **visual_types,
120 GList* gdk_list_visuals (void);
125 GdkWindow* gdk_window_new (GdkWindow *parent,
126 GdkWindowAttr *attributes,
127 gint attributes_mask);
129 void gdk_window_destroy (GdkWindow *window);
130 GdkWindow* gdk_window_ref (GdkWindow *window);
131 void gdk_window_unref (GdkWindow *window);
133 GdkWindow* gdk_window_at_pointer (gint *win_x,
135 void gdk_window_show (GdkWindow *window);
136 void gdk_window_hide (GdkWindow *window);
137 void gdk_window_withdraw (GdkWindow *window);
138 void gdk_window_move (GdkWindow *window,
141 void gdk_window_resize (GdkWindow *window,
144 void gdk_window_move_resize (GdkWindow *window,
149 void gdk_window_reparent (GdkWindow *window,
150 GdkWindow *new_parent,
153 void gdk_window_clear (GdkWindow *window);
154 void gdk_window_clear_area (GdkWindow *window,
159 void gdk_window_clear_area_e(GdkWindow *window,
164 void gdk_window_copy_area (GdkWindow *window,
168 GdkWindow *source_window,
173 void gdk_window_raise (GdkWindow *window);
174 void gdk_window_lower (GdkWindow *window);
176 void gdk_window_set_user_data (GdkWindow *window,
178 void gdk_window_set_override_redirect(GdkWindow *window,
179 gboolean override_redirect);
181 void gdk_window_add_filter (GdkWindow *window,
182 GdkFilterFunc function,
184 void gdk_window_remove_filter (GdkWindow *window,
185 GdkFilterFunc function,
189 * This allows for making shaped (partially transparent) windows
190 * - cool feature, needed for Drag and Drag for example.
191 * The shape_mask can be the mask
192 * from gdk_pixmap_create_from_xpm. Stefan Wille
194 void gdk_window_shape_combine_mask (GdkWindow *window,
195 GdkBitmap *shape_mask,
199 * This routine allows you to quickly take the shapes of all the child windows
200 * of a window and use their shapes as the shape mask for this window - useful
201 * for container windows that dont want to look like a big box
205 void gdk_window_set_child_shapes (GdkWindow *window);
208 * This routine allows you to merge (ie ADD) child shapes to your
209 * own window's shape keeping its current shape and ADDING the shild
214 void gdk_window_merge_child_shapes (GdkWindow *window);
217 * The following function adds a global filter for all client
218 * messages of type message_type
220 void gdk_add_client_message_filter (GdkAtom message_type,
226 GdkDragContext * gdk_drag_context_new (void);
227 void gdk_drag_context_ref (GdkDragContext *context);
228 void gdk_drag_context_unref (GdkDragContext *context);
230 /* Destination side */
232 void gdk_drag_status (GdkDragContext *context,
233 GdkDragAction action,
235 void gdk_drop_reply (GdkDragContext *context,
238 void gdk_drop_finish (GdkDragContext *context,
241 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
245 GdkDragContext * gdk_drag_begin (GdkWindow *window,
247 GdkDragAction actions);
248 guint32 gdk_drag_get_protocol (guint32 xid,
249 GdkDragProtocol *protocol);
250 void gdk_drag_find_window (GdkDragContext *context,
251 GdkWindow *drag_window,
254 GdkWindow **dest_window,
255 GdkDragProtocol *protocol);
256 gboolean gdk_drag_motion (GdkDragContext *context,
257 GdkWindow *dest_window,
258 GdkDragProtocol protocol,
261 GdkDragAction action,
263 void gdk_drag_drop (GdkDragContext *context,
265 void gdk_drag_abort (GdkDragContext *context,
268 GdkAtom gdk_drag_get_selection (GdkDragContext *context);
272 void gdk_window_set_hints (GdkWindow *window,
280 void gdk_window_set_title (GdkWindow *window,
282 void gdk_window_set_background (GdkWindow *window,
284 void gdk_window_set_back_pixmap (GdkWindow *window,
286 gint parent_relative);
287 void gdk_window_set_cursor (GdkWindow *window,
289 void gdk_window_set_colormap (GdkWindow *window,
290 GdkColormap *colormap);
291 void gdk_window_get_user_data (GdkWindow *window,
293 void gdk_window_get_geometry (GdkWindow *window,
299 void gdk_window_get_position (GdkWindow *window,
302 void gdk_window_get_size (GdkWindow *window,
305 GdkVisual* gdk_window_get_visual (GdkWindow *window);
306 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
307 GdkWindowType gdk_window_get_type (GdkWindow *window);
308 gint gdk_window_get_origin (GdkWindow *window,
311 gint gdk_window_get_deskrelative_origin (GdkWindow *window,
314 void gdk_window_get_root_origin (GdkWindow *window,
317 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
320 GdkModifierType *mask);
321 GdkWindow* gdk_window_get_parent (GdkWindow *window);
322 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
323 GList* gdk_window_get_children (GdkWindow *window);
324 GdkEventMask gdk_window_get_events (GdkWindow *window);
325 void gdk_window_set_events (GdkWindow *window,
326 GdkEventMask event_mask);
328 void gdk_window_set_icon (GdkWindow *window,
329 GdkWindow *icon_window,
332 void gdk_window_set_icon_name (GdkWindow *window,
334 void gdk_window_set_group (GdkWindow *window,
336 void gdk_window_set_decorations (GdkWindow *window,
337 GdkWMDecoration decorations);
338 void gdk_window_set_functions (GdkWindow *window,
339 GdkWMFunction functions);
340 GList * gdk_window_get_toplevels (void);
342 void gdk_window_register_dnd (GdkWindow *window);
344 void gdk_drawable_set_data (GdkDrawable *drawable,
347 GDestroyNotify destroy_func);
352 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
353 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
359 void gdk_cursor_destroy (GdkCursor *cursor);
364 GdkGC* gdk_gc_new (GdkWindow *window);
365 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
367 GdkGCValuesMask values_mask);
368 GdkGC* gdk_gc_ref (GdkGC *gc);
369 void gdk_gc_unref (GdkGC *gc);
370 void gdk_gc_destroy (GdkGC *gc);
371 void gdk_gc_get_values (GdkGC *gc,
372 GdkGCValues *values);
373 void gdk_gc_set_foreground (GdkGC *gc,
375 void gdk_gc_set_background (GdkGC *gc,
377 void gdk_gc_set_font (GdkGC *gc,
379 void gdk_gc_set_function (GdkGC *gc,
380 GdkFunction function);
381 void gdk_gc_set_fill (GdkGC *gc,
383 void gdk_gc_set_tile (GdkGC *gc,
385 void gdk_gc_set_stipple (GdkGC *gc,
387 void gdk_gc_set_ts_origin (GdkGC *gc,
390 void gdk_gc_set_clip_origin (GdkGC *gc,
393 void gdk_gc_set_clip_mask (GdkGC *gc,
395 void gdk_gc_set_clip_rectangle (GdkGC *gc,
396 GdkRectangle *rectangle);
397 void gdk_gc_set_clip_region (GdkGC *gc,
399 void gdk_gc_set_subwindow (GdkGC *gc,
400 GdkSubwindowMode mode);
401 void gdk_gc_set_exposures (GdkGC *gc,
403 void gdk_gc_set_line_attributes (GdkGC *gc,
405 GdkLineStyle line_style,
406 GdkCapStyle cap_style,
407 GdkJoinStyle join_style);
408 void gdk_gc_set_dashes (GdkGC *gc,
412 void gdk_gc_copy (GdkGC *dst_gc,
418 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
422 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
426 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
433 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
435 GdkColor *transparent_color,
436 const gchar *filename);
437 GdkPixmap* gdk_pixmap_colormap_create_from_xpm
439 GdkColormap *colormap,
441 GdkColor *transparent_color,
442 const gchar *filename);
443 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
445 GdkColor *transparent_color,
447 GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
449 GdkColormap *colormap,
451 GdkColor *transparent_color,
453 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
454 void gdk_pixmap_unref (GdkPixmap *pixmap);
456 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
457 void gdk_bitmap_unref (GdkBitmap *pixmap);
462 GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
466 GdkImage* gdk_image_new (GdkImageType type,
470 GdkImage* gdk_image_get (GdkWindow *window,
475 void gdk_image_put_pixel (GdkImage *image,
479 guint32 gdk_image_get_pixel (GdkImage *image,
482 void gdk_image_destroy (GdkImage *image);
487 GdkColormap* gdk_colormap_new (GdkVisual *visual,
489 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
490 void gdk_colormap_unref (GdkColormap *cmap);
492 GdkColormap* gdk_colormap_get_system (void);
493 gint gdk_colormap_get_system_size (void);
495 void gdk_colormap_change (GdkColormap *colormap,
499 gint gdk_colormap_alloc_colors (GdkColormap *colormap,
505 gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
508 gboolean best_match);
509 void gdk_colormap_free_colors (GdkColormap *colormap,
513 GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
515 GdkColor *gdk_color_copy (GdkColor *color);
516 void gdk_color_free (GdkColor *color);
518 gint gdk_color_parse (const gchar *spec,
520 guint gdk_color_hash (const GdkColor *colora,
521 const GdkColor *colorb);
522 gint gdk_color_equal (const GdkColor *colora,
523 const GdkColor *colorb);
526 /* The following functions are deprecated */
527 void gdk_colors_store (GdkColormap *colormap,
530 gint gdk_colors_alloc (GdkColormap *colormap,
536 void gdk_colors_free (GdkColormap *colormap,
540 gint gdk_color_white (GdkColormap *colormap,
542 gint gdk_color_black (GdkColormap *colormap,
544 gint gdk_color_alloc (GdkColormap *colormap,
546 gint gdk_color_change (GdkColormap *colormap,
552 GdkFont* gdk_font_load (const gchar *font_name);
553 GdkFont* gdk_fontset_load (gchar *fontset_name);
554 GdkFont* gdk_font_ref (GdkFont *font);
555 void gdk_font_unref (GdkFont *font);
556 gint gdk_font_id (const GdkFont *font);
557 gint gdk_font_equal (const GdkFont *fonta,
558 const GdkFont *fontb);
559 gint gdk_string_width (GdkFont *font,
560 const gchar *string);
561 gint gdk_text_width (GdkFont *font,
564 gint gdk_char_width (GdkFont *font,
566 gint gdk_string_measure (GdkFont *font,
567 const gchar *string);
568 gint gdk_text_measure (GdkFont *font,
571 gint gdk_char_measure (GdkFont *font,
573 gint gdk_string_height (GdkFont *font,
574 const gchar *string);
575 gint gdk_text_height (GdkFont *font,
578 gint gdk_char_height (GdkFont *font,
581 void gdk_text_extents (GdkFont *font,
589 void gdk_string_extents (GdkFont *font,
599 void gdk_draw_point (GdkDrawable *drawable,
603 void gdk_draw_line (GdkDrawable *drawable,
609 void gdk_draw_rectangle (GdkDrawable *drawable,
616 void gdk_draw_arc (GdkDrawable *drawable,
625 void gdk_draw_polygon (GdkDrawable *drawable,
630 void gdk_draw_string (GdkDrawable *drawable,
635 const gchar *string);
636 void gdk_draw_text (GdkDrawable *drawable,
643 void gdk_draw_pixmap (GdkDrawable *drawable,
652 void gdk_draw_bitmap (GdkDrawable *drawable,
661 void gdk_draw_image (GdkDrawable *drawable,
670 void gdk_draw_points (GdkDrawable *drawable,
674 void gdk_draw_segments (GdkDrawable *drawable,
678 void gdk_draw_lines (GdkDrawable *drawable,
688 gint gdk_selection_owner_set (GdkWindow *owner,
692 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
693 void gdk_selection_convert (GdkWindow *requestor,
697 gint gdk_selection_property_get (GdkWindow *requestor,
701 void gdk_selection_send_notify (guint32 requestor,
707 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
708 guchar *text, gint length,
710 void gdk_free_text_list (gchar **list);
711 gint gdk_string_to_compound_text (gchar *str,
712 GdkAtom *encoding, gint *format,
713 guchar **ctext, gint *length);
714 void gdk_free_compound_text (guchar *ctext);
718 GdkAtom gdk_atom_intern (const gchar *atom_name,
719 gint only_if_exists);
720 gchar* gdk_atom_name (GdkAtom atom);
721 gint gdk_property_get (GdkWindow *window,
727 GdkAtom *actual_property_type,
732 void gdk_property_change (GdkWindow *window,
739 void gdk_property_delete (GdkWindow *window,
743 /* Rectangle utilities
745 gint gdk_rectangle_intersect (GdkRectangle *src1,
748 void gdk_rectangle_union (GdkRectangle *src1,
755 void gdk_input_init (void);
756 void gdk_input_exit (void);
757 GList *gdk_input_list_devices (void);
758 void gdk_input_set_extension_events (GdkWindow *window,
760 GdkExtensionMode mode);
761 void gdk_input_set_source (guint32 deviceid,
762 GdkInputSource source);
763 gint gdk_input_set_mode (guint32 deviceid,
765 void gdk_input_set_axes (guint32 deviceid,
767 void gdk_input_set_key (guint32 deviceid,
770 GdkModifierType modifiers);
771 void gdk_input_window_get_pointer (GdkWindow *window,
778 GdkModifierType *mask);
780 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
784 gint *nevents_return);
786 /* International Input Method Support Functions
789 gint gdk_im_ready (void);
791 void gdk_im_begin (GdkIC ic,
793 void gdk_im_end (void);
794 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
795 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
796 GdkIC gdk_ic_new (GdkWindow* client_window,
797 GdkWindow* focus_window,
798 GdkIMStyle style, ...);
799 void gdk_ic_destroy (GdkIC ic);
800 GdkIMStyle gdk_ic_get_style (GdkIC ic);
801 void gdk_ic_set_values (GdkIC ic,
803 void gdk_ic_get_values (GdkIC ic,
805 void gdk_ic_set_attr (GdkIC ic,
806 const char *target, ...);
807 void gdk_ic_get_attr (GdkIC ic,
808 const char *target, ...);
809 GdkEventMask gdk_ic_get_events (GdkIC ic);
813 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
814 GdkColormap *colormap);
816 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
817 GdkColormap *colormap);
819 void gdk_color_context_free (GdkColorContext *cc);
821 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
826 void gdk_color_context_get_pixels (GdkColorContext *cc,
833 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
842 gint gdk_color_context_query_color (GdkColorContext *cc,
844 gint gdk_color_context_query_colors (GdkColorContext *cc,
848 gint gdk_color_context_add_palette (GdkColorContext *cc,
852 void gdk_color_context_init_dither (GdkColorContext *cc);
853 void gdk_color_context_free_dither (GdkColorContext *cc);
855 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
860 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
868 GdkRegion* gdk_region_new (void);
869 void gdk_region_destroy (GdkRegion *region);
871 void gdk_region_get_clipbox(GdkRegion *region,
872 GdkRectangle *rectangle);
874 gboolean gdk_region_empty (GdkRegion *region);
875 gboolean gdk_region_equal (GdkRegion *region1,
877 gboolean gdk_region_point_in (GdkRegion *region,
880 GdkOverlapType gdk_region_rect_in (GdkRegion *region,
883 GdkRegion* gdk_region_polygon (GdkPoint *points,
885 GdkFillRule fill_rule);
887 void gdk_region_offset (GdkRegion *region,
890 void gdk_region_shrink (GdkRegion *region,
894 GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
896 GdkRegion* gdk_regions_intersect (GdkRegion *source1,
898 GdkRegion* gdk_regions_union (GdkRegion *source1,
900 GdkRegion* gdk_regions_subtract (GdkRegion *source1,
902 GdkRegion* gdk_regions_xor (GdkRegion *source1,
908 gboolean gdk_threads_init (void);
909 void gdk_threads_enter (void);
910 void gdk_threads_leave (void);
912 /* If the mainloop thread is in its select, wake it up.
913 * For GTK's idle handling
915 void gdk_threads_wake (void);
918 void gdk_event_send_clientmessage_toall (GdkEvent *event);
919 gboolean gdk_event_send_client_message (GdkEvent *event,
924 gchar* gdk_keyval_name (guint keyval);
925 guint gdk_keyval_from_name (const gchar *keyval_name);
926 guint gdk_keyval_to_upper (guint keyval);
927 guint gdk_keyval_to_lower (guint keyval);
928 gboolean gdk_keyval_is_upper (guint keyval);
929 gboolean gdk_keyval_is_lower (guint keyval);
932 #include <gdk/gdkrgb.h>
936 #endif /* __cplusplus */
939 #endif /* __GDK_H__ */