1 /* $Id: window.hg,v 1.23 2006/04/12 11:11:24 murrayc Exp $ */
3 /* Copyright(C) 1998-2002 The gtkmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License or(at your option) any later version.
10 * This library is distributed in the hope that it will be useful
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not write to the Free
17 * Software Foundation Inc. 675 Mass Ave Cambridge MA 02139 USA.
20 #include <gdkmm/drawable.h>
21 #include <gdkmm/bitmap.h>
22 //#include <gdkmm/cursor.h>
23 #include <gdkmm/types.h>
24 #include <gdkmm/region.h>
25 #include <gdk/gdkwindow.h>
28 _PINCLUDE(gdkmm/private/drawable_p.h)
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 // Custom struct prototype, because this isn't what the code-generator expects:
33 typedef struct _GdkDrawable GdkWindow;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 _CC_INCLUDE(gdk/gdkenumtypes.h)
42 _WRAP_ENUM(EventMask, GdkEventMask)
43 _WRAP_ENUM(WindowState, GdkWindowState)
44 _WRAP_ENUM(WindowType, GdkWindowType)
45 _WRAP_ENUM(WindowAttributesType, GdkWindowAttributesType)
46 _WRAP_ENUM(WindowHints, GdkWindowHints)
47 _WRAP_ENUM(WindowTypeHint, GdkWindowTypeHint)
48 _WRAP_ENUM(WMDecoration, GdkWMDecoration)
49 _WRAP_ENUM(WMFunction, GdkWMFunction)
50 _WRAP_ENUM(WindowEdge, GdkWindowEdge)
51 _WRAP_ENUM(Gravity, GdkGravity)
52 _WRAP_ENUM(GrabStatus, GdkGrabStatus)
57 /** A Gdk::Window is a rectangular region on the screen. It's a low-level object, used to implement high-level objects such
58 * as Gtk::Widget and Gtk::Window on the GTK+ level. A Gtk::Window is a toplevel window, the thing a user might think of as
59 * a "window" with a titlebar and so on; a Gtk::Window may contain many Gdk::Windows. For example, each Gtk::Button has a
60 * Gdk::Window associated with it.
62 class Window : public Gdk::Drawable
64 // GdkWindow is a typedef to GdkDrawable, but it's actually a GdkWindowObject.
65 _CLASS_GOBJECT(Window, GdkWindow, GDK_WINDOW_OBJECT, Gdk::Drawable, GdkDrawable, GdkWindowObject)
67 _IGNORE(gdk_window_set_hints, gdk_window_destroy, gdk_window_new, gdk_window_get_deskrelative_origin, gdk_window_get_internal_paint_info)
68 _IGNORE(gdk_window_destroy_notify)
72 Window(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask);
75 _WRAP_CREATE(const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask)
77 _WRAP_METHOD(WindowType get_window_type() const, gdk_window_get_window_type)
78 _WRAP_METHOD(void show(), gdk_window_show)
79 _WRAP_METHOD(void hide(), gdk_window_hide)
80 _WRAP_METHOD(void withdraw(), gdk_window_withdraw)
81 _WRAP_METHOD(void show_unraised(), gdk_window_show_unraised)
82 _WRAP_METHOD(void move(int x, int y), gdk_window_move)
83 _WRAP_METHOD(void resize(int width, int height), gdk_window_resize)
84 _WRAP_METHOD(void move_resize(int x, int y, int width, int height), gdk_window_move_resize)
85 _WRAP_METHOD(void reparent(const Glib::RefPtr<Window>& new_parent, int x, int y), gdk_window_reparent)
86 _WRAP_METHOD(void clear(), gdk_window_clear)
87 _WRAP_METHOD(void clear_area(int x, int y, int width, int height), gdk_window_clear_area)
88 _WRAP_METHOD(void clear_area_e(int x, int y, int width, int height), gdk_window_clear_area_e)
89 _WRAP_METHOD(void raise(), gdk_window_raise)
90 _WRAP_METHOD(void lower(), gdk_window_lower)
91 _WRAP_METHOD(void focus(guint32 timestamp), gdk_window_focus)
92 _WRAP_METHOD(void set_user_data(gpointer user_data), gdk_window_set_user_data)
93 _WRAP_METHOD(void set_override_redirect(bool override_redirect = true), gdk_window_set_override_redirect)
95 //We could wrap these with a Slot instead of a C callback, but these methods are very low-level anyway.
96 _WRAP_METHOD(void add_filter(GdkFilterFunc function, gpointer data), gdk_window_add_filter)
97 _WRAP_METHOD(void remove_filter(GdkFilterFunc function, gpointer data), gdk_window_remove_filter)
99 _WRAP_METHOD(void scroll(int dx, int dy), gdk_window_scroll)
100 _WRAP_METHOD(void move_region(const Region& region, int dx, int dy), gdk_window_move_region)
102 _WRAP_METHOD(void shape_combine_mask(const Glib::RefPtr<Bitmap>& mask, int x, int y), gdk_window_shape_combine_mask)
103 void unset_shape_combine_mask();
105 _WRAP_METHOD(void shape_combine_region(const Region& shape_region, int offset_x, int offset_y), gdk_window_shape_combine_region)
106 _WRAP_METHOD(void set_child_shapes(), gdk_window_set_child_shapes)
107 _WRAP_METHOD(void set_composited(bool composited = TRUE), gdk_window_set_composited)
108 _WRAP_METHOD(void merge_child_shapes(), gdk_window_merge_child_shapes)
110 _WRAP_METHOD(void input_shape_combine_mask(const Glib::RefPtr<Bitmap>& mask, int x, int y), gdk_window_input_shape_combine_mask)
111 _WRAP_METHOD(void input_shape_combine_region (const Region& shape_region, int offset_x, int offset_y), gdk_window_input_shape_combine_region)
112 _WRAP_METHOD(void set_child_input_shapes(), gdk_window_set_child_input_shapes)
113 _WRAP_METHOD(void merge_child_input_shapes(), gdk_window_merge_child_input_shapes)
116 _WRAP_METHOD(bool is_visible() const, gdk_window_is_visible)
117 _WRAP_METHOD(bool is_viewable() const, gdk_window_is_viewable)
118 _WRAP_METHOD(WindowState get_state() const, gdk_window_get_state)
119 _WRAP_METHOD(bool set_static_gravities(bool use_static = true), gdk_window_set_static_gravities)
120 _WRAP_METHOD(void set_type_hint(WindowTypeHint hint), gdk_window_set_type_hint)
121 _WRAP_METHOD(WindowTypeHint get_type_hint(), gdk_window_get_type_hint)
122 _WRAP_METHOD(void set_modal_hint(bool modal = true), gdk_window_set_modal_hint)
123 _WRAP_METHOD(void set_geometry_hints(const Geometry& geometry, WindowHints geom_mask), gdk_window_set_geometry_hints)
124 _WRAP_METHOD(static void set_sm_client_id(const Glib::ustring& sm_client_id), gdk_set_sm_client_id)
125 static void unset_sm_client_id();
127 _WRAP_METHOD(void begin_paint_rect(Rectangle&rectangle), gdk_window_begin_paint_rect)
128 _WRAP_METHOD(void begin_paint_region(const Region& region), gdk_window_begin_paint_region)
129 _WRAP_METHOD(void end_paint(), gdk_window_end_paint)
130 _WRAP_METHOD(void set_title(const Glib::ustring& title), gdk_window_set_title)
131 _WRAP_METHOD(void set_role(const Glib::ustring& role), gdk_window_set_role)
132 _WRAP_METHOD(void set_startup_id(const Glib::ustring& startup_id), gdk_window_set_startup_id)
133 _WRAP_METHOD(void set_transient_for(const Glib::RefPtr<Window>& parent), gdk_window_set_transient_for)
134 _WRAP_METHOD(void set_background(const Color& color), gdk_window_set_background)
135 _WRAP_METHOD(void set_back_pixmap(const Glib::RefPtr<Pixmap>&pixmap, bool parent_relative), gdk_window_set_back_pixmap)
137 #m4 _CONVERSION(const Cursor&,GdkCursor*,const_cast<GdkCursor*>(($3).gobj()))
138 _WRAP_METHOD(void set_cursor(const Cursor& cursor), gdk_window_set_cursor)
140 /** Use the parent window's cursor.
141 * For top-level windows this means that it will use the default cursor for the ROOT window.
145 _WRAP_METHOD(void get_user_data(gpointer* data), gdk_window_get_user_data)
146 _WRAP_METHOD(void get_geometry(int& x, int& y, int& width, int& height, int& depth) const, gdk_window_get_geometry)
147 _WRAP_METHOD(void get_position(int& x, int& y) const, gdk_window_get_position)
148 _WRAP_METHOD(int get_origin(int& x, int& y) const, gdk_window_get_origin)
149 _IGNORE(gdk_window_get_deskrelative_origin)
150 _WRAP_METHOD(void get_root_origin(int& x, int& y) const, gdk_window_get_root_origin)
151 _WRAP_METHOD(void get_frame_extents(Rectangle& rect), gdk_window_get_frame_extents)
152 _WRAP_METHOD(Glib::RefPtr<Window> get_pointer(int& x, int& y, ModifierType& mask), gdk_window_get_pointer, refreturn)
153 _WRAP_METHOD(Glib::RefPtr<Window> get_parent(), gdk_window_get_parent, refreturn)
154 _WRAP_METHOD(Glib::RefPtr<const Window> get_parent() const, gdk_window_get_parent, refreturn, constversion)
155 _WRAP_METHOD(Glib::RefPtr<Window> get_toplevel(), gdk_window_get_toplevel, refreturn)
156 _WRAP_METHOD(Glib::RefPtr<const Window> get_toplevel() const, gdk_window_get_toplevel, refreturn, constversion)
158 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Window> > get_children(), gdk_window_get_children)
159 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Window> > get_children() const, gdk_window_get_children)
160 _IGNORE(gdk_window_peek_children) //gdk_window_peek_children() is the same as gdk_window_get_children() with different memory mangement of the list.
162 _WRAP_METHOD(EventMask get_events() const, gdk_window_get_events)
163 _WRAP_METHOD(void set_events(EventMask event_mask), gdk_window_set_events)
165 _WRAP_METHOD(void set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs), gdk_window_set_icon_list)
166 _WRAP_METHOD(void set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap, const Glib::RefPtr<Bitmap>& mask), gdk_window_set_icon)
167 void set_icon(const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap);
169 _WRAP_METHOD(void set_icon_name(const Glib::ustring& name), gdk_window_set_icon_name)
171 _WRAP_METHOD(void set_group(const Glib::RefPtr<Window>& leader), gdk_window_set_group)
172 _WRAP_METHOD(Glib::RefPtr<Window> get_group(), gdk_window_get_group)
173 _WRAP_METHOD(Glib::RefPtr<const Window> get_group() const, gdk_window_get_group, constversion)
175 _WRAP_METHOD(void set_decorations(WMDecoration decorations), gdk_window_set_decorations)
176 _WRAP_METHOD(bool get_decorations(WMDecoration& decorations) const, gdk_window_get_decorations)
177 _WRAP_METHOD(void set_functions(WMFunction functions), gdk_window_set_functions)
179 _WRAP_METHOD(static Glib::ListHandle< Glib::RefPtr<Window> > get_toplevels(), gdk_window_get_toplevels)
181 _WRAP_METHOD(void beep(), gdk_window_beep)
183 _WRAP_METHOD(void iconify(), gdk_window_iconify)
184 _WRAP_METHOD(void deiconify(), gdk_window_deiconify)
185 _WRAP_METHOD(void stick(), gdk_window_stick)
186 _WRAP_METHOD(void unstick(), gdk_window_unstick)
187 _WRAP_METHOD(void maximize(), gdk_window_maximize)
188 _WRAP_METHOD(void unmaximize(), gdk_window_unmaximize)
189 _WRAP_METHOD(void register_dnd(), gdk_window_register_dnd)
190 _WRAP_METHOD(void begin_resize_drag(WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp), gdk_window_begin_resize_drag)
191 _WRAP_METHOD(void begin_move_drag(int button, int root_x, int root_y, guint32 timestamp), gdk_window_begin_move_drag)
192 _WRAP_METHOD(void invalidate_rect(const Rectangle& rect, bool invalidate_children), gdk_window_invalidate_rect)
194 _WRAP_METHOD(void invalidate_region(const Region& region, bool invalidate_children = true), gdk_window_invalidate_region)
196 _WRAP_METHOD(Region get_update_area(), gdk_window_get_update_area)
197 //This method should not have a const version - see the docs.
199 _WRAP_METHOD(void freeze_updates(), gdk_window_freeze_updates)
200 _WRAP_METHOD(void thaw_updates(), gdk_window_thaw_updates)
201 _WRAP_METHOD(static void process_all_updates(), gdk_window_process_all_updates)
202 _WRAP_METHOD(void process_updates(bool update_children), gdk_window_process_updates)
203 _WRAP_METHOD(static void set_debug_updates(bool setting = true), gdk_window_set_debug_updates)
204 _WRAP_METHOD(static void constrain_size(const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height), gdk_window_constrain_size)
205 void get_internal_paint_info(Glib::RefPtr<Drawable>& real_drawable, int& x_offset, int& y_offset) const;
207 _WRAP_METHOD(void enable_synchronized_configure(), gdk_window_enable_synchronized_configure)
208 _WRAP_METHOD(void configure_finished(), gdk_window_configure_finished)
210 _WRAP_METHOD(void set_skip_taskbar_hint(bool skips_taskbar = true), gdk_window_set_skip_taskbar_hint)
211 _WRAP_METHOD(void set_skip_pager_hint(bool skips_pager = true), gdk_window_set_skip_pager_hint)
213 _WRAP_METHOD(void set_urgency_hint(bool urgent = true), gdk_window_set_urgency_hint)
215 _WRAP_METHOD(void fullscreen(), gdk_window_fullscreen)
216 _WRAP_METHOD(void unfullscreen(), gdk_window_unfullscreen)
218 _WRAP_METHOD(GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Glib::RefPtr<const Window>& confine_to, const Cursor& cursor, guint32 time_), gdk_pointer_grab)
220 /** Grabs the pointer to a specific window.
221 * Requires a corresponding call to pointer_ungrab().
224 * @param owner_events Specifies whether events will be reported as is, or relative to the window.
225 * @param event_mask Masks only interesting events.
226 * @param cursor Changes the cursor for the duration of the grab.
227 * @param timestamp Specifies the time.
229 GrabStatus pointer_grab(bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 timestamp);
231 /** Grabs the pointer to a specific window.
232 * Requires a corresponding call to pointer_ungrab().
235 * @param owner_events Specifies whether events will be reported as is, or relative to the window.
236 * @param event_mask Masks only interesting events.
237 * @param timestamp Specifies the time.
239 GrabStatus pointer_grab(bool owner_events, EventMask event_mask, guint32 timestamp);
241 _WRAP_METHOD(static void pointer_ungrab(guint32 timestamp), gdk_pointer_ungrab)
242 _WRAP_METHOD(GrabStatus keyboard_grab(bool owner_events, guint32 timestamp), gdk_keyboard_grab)
243 _WRAP_METHOD(static void keyboard_ungrab(guint32 timestamp), gdk_keyboard_ungrab)
245 _WRAP_METHOD(void set_keep_above(bool setting = true), gdk_window_set_keep_above)
246 _WRAP_METHOD(void set_keep_below(bool setting = true), gdk_window_set_keep_below)
248 _WRAP_METHOD(void set_opacity(double opacity), gdk_window_set_opacity)
250 _WRAP_METHOD(void set_accept_focus(bool accept_focus = true), gdk_window_set_accept_focus)
252 _WRAP_METHOD(void set_focus_on_map(bool focus_on_map), gdk_window_set_focus_on_map)
255 } /* namespace Gdk */