Google

logo top
Main Page   Widgets   Namespaces   Book  

Gdk::Window Class Reference

Inheritance diagram for Gdk::Window:

Inheritance graph
[legend]
List of all members.

Public Methods

virtual ~Window ()
GdkWindow* gobj ()
const GdkWindow* gobj () const
GdkWindow* gobj_copy ()
WindowType get_window_type () const
 Gets the type of the window.

void show ()
 Like gdk_window_show_unraised(), but also raises the window to the top of the window stack (moves the window to the front of the Z-order).

void hide ()
 For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won't be displayed.

void withdraw ()
 Withdraws a window (unmaps it and asks the window manager to forget about it).

void show_unraised ()
 Shows a Gdk::Window onscreen, but does not modify its stacking order.

void move (int x, int y)
 Repositions a window relative to its parent window.

void resize (int width, int height)
 Resizes window ; for toplevel windows, asks the window manager to resize the window.

void move_resize (int x, int y, int width, int height)
 Equivalent to calling gdk_window_move() and gdk_window_resize(), except that both operations are performed at once, avoiding strange visual effects.

void reparent (const Glib::RefPtr<Window>& new_parent, int x, int y)
 Reparents window into the given new_parent .

void clear ()
 Clears an entire window to the background color or background pixmap.

void clear_area (int x, int y, int width, int height)
 Clears an area of window to the background color or background pixmap.

void clear_area_e (int x, int y, int width, int height)
 Like gdk_window_clear_area(), but also generates an expose event for the cleared area.

void raise ()
 Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window .

void lower ()
 Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window .

void focus (guint32 timestamp)
 Sets keyboard focus to window .

void set_user_data (gpointer user_data)
 For most purposes this function is deprecated in favor of Glib::object_set_data().

void set_override_redirect (bool override_redirect=true)
 An override redirect window is not under the control of the window manager.

void add_filter (GdkFilterFunc function, gpointer data)
 Adds an event filter to window , allowing you to intercept events before they reach GDK.

void remove_filter (GdkFilterFunc function, gpointer data)
 Remove a filter previously added with gdk_window_add_filter().

void scroll (int dx, int dy)
 Scroll the contents of window , both pixels and children, by the given amount.

void shape_combine_mask (const Glib::RefPtr<Bitmap>& mask, int x, int y)
 Applies a shape mask to window .

void shape_combine_region (GdkRegion* shape_region, int offset_x, int offset_y)
 Makes pixels in window outside shape_region be transparent, so that the window may be nonrectangular.

void set_child_shapes ()
 Sets the shape mask of window to the union of shape masks for all children of window , ignoring the shape mask of window itself.

void merge_child_shapes ()
 Merges the shape masks for any child windows into the shape mask for window .

bool is_visible () const
 Checks whether the window has been mapped (with gdk_window_show() or gdk_window_show_unraised()).

bool is_viewable () const
 Check if the window and all ancestors of the window are mapped.

WindowState get_state () const
 Gets the bitwise OR of the currently active window state flags, from the Gdk::WindowState enumeration.

bool set_static_gravities (bool use_static=true)
 Set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity.

void set_type_hint (WindowTypeHint hint)
 The application can use this call to provide a hint to the window manager about the functionality of a window.

void set_modal_hint (bool modal=true)
 The application can use this hint to tell the window manager that a certain window has modal behaviour.

void set_geometry_hints (GdkGeometry* geometry, WindowHints geom_mask)
 Sets the geometry hints for window .

void begin_paint_rect (Rectangle& rectangle)
 A convenience wrapper around gdk_window_begin_paint_region() which creates a rectangular region for you.

void begin_paint_region (GdkRegion* region)
 Indicates that you are beginning the process of redrawing region .

void end_paint ()
 Indicates that the backing store created by the most recent call to gdk_window_begin_paint_region() should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region.

void set_title (const Glib::ustring& title)
 Sets the title of a toplevel window, to be displayed in the titlebar.

void set_role (const Glib::ustring& role)
 When using GTK+, typically you should use gtk_window_set_role() instead of this low-level function.

void set_transient_for (const Glib::RefPtr<Window>& parent)
 Indicates to the window manager that window is a transient dialog associated with the application window parent .

void set_background (const Color& color)
 Sets the background color of window .

void set_back_pixmap (const Glib::RefPtr<Pixmap>& pixmap, bool parent_relative)
 Sets the background pixmap of window .

void set_cursor (const Cursor& cursor)
 Sets the mouse pointer for a Gdk::Window.

void set_cursor ()
 Use the parent window's cursor.

void get_user_data (gpointer* data)
 Retrieves the user data for window , which is normally the widget that window belongs to.

void get_geometry (int& x, int& y, int& width, int& height, int& depth) const
 Any of the return location arguments to this function may be 0, if you aren't interested in getting the value of that field.

void get_position (int& x, int& y) const
 Obtains the position of the window as reported in the most-recently-processed Gdk::EventConfigure.

int get_origin (int& x, int& y) const
 Obtains the position of a window in root window coordinates.

void get_root_origin (int& x, int& y) const
 Obtains the top-left corner of the window manager frame in root window coordinates.

void get_frame_extents (Rectangle& rect)
 Obtains the bounding box of the window, including window manager titlebar/borders if any.

Glib::RefPtr<Window> get_pointer (int& x, int& y, ModifierType& mask)
 Obtains the current pointer position and modifier state.

Glib::RefPtr<Window> get_parent ()
 Obtains the parent of window , as known to GDK.

Glib::RefPtr<const Window> get_parent () const
 Obtains the parent of window , as known to GDK.

Glib::RefPtr<Window> get_toplevel ()
 Gets the toplevel window that's an ancestor of window .

Glib::RefPtr<const Window> get_toplevel () const
 Gets the toplevel window that's an ancestor of window .

GList* get_children ()
 Gets the list of children of window known to GDK.

GList* peek_children ()
 Like gdk_window_get_children(), but does not copy the list of children, so the list does not need to be freed.

EventMask get_events () const
 Gets the event mask for window .

void set_events (EventMask event_mask)
 The event mask for a window determines which events will be reported for that window.

void set_icon_list (GList* pixbufs)
 Sets a list of icons for the window.

void set_icon (const Glib::RefPtr<Window>& icon_window, const Glib::RefPtr<Pixmap>& pixmap, const Glib::RefPtr<Bitmap>& mask)
 Sets the icon of window as a pixmap or window.

void set_icon_name (const Glib::ustring& name)
 Windows may have a name used while minimized, distinct from the name they display in their titlebar.

void set_group (const Glib::RefPtr<Window>& leader)
 Sets the group leader window for window .

void set_decorations (WMDecoration decorations)
 "Decorations" are the features the window manager adds to a toplevel Gdk::Window.

bool get_decorations (WMDecoration& decorations)
 Returns the decorations set on the GdkWindow with #gdk_window_set_decorations.

void set_functions (WMFunction functions)
 This function isn't really good for much.

void iconify ()
 Asks to iconify (minimize) window .

void deiconify ()
 Attempt to deiconify (unminimize) window .

void stick ()
 "Pins" a window such that it's on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports.

void unstick ()
 Reverse operation for gdk_window_stick(); see gdk_window_stick(), and gtk_window_unstick().

void maximize ()
 Maximizes the window.

void unmaximize ()
 Unmaximizes the window.

void register_dnd ()
void begin_resize_drag (WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp)
 Begins a window resize operation (for a toplevel window).

void begin_move_drag (int button, int root_x, int root_y, guint32 timestamp)
 Begins a window move operation (for a toplevel window).

void invalidate_rect (const Rectangle& rect, bool invalidate_children)
 A convenience wrapper around gdk_window_invalidate_region() which invalidates a rectangular region.

void invalidate_region (GdkRegion* region, bool invalidate_children)
 Adds region to the update area for window .

GdkRegionget_update_area ()
 Transfers ownership of the update area from window to the caller of the function.

void freeze_updates ()
 Temporarily freezes a window such that it won't receive expose events.

void thaw_updates ()
 Thaws a window frozen with gdk_window_freeze_updates().

void process_updates (bool update_children)
 Sends one or more expose events to window .

void get_internal_paint_info (GdkDrawable** real_drawable, int* x_offset, int* y_offset)
 If you bypass the GDK layer and use windowing system primitives to draw directly onto a Gdk::Window, then you need to deal with two details: there may be an offset between GDK coordinates and windowing system coordinates, and GDK may have redirected drawing to a offscreen pixmap as the result of a gdk_window_begin_paint_region() calls.

void set_skip_taskbar_hint (bool skips_taskbar=true)
 Toggles whether a window should appear in a task list or window list.

void set_skip_pager_hint (bool skips_pager=true)
 Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop).

void fullscreen ()
 Moves the window into fullscreen mode.

void unfullscreen ()
 Moves the window out of fullscreen mode.

GrabStatus pointer_grab (bool owner_events, EventMask event_mask, const Glib::RefPtr<const Window>& confine_to, const Cursor& cursor, guint32 time_)
GrabStatus pointer_grab (bool owner_events, EventMask event_mask, const Cursor& cursor, guint32 time_)
 Grabs the pointer to a specific window.

GrabStatus pointer_grab (bool owner_events, EventMask event_mask, guint32 time_)
 Grabs the pointer to a specific window.

GrabStatus keyboard_grab (bool owner_events, guint32 time_)

Static Public Methods

Glib::RefPtr<Window> create (const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask)
void set_sm_client_id (const Glib::ustring& sm_client_id)
 Sets the SM_CLIENT_ID property on the application's leader window so that the window manager can save the application's state using the X11R6 ICCCM session management protocol.

GList* get_toplevels ()
 Obtains a list of all toplevel windows known to GDK on the default screen (see gdk_window_get_toplevels_for_screen()).

void process_all_updates ()
 Calls gdk_window_process_updates() for all windows (see Gdk::Window) in the application.

void set_debug_updates (bool setting)
 With update debugging enabled, calls to gdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during gdk_window_process_updates().

void constrain_size (const Geometry& geometry, guint flags, int width, int height, int& new_width, int& new_height)
 Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).

void pointer_ungrab (guint32 time_)
 Ungrabs the pointer, if it is grabbed by this application.

void keyboard_ungrab (guint32 time_)
 Ungrabs the pointer, if it is grabbed by this application.


Protected Methods

 Window (const Glib::RefPtr<Window>& parent, GdkWindowAttr* attributes, int attributes_mask)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gdk::Window> wrap (GdkWindowObject* object, bool take_copy=false)

Constructor & Destructor Documentation

virtual Gdk::Window::~Window (   [virtual]
 

Gdk::Window::Window ( const Glib::RefPtr<Window>&    parent,
GdkWindowAttr*    attributes,
int    attributes_mask
[protected]
 


Member Function Documentation

void Gdk::Window::add_filter ( GdkFilterFunc    function,
gpointer    data
 

Adds an event filter to window , allowing you to intercept events before they reach GDK.

This is a low-level operation and makes it easy to break GDK and/or GTK+, so you have to know what you're doing. Pass 0 for window to get all events for all windows, instead of events for a specific window.

Parameters:
function Filter callback.
data Data to pass to filter callback.

void Gdk::Window::begin_move_drag ( int    button,
int    root_x,
int    root_y,
guint32    timestamp
 

Begins a window move operation (for a toplevel window).

You might use this function to implement a "window move grip," for example. The function works best with window managers that support the Extended Window Manager Hints spec (see http://www.freedesktop.org), but has a fallback implementation for other window managers.

Parameters:
button The button being used to drag.
root_x Root window X coordinate of mouse click that began the drag.
root_y Root window Y coordinate of mouse click that began the drag.
timestamp Timestamp of mouse click that began the drag.

void Gdk::Window::begin_paint_rect ( Rectangle   rectangle
 

A convenience wrapper around gdk_window_begin_paint_region() which creates a rectangular region for you.

See gdk_window_begin_paint_region() for details.

Parameters:
rectangle Rectangle you intend to draw to.

void Gdk::Window::begin_paint_region ( GdkRegion   region
 

Indicates that you are beginning the process of redrawing region .

A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background pixmap for window . Then, all drawing operations performed on window will be diverted to the backing store. When you call gdk_window_end_paint(), the backing store will be copied to window , making it visible onscreen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region .

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call gdk_window_end_paint(). If you draw to window directly without calling gdk_window_begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of gdk_window_begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.

When using GTK+, the widget system automatically places calls to gdk_window_begin_paint_region() and gdk_window_end_paint() around emissions of the expose_event signal. That is, if you're writing an expose event handler, you can assume that the exposed area in Gdk::EventExpose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call gdk_window_begin_paint_region(). (You can disable the automatic calls around expose events on a widget-by-widget basis by calling gtk_widget_set_double_buffered().)

If you call this function multiple times before calling the matching gdk_window_end_paint(), the backing stores are pushed onto a stack. gdk_window_end_paint() copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to gdk_window_end_paint() is required for each call to gdk_window_begin_paint_region().

Parameters:
region Region you intend to draw to.

void Gdk::Window::begin_resize_drag ( WindowEdge    edge,
int    button,
int    root_x,
int    root_y,
guint32    timestamp
 

Begins a window resize operation (for a toplevel window).

You might use this function to implement a "window resize grip," for example; in fact Gtk::Statusbar uses it. The function works best with window managers that support the Extended Window Manager Hints spec (see http://www.freedesktop.org), but has a fallback implementation for other window managers.

Parameters:
edge The edge or corner from which the drag is started.
button The button being used to drag.
root_x Root window X coordinate of mouse click that began the drag.
root_y Root window Y coordinate of mouse click that began the drag.
timestamp Timestamp of mouse click that began the drag (use gdk_event_get_time()).

void Gdk::Window::clear (  
 

Clears an entire window to the background color or background pixmap.

void Gdk::Window::clear_area ( int    x,
int    y,
int    width,
int    height
 

Clears an area of window to the background color or background pixmap.

Parameters:
x X coordinate of rectangle to clear.
y Y coordinate of rectangle to clear.
width Width of rectangle to clear.
height Height of rectangle to clear.

void Gdk::Window::clear_area_e ( int    x,
int    y,
int    width,
int    height
 

Like gdk_window_clear_area(), but also generates an expose event for the cleared area.

This function has a stupid name because it dates back to the mists time, pre-GDK-1.0.

Parameters:
x X coordinate of rectangle to clear.
y Y coordinate of rectangle to clear.
width Width of rectangle to clear.
height Height of rectangle to clear.

void Gdk::Window::constrain_size ( const Geometry   geometry,
guint    flags,
int    width,
int    height,
int&    new_width,
int&    new_height
[static]
 

Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).

Parameters:
geometry A Gdk::Geometry structure.
flags A mask indicating what portions of geometry are set.
width Desired width of window.
height Desired height of the window.
new_width Location to store resulting width.
new_height Location to store resulting height.

Glib::RefPtr<Window> Gdk::Window::create ( const Glib::RefPtr<Window>&    parent,
GdkWindowAttr*    attributes,
int    attributes_mask
[static]
 

void Gdk::Window::deiconify (  
 

Attempt to deiconify (unminimize) window .

On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use gtk_window_deiconify() instead of the Gdk::Window variant. Or better yet, you probably want to use gtk_window_present(), which raises the window, focuses it, unminimizes it, and puts it on the current desktop.

void Gdk::Window::end_paint (  
 

Indicates that the backing store created by the most recent call to gdk_window_begin_paint_region() should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region.

See gdk_window_begin_paint_region() for full details. It is an error to call this function without a matching gdk_window_begin_paint_region() first.

void Gdk::Window::focus ( guint32    timestamp
 

Sets keyboard focus to window .

If window is not onscreen this will not work. In most cases, gtk_window_present() should be used on a Gtk::Window, rather than calling this function.

Parameters:
timestamp Timestamp of the event triggering the window focus.

void Gdk::Window::freeze_updates (  
 

Temporarily freezes a window such that it won't receive expose events.

The window will begin receiving expose events again when gdk_window_thaw_updates() is called. If gdk_window_freeze_updates() has been called more than once, gdk_window_thaw_updates() must be called an equal number of times to begin processing exposes.

void Gdk::Window::fullscreen (  
 

Moves the window into fullscreen mode.

This means the window covers the entire screen and is above any panels or task bars.

If the window was already fullscreen, then this function does nothing.

On X11, asks the window manager to put window in a fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "fullscreen"; so you can't rely on the fullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Since: 2.2

GList* Gdk::Window::get_children (  
 

Gets the list of children of window known to GDK.

This function only returns children created via GDK, so for example it's useless when used with the root window; it only returns windows an application created itself.

The returned list must be freed, but the elements in the list need not be.

Returns:
List of child windows inside window .

bool Gdk::Window::get_decorations ( WMDecoration   decorations
 

Returns the decorations set on the GdkWindow with #gdk_window_set_decorations.

Parameters:
decorations The window decorations will be written here.
Returns:
true if the window has decorations set, false otherwise.

EventMask Gdk::Window::get_events (   const
 

Gets the event mask for window .

See gdk_window_set_events().

Returns:
Event mask for window .

void Gdk::Window::get_frame_extents ( Rectangle   rect
 

Obtains the bounding box of the window, including window manager titlebar/borders if any.

The frame position is given in root window coordinates. To get the position of the window itself (rather than the frame) in root window coordinates, use gdk_window_get_origin().

Parameters:
rect Rectangle to fill with bounding box of the window frame.

void Gdk::Window::get_geometry ( int&    x,
int&    y,
int&    width,
int&    height,
int&    depth
const
 

Any of the return location arguments to this function may be 0, if you aren't interested in getting the value of that field.

The X and Y coordinates returned are relative to the parent window of window , which for toplevels usually means relative to the window decorations (titlebar, etc.) rather than relative to the root window (screen-size background window).

On the X11 platform, the geometry is obtained from the X server, so reflects the latest position of window ; this may be out-of-sync with the position of window delivered in the most-recently-processed Gdk::EventConfigure. gdk_window_get_position() in contrast gets the position from the most recent configure event.

Parameters:
x Return location for X coordinate of window (relative to its parent).
y Return location for Y coordinate of window (relative to its parent).
width Return location for width of window.
height Return location for height of window.
depth Return location for bit depth of window.

void Gdk::Window::get_internal_paint_info ( GdkDrawable **    real_drawable,
int*    x_offset,
int*    y_offset
 

If you bypass the GDK layer and use windowing system primitives to draw directly onto a Gdk::Window, then you need to deal with two details: there may be an offset between GDK coordinates and windowing system coordinates, and GDK may have redirected drawing to a offscreen pixmap as the result of a gdk_window_begin_paint_region() calls.

This function allows retrieving the information you need to compensate for these effects.

This function exposes details of the GDK implementation, and is thus likely to change in future releases of GDK.

Parameters:
real_drawable Location to store the drawable to which drawing should be done.
x_offset Location to store the X offset between coordinates in window , and the underlying window system primitive coordinates for * real_drawable .
y_offset Location to store the Y offset between coordinates in window , and the underlying window system primitive coordinates for * real_drawable .

int Gdk::Window::get_origin ( int&    x,
int&    y
const
 

Obtains the position of a window in root window coordinates.

(Compare with gdk_window_get_position() and gdk_window_get_geometry() which return the position of a window relative to its parent window.)

Parameters:
x Return location for X coordinate.
y Return location for Y coordinate.
Returns:
Not meaningful, ignore.

Glib::RefPtr<const Window> Gdk::Window::get_parent (   const
 

Obtains the parent of window , as known to GDK.

Does not query the X server; thus this returns the parent as passed to gdk_window_new(), not the actual parent. This should never matter unless you're using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

Returns:
Parent of window .

Glib::RefPtr<Window> Gdk::Window::get_parent (  
 

Obtains the parent of window , as known to GDK.

Does not query the X server; thus this returns the parent as passed to gdk_window_new(), not the actual parent. This should never matter unless you're using Xlib calls mixed with GDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

Returns:
Parent of window .

Glib::RefPtr<Window> Gdk::Window::get_pointer ( int&    x,
int&    y,
ModifierType   mask
 

Obtains the current pointer position and modifier state.

The position is given in coordinates relative to window .

Parameters:
x Return location for X coordinate of pointer.
y Return location for Y coordinate of pointer.
mask Return location for modifier mask.
Returns:
The window containing the pointer (as with gdk_window_at_pointer()), or 0 if the window containing the pointer isn't known to GDK.

void Gdk::Window::get_position ( int&    x,
int&    y
const
 

Obtains the position of the window as reported in the most-recently-processed Gdk::EventConfigure.

Contrast with gdk_window_get_geometry() which queries the X server for the current window position, regardless of which events have been received or processed.

The position coordinates are relative to the window's parent window.

Parameters:
x X coordinate of window.
y Y coordinate of window.

void Gdk::Window::get_root_origin ( int&    x,
int&    y
const
 

Obtains the top-left corner of the window manager frame in root window coordinates.

Parameters:
x Return location for X position of window frame.
y Return location for Y position of window frame.

WindowState Gdk::Window::get_state (   const
 

Gets the bitwise OR of the currently active window state flags, from the Gdk::WindowState enumeration.

Returns:
Window state bitfield.

Glib::RefPtr<const Window> Gdk::Window::get_toplevel (   const
 

Gets the toplevel window that's an ancestor of window .

Returns:
The toplevel window containing window .

Glib::RefPtr<Window> Gdk::Window::get_toplevel (  
 

Gets the toplevel window that's an ancestor of window .

Returns:
The toplevel window containing window .

GList* Gdk::Window::get_toplevels (   [static]
 

Obtains a list of all toplevel windows known to GDK on the default screen (see gdk_window_get_toplevels_for_screen()).

A toplevel window is a child of the root window (see gdk_get_default_root_window()).

The returned list should be freed with Glib::list_free(), but its elements need not be freed.

Returns:
List of toplevel windows, free with Glib::list_free().

GdkRegion* Gdk::Window::get_update_area (  
 

Transfers ownership of the update area from window to the caller of the function.

That is, after calling this function, window will no longer have an invalid/dirty region; the update area is removed from window and handed to you. If a window has no update area, gdk_window_get_update_area() returns 0. You are responsible for calling gdk_region_destroy() on the returned region if it's non-0.

Returns:
The update area for window .

void Gdk::Window::get_user_data ( gpointer*    data
 

Retrieves the user data for window , which is normally the widget that window belongs to.

See gdk_window_set_user_data().

Parameters:
data Return location for user data.

WindowType Gdk::Window::get_window_type (   const
 

Gets the type of the window.

See Gdk::WindowType.

Returns:
Type of window.

const GdkWindow* Gdk::Window::gobj (   const [inline]
 

Reimplemented from Gdk::Drawable.

GdkWindow* Gdk::Window::gobj (   [inline]
 

Reimplemented from Gdk::Drawable.

GdkWindow* Gdk::Window::gobj_copy (  
 

Reimplemented from Gdk::Drawable.

void Gdk::Window::hide (  
 

For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won't be displayed.

Normally done automatically as part of gtk_widget_hide().

void Gdk::Window::iconify (  
 

Asks to iconify (minimize) window .

The window manager may choose to ignore the request, but normally will honor it. Using gtk_window_iconify() is preferred, if you have a Gtk::Window widget.

This function only makes sense when window is a toplevel window.

void Gdk::Window::invalidate_rect ( const Rectangle   rect,
bool    invalidate_children
 

A convenience wrapper around gdk_window_invalidate_region() which invalidates a rectangular region.

See gdk_window_invalidate_region() for details.

Parameters:
rect Rectangle to invalidate.
invalidate_children Whether to also invalidate child windows.

void Gdk::Window::invalidate_region ( GdkRegion   region,
bool    invalidate_children
 

Adds region to the update area for window .

The update area is the region that needs to be redrawn, or "dirty region." The call gdk_window_process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events.

GDK will call gdk_window_process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there's no need to do that manually, you just need to invalidate regions that you know should be redrawn.

The invalidate_children parameter controls whether the region of each child window that intersects region will also be invalidated. If false, then the update area for child windows will remain unaffected. See gdk_window_invalidate_maybe_recurse if you need fine grained control over which children are invalidated.

Parameters:
region A Gdk::Region.
invalidate_children true to also invalidate child windows.

bool Gdk::Window::is_viewable (   const
 

Check if the window and all ancestors of the window are mapped.

(This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK window parents, not to the root window.)

Returns:
true if the window is viewable.

bool Gdk::Window::is_visible (   const
 

Checks whether the window has been mapped (with gdk_window_show() or gdk_window_show_unraised()).

Returns:
true if the window is mapped.

GrabStatus Gdk::Window::keyboard_grab ( bool    owner_events,
guint32    time_
 

void Gdk::Window::keyboard_ungrab ( guint32    time_ [static]
 

Ungrabs the pointer, if it is grabbed by this application.

Parameters:
time_ A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no timestamp is available.

void Gdk::Window::lower (  
 

Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window .

This is true whether or not the other windows are visible.

If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, gdk_window_lower() only requests the restack, does not guarantee it.

Note that gdk_window_show() raises the window again, so don't call this function before gdk_window_show(). (Try gdk_window_show_unraised().)

void Gdk::Window::maximize (  
 

Maximizes the window.

If the window was already maximized, then this function does nothing.

On X11, asks the window manager to maximize window , if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "maximized"; so you can't rely on the maximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably maximizes the window.

void Gdk::Window::merge_child_shapes (  
 

Merges the shape masks for any child windows into the shape mask for window .

i.e. the union of all masks for window and its children will become the new mask for window . See gdk_window_shape_combine_mask().

This function is distinct from gdk_window_set_child_shapes() because it includes window 's shape mask in the set of shapes to be merged.

void Gdk::Window::move ( int    x,
int    y
 

Repositions a window relative to its parent window.

For toplevel windows, window managers may ignore or modify the move; you should probably use gtk_window_move() on a Gtk::Window widget anyway, instead of using GDK functions. For child windows, the move will reliably succeed.

If you're also planning to resize the window, use gdk_window_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters:
x X coordinate relative to window's parent.
y Y coordinate relative to window's parent.

void Gdk::Window::move_resize ( int    x,
int    y,
int    width,
int    height
 

Equivalent to calling gdk_window_move() and gdk_window_resize(), except that both operations are performed at once, avoiding strange visual effects.

(i.e. the user may be able to see the window first move, then resize, if you don't use gdk_window_move_resize().)

Parameters:
x New X position relative to window's parent.
y New Y position relative to window's parent.
width New width.
height New height.

GList* Gdk::Window::peek_children (  
 

Like gdk_window_get_children(), but does not copy the list of children, so the list does not need to be freed.

Returns:
A reference to the list of child windows in window .

GrabStatus Gdk::Window::pointer_grab ( bool    owner_events,
EventMask    event_mask,
guint32    time_
 

Grabs the pointer to a specific window.

Requires a corresponding call to pointer_ungrab().

Arguments:

Parameters:
owner_events Specifies whether events will be reported as is, or relative to the window.
event_mask Masks only interesting events.
time Specifies the time.

GrabStatus Gdk::Window::pointer_grab ( bool    owner_events,
EventMask    event_mask,
const Cursor   cursor,
guint32    time_
 

Grabs the pointer to a specific window.

Requires a corresponding call to pointer_ungrab().

Arguments:

Parameters:
owner_events Specifies whether events will be reported as is, or relative to the window.
event_mask Masks only interesting events.
cursor Changes the cursor for the duration of the grab.
time Specifies the time.

GrabStatus Gdk::Window::pointer_grab ( bool    owner_events,
EventMask    event_mask,
const Glib::RefPtr<const Window>&    confine_to,
const Cursor   cursor,
guint32    time_
 

void Gdk::Window::pointer_ungrab ( guint32    time_ [static]
 

Ungrabs the pointer, if it is grabbed by this application.

Parameters:
time_ A timestamp from a Gdk::Event, or Gdk::CURRENT_TIME if no timestamp is available.

void Gdk::Window::process_all_updates (   [static]
 

Calls gdk_window_process_updates() for all windows (see Gdk::Window) in the application.

void Gdk::Window::process_updates ( bool    update_children
 

Sends one or more expose events to window .

The areas in each expose event will cover the entire update area for the window (see gdk_window_invalidate_region() for details). Normally GDK calls gdk_window_process_all_updates() on your behalf, so there's no need to call this function unless you want to force expose events to be delivered immediately and synchronously (vs. the usual case, where GDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example.

Parameters:
update_children Whether to also process updates for child windows.

void Gdk::Window::raise (  
 

Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window .

This is true whether or not the windows are visible.

If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, gdk_window_raise() only requests the restack, does not guarantee it.

void Gdk::Window::register_dnd (  
 

void Gdk::Window::remove_filter ( GdkFilterFunc    function,
gpointer    data
 

Remove a filter previously added with gdk_window_add_filter().

Parameters:
function Previously-added filter function.
data User data for previously-added filter function.

void Gdk::Window::reparent ( const Glib::RefPtr<Window>&    new_parent,
int    x,
int    y
 

Reparents window into the given new_parent .

The window being reparented will be unmapped as a side effect.

Parameters:
new_parent New parent to move window into.
x X location inside the new parent.
y Y location inside the new parent.

void Gdk::Window::resize ( int    width,
int    height
 

Resizes window ; for toplevel windows, asks the window manager to resize the window.

The window manager may not allow the resize. When using GTK+, use gtk_window_resize() instead of this low-level GDK function.

Windows may not be resized below 1x1.

If you're also planning to move the window, use gdk_window_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters:
width New width of the window.
height New height of the window.

void Gdk::Window::scroll ( int    dx,
int    dy
 

Scroll the contents of window , both pixels and children, by the given amount.

window itself does not move. Portions of the window that the scroll operation brings in from offscreen areas are invalidated. The invalidated region may be bigger than what would strictly be necessary. (For X11, a minimum area will be invalidated if the window has no subwindows, or if the edges of the window's parent do not extend beyond the edges of the window. In other cases, a multi-step process is used to scroll the window which may produce temporary visual artifacts and unnecessary invalidations.)

Parameters:
dx Amount to scroll in the X direction.
dy Amount to scroll in the Y direction.

void Gdk::Window::set_back_pixmap ( const Glib::RefPtr<Pixmap>&    pixmap,
bool    parent_relative
 

Sets the background pixmap of window .

May also be used to set a background of "None" on window , by setting a background pixmap of 0. A background pixmap will be tiled, positioning the first tile at the origin of window , or if parent_relative is true, the tiling will be done based on the origin of the parent window (useful to align tiles in a parent with tiles in a child).

A background pixmap of 0 means that the window will have no background. A window with no background will never have its background filled by the windowing system, instead the window will contain whatever pixels were already in the corresponding area of the display.

The windowing system will normally fill a window with its background when the window is obscured then exposed, and when you call gdk_window_clear().

Parameters:
pixmap A Gdk::Pixmap, or 0.
parent_relative Whether the tiling origin is at the origin of window 's parent.

void Gdk::Window::set_background ( const Color   color
 

Sets the background color of window .

(However, when using GTK+, set the background of a widget with gtk_widget_modify_bg() - if you're an application - or gtk_style_set_background() - if you're implementing a custom widget.)

The color must be allocated; gdk_rgb_find_color() is the best way to allocate a color.

See also gdk_window_set_back_pixmap().

Parameters:
color An allocated Gdk::Color.

void Gdk::Window::set_child_shapes (  
 

Sets the shape mask of window to the union of shape masks for all children of window , ignoring the shape mask of window itself.

Contrast with gdk_window_merge_child_shapes() which includes the shape mask of window in the masks to be merged.

void Gdk::Window::set_cursor (  
 

Use the parent window's cursor.

For top-level windows this means that it will use the default cursor for the ROOT window.

void Gdk::Window::set_cursor ( const Cursor   cursor
 

Sets the mouse pointer for a Gdk::Window.

Use gdk_cursor_new() or gdk_cursor_new_from_pixmap() to create the cursor. To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create a cursor with no pixels in it. Passing 0 for the cursor argument to gdk_window_set_cursor() means that window will use the cursor of its parent window. Most windows should use this default.

Parameters:
cursor A cursor.

void Gdk::Window::set_debug_updates ( bool    setting [static]
 

With update debugging enabled, calls to gdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during gdk_window_process_updates().

The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.

In essence, because the GDK rendering model prevents all flicker, if you are redrawing the same region 400 times you may never notice, aside from noticing a speed problem. Enabling update debugging causes GTK to flicker slowly and noticeably, so you can see exactly what's being redrawn when, in what order.

The --gtk-debug=updates command line option passed to GTK+ programs enables this debug option at application startup time. That's usually more useful than calling gdk_window_set_debug_updates() yourself, though you might want to use this function to enable updates sometime after application startup time.

Parameters:
setting true to turn on update debugging.

void Gdk::Window::set_decorations ( WMDecoration    decorations
 

"Decorations" are the features the window manager adds to a toplevel Gdk::Window.

This function sets the traditional Motif window manager hints that tell the window manager which decorations you would like your window to have. Usually you should use gtk_window_set_decorated() on a Gtk::Window instead of using the GDK function directly.

The decorations argument is the logical OR of the fields in the Gdk::WMDecoration enumeration. If Gdk::DECOR_ALL is included in the mask, the other bits indicate which decorations should be turned off. If Gdk::DECOR_ALL is not included, then the other bits indicate which decorations should be turned on.

Most window managers honor a decorations hint of 0 to disable all decorations, but very few honor all possible combinations of bits.

Parameters:
decorations Decoration hint mask.

void Gdk::Window::set_events ( EventMask    event_mask
 

The event mask for a window determines which events will be reported for that window.

For example, an event mask including Gdk::BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the Gdk::EventMask enumeration.

Parameters:
event_mask Event mask for window .

void Gdk::Window::set_functions ( WMFunction    functions
 

This function isn't really good for much.

It sets the traditional Motif window manager hint for which operations the window manager should allow on a toplevel window. However, few window managers do anything reliable or interesting with this hint. Many ignore it entirely.

The functions argument is the logical OR of values from the Gdk::WMFunction enumeration. If the bitmask includes Gdk::FUNC_ALL, then the other bits indicate which functions to disable; if it doesn't include Gdk::FUNC_ALL, it indicates which functions to enable.

Parameters:
functions Bitmask of operations to allow on window .

void Gdk::Window::set_geometry_hints ( GdkGeometry*    geometry,
WindowHints    geom_mask
 

Sets the geometry hints for window .

Hints flagged in geom_mask are set, hints not flagged in geom_mask are unset. To unset all hints, use a geom_mask of 0 and a geometry of 0.

This function provides hints to the windowing system about acceptable sizes for a toplevel window. The purpose of this is to constrain user resizing, but the windowing system will typically (but is not required to) also constrain the current size of the window to the provided values and constrain programatic resizing via gdk_window_resize() or gdk_window_move_resize().

Note that on X11, this effect has no effect on windows of type GDK_WINDOW_TEMP or windows where override_redirect has been turned on via gdk_window_set_override_redirect() since these windows are not resizable by the user.

Since you can't count on the windowing system doing the constraints for programmatic resizes, you should generally call gdk_window_constrain_size() yourself to determine appropriate sizes.

Parameters:
geometry Geometry hints.
geom_mask Bitmask indicating fields of geometry to pay attention to.

void Gdk::Window::set_group ( const Glib::RefPtr<Window>&    leader
 

Sets the group leader window for window .

By default, GDK sets the group leader for all toplevel windows to a global window implicitly created by GDK. With this function you can override this default.

The group leader window allows the window manager to distinguish all windows that belong to a single application. It may for example allow users to minimize/unminimize all windows belonging to an application at once. You should only set a non-default group window if your application pretends to be multiple applications. The group leader window may not be changed after a window has been mapped (with gdk_window_show() for example).

Parameters:
leader Group leader window.

void Gdk::Window::set_icon ( const Glib::RefPtr<Window>&    icon_window,
const Glib::RefPtr<Pixmap>&    pixmap,
const Glib::RefPtr<Bitmap>&    mask
 

Sets the icon of window as a pixmap or window.

If using GTK+, investigate gtk_window_set_default_icon_list() first, and then gtk_window_set_icon_list() and gtk_window_set_icon(). If those don't meet your needs, look at gdk_window_set_icon_list(). Only if all those are too high-level do you want to fall back to gdk_window_set_icon().

Parameters:
icon_window A Gdk::Window to use for the icon, or 0 to unset.
pixmap A Gdk::Pixmap to use as the icon, or 0 to unset.
mask A 1-bit pixmap (Gdk::Bitmap) to use as mask for pixmap , or 0 to have none.

void Gdk::Window::set_icon_list ( GList*    pixbufs
 

Sets a list of icons for the window.

One of these will be used to represent the window when it has been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality since the window manager may only need to scale the icon by a small amount or not at all.

Parameters:
pixbufs A list of pixbufs, of different sizes.

void Gdk::Window::set_icon_name ( const Glib::ustring   name
 

Windows may have a name used while minimized, distinct from the name they display in their titlebar.

Most of the time this is a bad idea from a user interface standpoint. But you can set such a name with this function, if you like.

Parameters:
name Name of window while iconified (minimized).

void Gdk::Window::set_modal_hint ( bool    modal = true
 

The application can use this hint to tell the window manager that a certain window has modal behaviour.

The window manager can use this information to handle modal windows in a special way.

You should only use this on windows for which you have previously called #gdk_window_set_transient_for()

Parameters:
modal true if the window is modal, false otherwise.

void Gdk::Window::set_override_redirect ( bool    override_redirect = true
 

An override redirect window is not under the control of the window manager.

This means it won't have a titlebar, won't be minimizable, etc. - it will be entirely under the control of the application. The window manager can't see the override redirect window at all.

Override redirect should only be used for short-lived temporary windows, such as popup menus. Gtk::Menu uses an override redirect window in its implementation, for example.

Parameters:
override_redirect true if window should be override redirect.

void Gdk::Window::set_role ( const Glib::ustring   role
 

When using GTK+, typically you should use gtk_window_set_role() instead of this low-level function.

The window manager and session manager use a window's role to distinguish it from other kinds of window in the same application. When an application is restarted after being saved in a previous session, all windows with the same title and role are treated as interchangeable. So if you have two windows with the same title that should be distinguished for session management purposes, you should set the role on those windows. It doesn't matter what string you use for the role, as long as you have a different role for each non-interchangeable kind of window.

Parameters:
role A string indicating its role.

void Gdk::Window::set_skip_pager_hint ( bool    skips_pager = true
 

Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop).

If a window's semantic type as specified with gdk_window_set_type_hint() already fully describes the window, this function should NOT be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

Since: 2.2

Parameters:
skips_pager true to skip the pager.

void Gdk::Window::set_skip_taskbar_hint ( bool    skips_taskbar = true
 

Toggles whether a window should appear in a task list or window list.

If a window's semantic type as specified with gdk_window_set_type_hint() already fully describes the window, this function should NOT be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

Since: 2.2

Parameters:
skips_taskbar true to skip the taskbar.

void Gdk::Window::set_sm_client_id ( const Glib::ustring   sm_client_id [static]
 

Sets the SM_CLIENT_ID property on the application's leader window so that the window manager can save the application's state using the X11R6 ICCCM session management protocol.

See the X Session Management Library documentation for more information on session management and the Inter-Client Communication Conventions Manual (ICCCM) for information on the WM_CLIENT_LEADER property. (Both documents are part of the X Window System distribution.)

Parameters:
sm_client_id The client id assigned by the session manager when the connection was opened, or 0 to remove the property.

bool Gdk::Window::set_static_gravities ( bool    use_static = true
 

Set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity.

This is used if you are implementing scary features that involve deep knowledge of the windowing system. Don't worry about it unless you have to.

Parameters:
use_static true to turn on static gravity.
Returns:
true if the server supports static gravity.

void Gdk::Window::set_title ( const Glib::ustring   title
 

Sets the title of a toplevel window, to be displayed in the titlebar.

If you haven't explicitly set the icon name for the window (using gdk_window_set_icon_name()), the icon name will be set to title as well. title must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). title may not be 0.

Parameters:
title Title of window .

void Gdk::Window::set_transient_for ( const Glib::RefPtr<Window>&    parent
 

Indicates to the window manager that window is a transient dialog associated with the application window parent .

This allows the window manager to do things like center window on parent and keep window above parent .

See gtk_window_set_transient_for() if you're using Gtk::Window or Gtk::Dialog.

Parameters:
parent Another toplevel Gdk::Window.

void Gdk::Window::set_type_hint ( WindowTypeHint    hint
 

The application can use this call to provide a hint to the window manager about the functionality of a window.

The window manager can use this information when determining the decoration and behaviour of the window.

The hint must be set before the window is mapped.

Parameters:
hint A hint of the function this window will have.

void Gdk::Window::set_user_data ( gpointer    user_data
 

For most purposes this function is deprecated in favor of Glib::object_set_data().

However, for historical reasons GTK+ stores the Gtk::Widget that owns a Gdk::Window as user data on the Gdk::Window. So, custom widget implementations should use this function for that. If GTK+ receives an event for a Gdk::Window, and the user data for the window is non-0, GTK+ will assume the user data is a Gtk::Widget, and forward the event to that widget.

Parameters:
user_data User data.

void Gdk::Window::shape_combine_mask ( const Glib::RefPtr<Bitmap>&    mask,
int    x,
int    y
 

Applies a shape mask to window .

Pixels in window corresponding to set bits in the mask will be visible; pixels in window corresponding to unset bits in the mask will be transparent. This gives a non-rectangular window.

If mask is 0, the shape mask will be unset, and the x / y parameters are not used.

On the X11 platform, this uses an X server extension which is widely available on most common platforms, but not available on very old X servers, and occasionally the implementation will be buggy. On servers without the shape extension, this function will do nothing.

This function works on both toplevel and child windows.

Parameters:
mask Shape mask.
x X position of shape mask with respect to window .
y Y position of shape mask with respect to window .

void Gdk::Window::shape_combine_region ( GdkRegion   shape_region,
int    offset_x,
int    offset_y
 

Makes pixels in window outside shape_region be transparent, so that the window may be nonrectangular.

See also gdk_window_shape_combine_mask() to use a bitmap as the mask.

If shape_region is 0, the shape will be unset, so the whole window will be opaque again. offset_x and offset_y are ignored if shape_region is 0.

On the X11 platform, this uses an X server extension which is widely available on most common platforms, but not available on very old X servers, and occasionally the implementation will be buggy. On servers without the shape extension, this function will do nothing.

This function works on both toplevel and child windows.

Parameters:
shape_region Region of window to be non-transparent.
offset_x X position of shape_region in window coordinates.
offset_y Y position of shape_region in window coordinates.

void Gdk::Window::show (  
 

Like gdk_window_show_unraised(), but also raises the window to the top of the window stack (moves the window to the front of the Z-order).

This function maps a window so it's visible onscreen. Its opposite is gdk_window_hide().

When implementing a Gtk::Widget, you should call this function on the widget's Gdk::Window as part of the "map" method.

void Gdk::Window::show_unraised (  
 

Shows a Gdk::Window onscreen, but does not modify its stacking order.

In contrast, gdk_window_show() will raise the window to the top of the window stack.

On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal GDK state, which means that you can't really use XMapWindow() directly on a GDK window).

void Gdk::Window::stick (  
 

"Pins" a window such that it's on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports.

(When using Gtk::Window, gtk_window_stick() may be more useful.)

On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don't support this operation, there's nothing you can do to force it to happen.

void Gdk::Window::thaw_updates (  
 

Thaws a window frozen with gdk_window_freeze_updates().

void Gdk::Window::unfullscreen (  
 

Moves the window out of fullscreen mode.

If the window was not fullscreen, does nothing.

On X11, asks the window manager to move window out of the fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "fullscreen"; so you can't rely on the unfullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Since: 2.2

void Gdk::Window::unmaximize (  
 

Unmaximizes the window.

If the window wasn't maximized, then this function does nothing.

On X11, asks the window manager to unmaximize window , if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don't have a concept of "maximized"; so you can't rely on the unmaximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably unmaximizes the window.

void Gdk::Window::unstick (  
 

Reverse operation for gdk_window_stick(); see gdk_window_stick(), and gtk_window_unstick().

void Gdk::Window::withdraw (  
 

Withdraws a window (unmaps it and asks the window manager to forget about it).

This function is not really useful as gdk_window_hide() automatically withdraws toplevel windows before hiding them.


Friends And Related Function Documentation

Glib::RefPtr<Gdk::Window> wrap ( GdkWindowObject*    object,
bool    take_copy = false
[related]
 


The documentation for this class was generated from the following file:
Generated for gtkmm by Doxygen 1.3-rc1 © 1997-2001