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_debug_level (gint level);
46 void gdk_set_show_events (gint show_events);
47 void gdk_set_use_xshm (gint use_xshm);
49 gint gdk_get_debug_level (void);
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_interp (gint source,
61 GdkInputCondition condition,
62 GdkInputFunction function,
64 GdkDestroyNotify destroy);
65 gint gdk_input_add (gint source,
66 GdkInputCondition condition,
67 GdkInputFunction function,
69 void gdk_input_remove (gint tag);
71 gint gdk_pointer_grab (GdkWindow * window,
73 GdkEventMask event_mask,
74 GdkWindow * confine_to,
77 void gdk_pointer_ungrab (guint32 time);
79 gint gdk_keyboard_grab (GdkWindow * window,
82 void gdk_keyboard_ungrab (guint32 time);
84 gint gdk_screen_width (void);
85 gint gdk_screen_height (void);
87 void gdk_flush (void);
90 void gdk_key_repeat_disable (void);
91 void gdk_key_repeat_restore (void);
96 gint gdk_visual_get_best_depth (void);
97 GdkVisualType gdk_visual_get_best_type (void);
98 GdkVisual* gdk_visual_get_system (void);
99 GdkVisual* gdk_visual_get_best (void);
100 GdkVisual* gdk_visual_get_best_with_depth (gint depth);
101 GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
102 GdkVisual* gdk_visual_get_best_with_both (gint depth,
103 GdkVisualType visual_type);
105 /* Actually, these are no-ops... */
106 GdkVisual* gdk_visual_ref (GdkVisual *visual);
107 void gdk_visual_unref (GdkVisual *visual);
109 void gdk_query_depths (gint **depths,
111 void gdk_query_visual_types (GdkVisualType **visual_types,
113 void gdk_query_visuals (GdkVisual **visuals,
119 GdkWindow* gdk_window_new (GdkWindow *parent,
120 GdkWindowAttr *attributes,
121 gint attributes_mask);
123 GdkWindow * gdk_window_foreign_new (guint32 anid);
124 void gdk_window_destroy (GdkWindow *window);
125 GdkWindow* gdk_window_ref (GdkWindow *window);
126 void gdk_window_unref (GdkWindow *window);
128 void gdk_window_show (GdkWindow *window);
129 void gdk_window_hide (GdkWindow *window);
130 void gdk_window_move (GdkWindow *window,
133 void gdk_window_resize (GdkWindow *window,
136 void gdk_window_move_resize (GdkWindow *window,
141 void gdk_window_reparent (GdkWindow *window,
142 GdkWindow *new_parent,
145 void gdk_window_clear (GdkWindow *window);
146 void gdk_window_clear_area (GdkWindow *window,
151 void gdk_window_clear_area_e(GdkWindow *window,
156 void gdk_window_copy_area (GdkWindow *window,
160 GdkWindow *source_window,
165 void gdk_window_raise (GdkWindow *window);
166 void gdk_window_lower (GdkWindow *window);
168 void gdk_window_set_user_data (GdkWindow *window,
170 void gdk_window_set_override_redirect(GdkWindow *window,
171 gboolean override_redirect);
173 void gdk_window_add_filter (GdkWindow *window,
174 GdkFilterFunc function,
176 void gdk_window_remove_filter (GdkWindow *window,
177 GdkFilterFunc function,
181 * This allows for making shaped (partially transparent) windows
182 * - cool feature, needed for Drag and Drag for example.
183 * The shape_mask can be the mask
184 * from gdk_pixmap_create_from_xpm. Stefan Wille
186 void gdk_window_shape_combine_mask (GdkWindow *window,
187 GdkBitmap *shape_mask,
193 * Algorithm (drop source):
194 * A window being dragged will be sent a GDK_DRAG_BEGIN message.
195 * It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
197 * When we get a DROP_ENTER incoming, we send it on to the window in question.
198 * That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
199 * things (it must call that even if it's not going to accept the drop)
201 * These two turn on/off drag or drop, and if enabling it also
202 * sets the list of types supported. The list of types passed in
203 * should be in order of decreasing preference.
205 void gdk_window_dnd_drag_set (GdkWindow *window,
211 *XXX todo: add a GDK_DROP_ENTER which can look at actual data
213 void gdk_window_dnd_drop_set (GdkWindow *window,
217 guint8 destructive_op);
220 * This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
221 * file manager where multiple icons were selected and the drag began.
222 * The icon that the drag actually began on would gdk_dnd_drag_addwindow
223 * for all the other icons that were being dragged...
225 void gdk_dnd_drag_addwindow (GdkWindow *window);
226 void gdk_window_dnd_data_set (GdkWindow *window,
229 gulong data_numbytes);
232 void gdk_window_set_hints (GdkWindow *window,
240 void gdk_window_set_title (GdkWindow *window,
242 void gdk_window_set_background (GdkWindow *window,
244 void gdk_window_set_back_pixmap (GdkWindow *window,
246 gint parent_relative);
247 void gdk_window_set_cursor (GdkWindow *window,
249 void gdk_window_set_colormap (GdkWindow *window,
250 GdkColormap *colormap);
251 void gdk_window_get_user_data (GdkWindow *window,
253 void gdk_window_get_geometry (GdkWindow *window,
259 void gdk_window_get_position (GdkWindow *window,
262 void gdk_window_get_size (GdkWindow *window,
265 GdkVisual* gdk_window_get_visual (GdkWindow *window);
266 GdkColormap* gdk_window_get_colormap (GdkWindow *window);
267 GdkWindowType gdk_window_get_type (GdkWindow *window);
268 gint gdk_window_get_origin (GdkWindow *window,
271 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
274 GdkModifierType *mask);
275 GdkWindow* gdk_window_get_parent (GdkWindow *window);
276 GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
277 GList* gdk_window_get_children (GdkWindow *window);
278 GdkEventMask gdk_window_get_events (GdkWindow *window);
279 void gdk_window_set_events (GdkWindow *window,
280 GdkEventMask event_mask);
284 GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
285 GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
291 void gdk_cursor_destroy (GdkCursor *cursor);
296 GdkGC* gdk_gc_new (GdkWindow *window);
297 GdkGC* gdk_gc_new_with_values (GdkWindow *window,
299 GdkGCValuesMask values_mask);
300 void gdk_gc_destroy (GdkGC *gc);
301 void gdk_gc_get_values (GdkGC *gc,
302 GdkGCValues *values);
303 void gdk_gc_set_foreground (GdkGC *gc,
305 void gdk_gc_set_background (GdkGC *gc,
307 void gdk_gc_set_font (GdkGC *gc,
309 void gdk_gc_set_function (GdkGC *gc,
310 GdkFunction function);
311 void gdk_gc_set_fill (GdkGC *gc,
313 void gdk_gc_set_tile (GdkGC *gc,
315 void gdk_gc_set_stipple (GdkGC *gc,
317 void gdk_gc_set_ts_origin (GdkGC *gc,
320 void gdk_gc_set_clip_origin (GdkGC *gc,
323 void gdk_gc_set_clip_mask (GdkGC *gc,
325 void gdk_gc_set_clip_rectangle (GdkGC *gc,
326 GdkRectangle *rectangle);
327 void gdk_gc_set_subwindow (GdkGC *gc,
328 GdkSubwindowMode mode);
329 void gdk_gc_set_exposures (GdkGC *gc,
331 void gdk_gc_set_line_attributes (GdkGC *gc,
333 GdkLineStyle line_style,
334 GdkCapStyle cap_style,
335 GdkJoinStyle join_style);
340 GdkPixmap* gdk_pixmap_new (GdkWindow *window,
344 GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
348 GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
355 GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
357 GdkColor *transparent_color,
358 const gchar *filename);
359 GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
361 GdkColor *transparent_color,
363 GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
364 void gdk_pixmap_unref (GdkPixmap *pixmap);
366 GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
367 void gdk_bitmap_unref (GdkBitmap *pixmap);
372 GdkImage* gdk_image_new_bitmap(GdkVisual *,
376 GdkImage* gdk_image_new (GdkImageType type,
380 GdkImage* gdk_image_get (GdkWindow *window,
385 void gdk_image_put_pixel (GdkImage *image,
389 guint32 gdk_image_get_pixel (GdkImage *image,
392 void gdk_image_destroy (GdkImage *image);
397 GdkColormap* gdk_colormap_new (GdkVisual *visual,
399 GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
400 void gdk_colormap_unref (GdkColormap *cmap);
402 GdkColormap* gdk_colormap_get_system (void);
403 gint gdk_colormap_get_system_size (void);
405 void gdk_colormap_change (GdkColormap *colormap,
407 void gdk_colors_store (GdkColormap *colormap,
410 gint gdk_colors_alloc (GdkColormap *colormap,
416 void gdk_colors_free (GdkColormap *colormap,
420 gint gdk_color_white (GdkColormap *colormap,
422 gint gdk_color_black (GdkColormap *colormap,
424 gint gdk_color_parse (const gchar *spec,
426 gint gdk_color_alloc (GdkColormap *colormap,
428 gint gdk_color_change (GdkColormap *colormap,
430 gint gdk_color_equal (GdkColor *colora,
436 GdkFont* gdk_font_load (const gchar *font_name);
437 GdkFont* gdk_fontset_load (gchar *fontset_name);
438 GdkFont* gdk_font_ref (GdkFont *font);
439 void gdk_font_unref (GdkFont *font);
440 gint gdk_font_id (GdkFont *font);
441 gint gdk_font_equal (GdkFont *fonta,
443 gint gdk_string_width (GdkFont *font,
444 const gchar *string);
445 gint gdk_text_width (GdkFont *font,
448 gint gdk_char_width (GdkFont *font,
450 gint gdk_string_measure (GdkFont *font,
451 const gchar *string);
452 gint gdk_text_measure (GdkFont *font,
455 gint gdk_char_measure (GdkFont *font,
461 void gdk_draw_point (GdkDrawable *drawable,
465 void gdk_draw_line (GdkDrawable *drawable,
471 void gdk_draw_rectangle (GdkDrawable *drawable,
478 void gdk_draw_arc (GdkDrawable *drawable,
487 void gdk_draw_polygon (GdkDrawable *drawable,
492 void gdk_draw_string (GdkDrawable *drawable,
497 const gchar *string);
498 void gdk_draw_text (GdkDrawable *drawable,
505 void gdk_draw_pixmap (GdkDrawable *drawable,
514 void gdk_draw_bitmap (GdkDrawable *drawable,
523 void gdk_draw_image (GdkDrawable *drawable,
532 void gdk_draw_points (GdkDrawable *drawable,
536 void gdk_draw_segments (GdkDrawable *drawable,
544 gint gdk_selection_owner_set (GdkWindow *owner,
548 GdkWindow* gdk_selection_owner_get (GdkAtom selection);
549 void gdk_selection_convert (GdkWindow *requestor,
553 gint gdk_selection_property_get (GdkWindow *requestor,
557 void gdk_selection_send_notify (guint32 requestor,
563 gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
564 guchar *text, gint length,
566 void gdk_free_text_list (gchar **list);
567 gint gdk_string_to_compound_text (gchar *str,
568 GdkAtom *encoding, gint *format,
569 guchar **ctext, gint *length);
570 void gdk_free_compound_text (guchar *ctext);
574 GdkAtom gdk_atom_intern (const gchar *atom_name,
575 gint only_if_exists);
576 gchar* gdk_atom_name (GdkAtom atom);
577 gint gdk_property_get (GdkWindow *window,
583 GdkAtom *actual_property_type,
588 void gdk_property_change (GdkWindow *window,
595 void gdk_property_delete (GdkWindow *window,
599 /* Rectangle utilities
601 gint gdk_rectangle_intersect (GdkRectangle *src1,
608 void gdk_input_init (void);
609 void gdk_input_exit (void);
610 GList *gdk_input_list_devices (void);
611 void gdk_input_set_extension_events (GdkWindow *window,
613 GdkExtensionMode mode);
614 void gdk_input_set_source (guint32 deviceid,
615 GdkInputSource source);
616 gint gdk_input_set_mode (guint32 deviceid,
618 void gdk_input_set_axes (guint32 deviceid,
620 void gdk_input_set_key (guint32 deviceid,
623 GdkModifierType modifiers);
624 void gdk_input_window_get_pointer (GdkWindow *window,
631 GdkModifierType *mask);
633 GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
637 gint *nevents_return);
639 /* International Input Method Support Functions
642 gint gdk_im_ready (void);
644 void gdk_im_begin (GdkIC ic, GdkWindow* window);
645 void gdk_im_end (void);
646 GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
647 GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
648 GdkIC gdk_ic_new (GdkWindow* client_window,
649 GdkWindow* focus_window,
650 GdkIMStyle style, ...);
651 void gdk_ic_destroy (GdkIC ic);
652 GdkIMStyle gdk_ic_get_style (GdkIC ic);
653 void gdk_ic_set_values (GdkIC ic, ...);
654 void gdk_ic_get_values (GdkIC ic, ...);
655 void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
656 void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
657 GdkEventMask gdk_ic_get_events (GdkIC ic);
660 void gdk_event_send_clientmessage_toall(GdkEvent *event);
664 GdkColorContext *gdk_color_context_new (GdkVisual *visual,
665 GdkColormap *colormap);
667 GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
668 GdkColormap *colormap);
670 void gdk_color_context_free (GdkColorContext *cc);
672 gulong gdk_color_context_get_pixel (GdkColorContext *cc,
677 void gdk_color_context_get_pixels (GdkColorContext *cc,
684 void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
693 gint gdk_color_context_query_color (GdkColorContext *cc,
695 gint gdk_color_context_query_colors (GdkColorContext *cc,
699 gint gdk_color_context_add_palette (GdkColorContext *cc,
703 void gdk_color_context_init_dither (GdkColorContext *cc);
704 void gdk_color_context_free_dither (GdkColorContext *cc);
706 gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
711 guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
720 #endif /* __cplusplus */
723 #endif /* __GDK_H__ */