logo top
Main Page   Widgets   Namespaces   Book  

Gtk::Window Class Reference
[Widgets]

Inheritance diagram for Gtk::Window:

List of all members.


Detailed Description

Toplevel Window This represents all widgets which are physical windows controlled by the window manager.

The window will be hidden when the window manager's close button is clicked. Override on_delete_event() to stop this.

Gtk::manage() has no effect on Windows because they have no parent Containers.

Public Member Functions

bool activate_default ()
 Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see Gtk::RECEIVES_DEFAULT in Gtk::WidgetFlags), in which case the focused widget is activated.
bool activate_focus ()
 Activates the current focused widget within the window.
void add_accel_group (const Glib::RefPtr<AccelGroup>& accel_group)
 Associate accel_group with window, such that calling gtk_accel_groups_activate() on window will activate accelerators in accel_group.
void add_mnemonic (guint keyval, Widget& target)
 Adds a mnemonic to this window.
void begin_move_drag (int button, int root_x, int root_y, guint32 timestamp)
 Starts moving a window.
void begin_resize_drag (Gdk::WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp)
 Starts resizing a window.
void deiconify ()
 Asks to deiconify (i.e. unminimize) the specified window.
void fullscreen ()
 Asks to place window in the fullscreen state.
Glib::RefPtr<AccelGroupget_accel_group ()
 Returns a default accel group for this window This is a gtkmm-specific function.
bool get_accept_focus () const
 Gets the value set by set_accept_focus().
bool get_decorated () const
 Return value: true if the window has been set to have decorations.
void get_default_size (int& width, int& height) const
 Gets the default size of the window.
bool get_deletable () const
 Return value: true if the window has been set to have a close button.
bool get_destroy_with_parent () const
 Return value: true if the window will be destroyed with its transient parent.
const Widgetget_focus () const
 Retrieves the current focused widget within the window.
Widgetget_focus ()
 Retrieves the current focused widget within the window.
bool get_focus_on_map () const
 Gets the value set by set_focus_on_map().
Glib::RefPtr<const Gdk::Windowget_frame () const
Glib::RefPtr<Gdk::Windowget_frame ()
void get_frame_dimensions (int& left, int& top, int& right, int& bottom) const
 (Note: this is a special-purpose function intended for the framebuffer port; see set_has_frame().
Gdk::Gravity get_gravity () const
 Gets the value set by set_gravity().
Glib::RefPtr<const WindowGroupget_group () const
 Returns: the Gtk::WindowGroup for a window or the default group.
Glib::RefPtr<WindowGroupget_group ()
 Returns: the Gtk::WindowGroup for a window or the default group.
bool get_has_frame () const
 Accessor for whether the window has a frame window exterior to window->window.
Glib::RefPtr<const Gdk::Pixbufget_icon () const
 Gets the value set by set_icon() (or if you've called set_icon_list(), gets the first icon in the icon list).
Glib::RefPtr<Gdk::Pixbufget_icon ()
 Gets the value set by set_icon() (or if you've called set_icon_list(), gets the first icon in the icon list).
Glib::ListHandle< Glib::RefPtr
<const Gdk::Pixbuf >> 
get_icon_list () const
 Retrieves the list of icons set by set_icon_list().
Glib::ListHandle< Glib::RefPtr
<Gdk::Pixbuf >> 
get_icon_list ()
 Retrieves the list of icons set by set_icon_list().
Gdk::ModifierType get_mnemonic_modifier ()
 Return value: the modifier mask used to activate.
bool get_modal () const
 Return value: true if the window is set to be modal and.
double get_opacity () const
 Fetches the requested opacity for this window.
void get_position (int& root_x, int& root_y) const
 This function returns the position you need to pass to move() to keep window in its current position.
bool get_resizable () const
 Gets the value set by set_resizable().
Glib::ustring get_role () const
 Return value: the role of the window if set, or 0.
Glib::RefPtr<const Gdk::Screenget_screen () const
 Return value: a Gdk::Screen.
Glib::RefPtr<Gdk::Screenget_screen ()
 Return value: a Gdk::Screen.
void get_size (int& width, int& height) const
 Obtains the current size of window.
bool get_skip_pager_hint () const
 Gets the value set by set_skip_pager_hint().
bool get_skip_taskbar_hint () const
 Gets the value set by set_skip_taskbar_hint().
Glib::ustring get_title () const
 Retrieves the title of the window.
const Windowget_transient_for () const
 Fetches the transient parent for this window.
Windowget_transient_for ()
 Fetches the transient parent for this window.
Gdk::WindowTypeHint get_type_hint () const
 Gets the type hint for this window.
bool get_urgency_hint () const
 Gets the value set by set_urgency_hint().
WindowType get_window_type () const
const GtkWindow* gobj () const
 Provides access to the underlying C GtkObject.
GtkWindow* gobj ()
 Provides access to the underlying C GtkObject.
void iconify ()
 Asks to iconify (i.e. minimize) the specified window.
bool is_dialog () const
bool is_popup () const
bool is_toplevel () const
void maximize ()
 Asks to maximize window, so that it becomes full-screen.
bool mnemonic_activate (guint keyval, Gdk::ModifierType modifier)
 Activates the targets associated with the mnemonic.
void move (int x, int y)
 Asks the window manager to move window to the given position.
bool parse_geometry (const Glib::ustring& geometry)
 Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this.
void present (guint32 timestamp)
 Presents a window to the user in response to a user interaction.
void present ()
 Presents a window to the user.
Glib::PropertyProxy_ReadOnly
<bool> 
property_allow_grow () const
 If TRUE.
Glib::PropertyProxy<bool> property_allow_grow ()
 If TRUE.
Glib::PropertyProxy_ReadOnly
<bool> 
property_allow_shrink () const
 If TRUE.
Glib::PropertyProxy<bool> property_allow_shrink ()
 If TRUE.
Glib::PropertyProxy_ReadOnly
<bool> 
property_decorated () const
 Whether the window should be decorated by the window manager.
Glib::PropertyProxy<bool> property_decorated ()
 Whether the window should be decorated by the window manager.
Glib::PropertyProxy_ReadOnly<int> property_default_height () const
 The default height of the window.
Glib::PropertyProxy<int> property_default_height ()
 The default height of the window.
Glib::PropertyProxy_ReadOnly<int> property_default_width () const
 The default width of the window.
Glib::PropertyProxy<int> property_default_width ()
 The default width of the window.
Glib::PropertyProxy_ReadOnly
<bool> 
property_deletable () const
 Whether the window frame should have a close button.
Glib::PropertyProxy<bool> property_deletable ()
 Whether the window frame should have a close button.
Glib::PropertyProxy_ReadOnly
<bool> 
property_destroy_with_parent () const
 If this window should be destroyed when the parent is destroyed.
Glib::PropertyProxy<bool> property_destroy_with_parent ()
 If this window should be destroyed when the parent is destroyed.
Glib::PropertyProxy_ReadOnly
<Gdk::Gravity
property_gravity () const
 The window gravity of the window.
Glib::PropertyProxy<Gdk::Gravityproperty_gravity ()
 The window gravity of the window.
Glib::PropertyProxy_ReadOnly
<bool> 
property_has_toplevel_focus () const
 Whether the input focus is within this GtkWindow.
Glib::PropertyProxy_ReadOnly
<Glib::RefPtr<Gdk::Pixbuf>> 
property_icon () const
 Icon for this window.
Glib::PropertyProxy
<Glib::RefPtr<Gdk::Pixbuf>> 
property_icon ()
 Icon for this window.
Glib::PropertyProxy_ReadOnly
<bool> 
property_is_active () const
 Whether the toplevel is the current active window.
Glib::PropertyProxy_ReadOnly
<bool> 
property_modal () const
 If TRUE.
Glib::PropertyProxy<bool> property_modal ()
 If TRUE.
Glib::PropertyProxy_ReadOnly
<double> 
property_opacity () const
 The opacity of the window.
Glib::PropertyProxy<double> property_opacity ()
 The opacity of the window.
Glib::PropertyProxy_ReadOnly
<bool> 
property_resizable () const
 If TRUE.
Glib::PropertyProxy<bool> property_resizable ()
 If TRUE.
Glib::PropertyProxy_ReadOnly
<Glib::ustring
property_role () const
 Unique identifier for the window to be used when restoring a session.
Glib::PropertyProxy
<Glib::ustring
property_role ()
 Unique identifier for the window to be used when restoring a session.
Glib::PropertyProxy_ReadOnly
<Glib::RefPtr<Gdk::Screen>> 
property_screen () const
 The screen where this window will be displayed.
Glib::PropertyProxy
<Glib::RefPtr<Gdk::Screen>> 
property_screen ()
 The screen where this window will be displayed.
Glib::PropertyProxy_ReadOnly
<bool> 
property_skip_pager_hint () const
 TRUE if the window should not be in the pager.
Glib::PropertyProxy<bool> property_skip_pager_hint ()
 TRUE if the window should not be in the pager.
Glib::PropertyProxy_ReadOnly
<bool> 
property_skip_taskbar_hint () const
 TRUE if the window should not be in the task bar.
Glib::PropertyProxy<bool> property_skip_taskbar_hint ()
 TRUE if the window should not be in the task bar.
Glib::PropertyProxy_ReadOnly
<Glib::ustring
property_title () const
 The title of the window.
Glib::PropertyProxy
<Glib::ustring
property_title ()
 The title of the window.
Glib::PropertyProxy_ReadOnly
<Window*> 
property_transient_for () const
 The transient parent of the dialog.
Glib::PropertyProxy<Window*> property_transient_for ()
 The transient parent of the dialog.
Glib::PropertyProxy_ReadOnly
<GdkWindowTypeHint> 
property_type_hint () const
 Hint to help the desktop environment understand what kind of window this is and how to treat it.
Glib::PropertyProxy
<GdkWindowTypeHint> 
property_type_hint ()
 Hint to help the desktop environment understand what kind of window this is and how to treat it.
Glib::PropertyProxy_ReadOnly
<bool> 
property_urgency_hint () const
 TRUE if the window should be brought to the user's attention.
Glib::PropertyProxy<bool> property_urgency_hint ()
 TRUE if the window should be brought to the user's attention.
Glib::PropertyProxy_ReadOnly
<WindowPosition
property_window_position () const
 The initial position of the window.
Glib::PropertyProxy
<WindowPosition
property_window_position ()
 The initial position of the window.
virtual void raise ()
 Brings the window to the front.
void remove_accel_group (const Glib::RefPtr<AccelGroup>& accel_group)
 Reverses the effects of add_accel_group().
void remove_mnemonic (guint keyval, Widget& target)
 Removes a mnemonic from this window.
void reshow_with_initial_size ()
 Hides window, then reshows it, resetting the default size and position of the window.
void resize (int width, int height)
 Resizes the window as if the user had done so, obeying geometry constraints.
void set_accept_focus (bool setting=true)
 Windows may set a hint asking the desktop environment not to receive the input focus.
void set_decorated (bool setting=true)
 By default, windows are decorated with a title bar, resize controls, etc.
void set_default (Gtk::Widget& default_widget)
 The default widget is the widget that's activated when the user presses Enter in a dialog (for example).
void set_default_size (int width, int height)
 Sets the default size of a window.
void set_deletable (bool setting=true)
 By default, windows have a close button in the window frame.
void set_focus (Gtk::Widget& focus)
 If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window.
void set_focus_on_map (bool setting=true)
 Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped.
void set_frame_dimensions (int left, int top, int right, int bottom)
 (Note: this is a special-purpose function intended for the framebuffer port; see set_has_frame().
void set_geometry_hints (Widget& geometry_widget, const Gdk::Geometry& geometry, Gdk::WindowHints geom_mask)
 This function sets up hints about how a window can be resized by the user.
void set_gravity (Gdk::Gravity gravity)
 Window gravity defines the meaning of coordinates passed to move().
void set_has_frame (bool setting=true)
 (Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border.
void set_icon (const Glib::RefPtr<Gdk::Pixbuf>& icon)
 Sets up the icon representing a Gtk::Window.
bool set_icon_from_file (const std::string& filename)
 Sets the icon for the window.
void set_icon_list (const Glib::ListHandle<Glib::RefPtr<Gdk::Pixbuf>>& list)
 Sets up the icon representing a Gtk::Window.
void set_keep_above (bool setting=true)
 Asks to keep window above, so that it stays on top.
void set_keep_below (bool setting=true)
 Asks to keep window below, so that it stays in bottom.
virtual void set_manage ()
 Overriden to warn that it doesn't make sense to use Gtk::manage() on this class because it has no parent container.
void set_mnemonic_modifier (Gdk::ModifierType modifier)
 Sets the mnemonic modifier for this window.
void set_modal (bool modal=true)
 Sets a window modal or non-modal.
void set_opacity (double opacity)
 Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque.
void set_position (WindowPosition position)
 Sets a position constraint for this window.
void set_resizable (bool resizable=true)
 Sets whether the user can resize a window.
void set_role (const Glib::ustring& role)
 This function is only useful on X11, not with other GTK+ targets.
void set_screen (const Glib::RefPtr<Gdk::Screen>& screen)
 Sets the Gdk::Screen where the window is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.
void set_skip_pager_hint (bool setting=true)
 Windows may set a hint asking the desktop environment not to display the window in the pager.
void set_skip_taskbar_hint (bool setting=true)
 Windows may set a hint asking the desktop environment not to display the window in the task bar.
void set_title (const Glib::ustring& title)
 Sets the title of the Gtk::Window.
void set_transient_for (Window& parent)
 Dialog windows should be set transient for the main application window they were spawned from.
void set_type_hint (Gdk::WindowTypeHint hint)
 By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.
void set_urgency_hint (bool setting=true)
 Windows may set a hint asking the desktop environment to draw the users attention to the window.
void set_wmclass (const Glib::ustring& wmclass_name, const Glib::ustring& wmclass_class)
 Don't use this function.
Glib::SignalProxy1< bool,
GdkEvent* > 
signal_frame_event ()
Glib::SignalProxy1< void,
Widget* > 
signal_set_focus ()
void stick ()
 Asks to stick window, which means that it will appear on all user desktops.
void unfullscreen ()
 Asks to toggle off the fullscreen state for window.
void unmaximize ()
 Asks to unmaximize window.
void unset_default ()
void unset_focus ()
void unstick ()
 Asks to unstick window, which means that it will appear on only one of the user's desktops.
 Window (WindowType type=WINDOW_TOPLEVEL)
virtual ~Window ()

Static Public Member Functions

static Glib::ListHandle
<Glib::RefPtr<Gdk::Pixbuf>> 
get_default_icon_list ()
 Gets the value set by Gtk::Window::set_default_icon_list().
static Glib::ListHandle<Window*> list_toplevels ()
 Return value: list of toplevel widgets.
static void set_auto_startup_notification (bool setting=true)
 By default, after showing the first Gtk::Window, GTK+ calls gdk_notify_startup_complete().
static void set_default_icon (const Glib::RefPtr<Gdk::Pixbuf>& icon)
 Sets an icon to be used as fallback for windows that haven't had set_icon() called on them from a pixbuf.
static bool set_default_icon_from_file (const std::string& filename)
 Sets an icon to be used as fallback for windows that haven't had set_icon_list() called on them from a file on disk.
static void set_default_icon_list (const Glib::ListHandle<Glib::RefPtr<Gdk::Pixbuf>>& list)
 Sets an icon list to be used as fallback for windows that haven't had set_icon_list() called on them to set up a window-specific icon list.
static void set_default_icon_name (const Glib::ustring& name)
 Sets an icon to be used as fallback for windows that haven't had set_icon_list() called on them from a named themed icon, see set_icon_name().

Protected Member Functions

void _destroy_c_instance ()
void destroy_ ()
virtual bool on_frame_event (GdkEvent* event)
virtual void on_set_focus (Widget* focus)

Related Functions

(Note that these are not member functions.)

Gtk::Windowwrap (GtkWindow* object, bool take_copy=false)
 A Glib::wrap() method for this object.


Constructor & Destructor Documentation

virtual Gtk::Window::~Window (  )  [virtual]

Gtk::Window::Window ( WindowType  type = WINDOW_TOPLEVEL  )  [explicit]


Member Function Documentation

void Gtk::Window::_destroy_c_instance (  )  [protected]

bool Gtk::Window::activate_default (  ) 

Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see Gtk::RECEIVES_DEFAULT in Gtk::WidgetFlags), in which case the focused widget is activated.

Returns:
true if a widget got activated.

bool Gtk::Window::activate_focus (  ) 

Activates the current focused widget within the window.

Returns:
true if a widget got activated.

void Gtk::Window::add_accel_group ( const Glib::RefPtr<AccelGroup>&  accel_group  ) 

Associate accel_group with window, such that calling gtk_accel_groups_activate() on window will activate accelerators in accel_group.

Parameters:
accel_group A Gtk::AccelGroup.

void Gtk::Window::add_mnemonic ( guint  keyval,
Widget target 
)

Adds a mnemonic to this window.

Parameters:
keyval The mnemonic.
target The widget that gets activated by the mnemonic.

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

Starts moving a window.

This function is used if an application has window movement grips. When GDK can support it, the window movement will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.

Parameters:
button Mouse button that initiated the drag.
root_x X position where the user clicked to initiate the drag, in root window coordinates.
root_y Y position where the user clicked to initiate the drag.
timestamp Timestamp from the click event that initiated the drag.

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

Starts resizing a window.

This function is used if an application has window resizing controls. When GDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.

Parameters:
button Mouse button that initiated the drag.
edge Position of the resize control.
root_x X position where the user clicked to initiate the drag, in root window coordinates.
root_y Y position where the user clicked to initiate the drag.
timestamp Timestamp from the click event that initiated the drag.

void Gtk::Window::deiconify (  ) 

Asks to deiconify (i.e. unminimize) the specified window.

Note that you shouldn't assume the window is definitely deiconified afterward, because other entities (e.g. the user or window manager) could iconify it again before your code which assumes deiconification gets to run.

You can track iconification via the "window_state_event" signal on Gtk::Widget.

void Gtk::Window::destroy_ (  )  [protected]

void Gtk::Window::fullscreen (  ) 

Asks to place window in the fullscreen state.

Note that you shouldn't assume the window is definitely full screen afterward, because other entities (e.g. the user or window manager) could unfullscreen it again, and not all window managers honor requests to fullscreen windows. But normally the window will end up fullscreen. Just don't write code that crashes if not.

You can track the fullscreen state via the "window_state_event" signal on Gtk::Widget.

Since gtkmm 2.2:

Glib::RefPtr<AccelGroup> Gtk::Window::get_accel_group (  ) 

Returns a default accel group for this window This is a gtkmm-specific function.

This accel group can not be removed.

bool Gtk::Window::get_accept_focus (  )  const

Gets the value set by set_accept_focus().

Returns:
true if window should receive the input focus
Since gtkmm 2.4:

bool Gtk::Window::get_decorated (  )  const

Return value: true if the window has been set to have decorations.

Returns:
true if the window has been set to have decorations.

static Glib::ListHandle<Glib::RefPtr<Gdk::Pixbuf>> Gtk::Window::get_default_icon_list (  )  [static]

Gets the value set by Gtk::Window::set_default_icon_list().

Returns:
Copy of default icon list.

void Gtk::Window::get_default_size ( int &  width,
int &  height 
) const

Gets the default size of the window.

A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimension, so the "natural" size of the window will be used.

Parameters:
width Location to store the default width.
height Location to store the default height.

bool Gtk::Window::get_deletable (  )  const

Return value: true if the window has been set to have a close button.

Returns:
true if the window has been set to have a close button
Since gtkmm 2.10:

bool Gtk::Window::get_destroy_with_parent (  )  const

Return value: true if the window will be destroyed with its transient parent.

Returns:
true if the window will be destroyed with its transient parent.

const Widget* Gtk::Window::get_focus (  )  const

Retrieves the current focused widget within the window.

Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then GTK_WIDGET_HAS_FOCUS (widget) will not be true for the widget.

Returns:
The currently focused widget, or 0 if there is none.

Widget* Gtk::Window::get_focus (  ) 

Retrieves the current focused widget within the window.

Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then GTK_WIDGET_HAS_FOCUS (widget) will not be true for the widget.

Returns:
The currently focused widget, or 0 if there is none.

bool Gtk::Window::get_focus_on_map (  )  const

Gets the value set by set_focus_on_map().

Returns:
true if window should receive the input focus when mapped.
Since gtkmm 2.6:

Glib::RefPtr<const Gdk::Window> Gtk::Window::get_frame (  )  const

Glib::RefPtr<Gdk::Window> Gtk::Window::get_frame (  ) 

void Gtk::Window::get_frame_dimensions ( int &  left,
int &  top,
int &  right,
int &  bottom 
) const

(Note: this is a special-purpose function intended for the framebuffer port; see set_has_frame().

It will not return the size of the window border drawn by the window manager, which is the normal case when using a windowing system. See gdk_window_get_frame_extents() to get the standard window border extents.)

Retrieves the dimensions of the frame window for this toplevel. See set_has_frame(), set_frame_dimensions().

Parameters:
left Location to store the width of the frame at the left.
top Location to store the height of the frame at the top.
right Location to store the width of the frame at the returns.
bottom Location to store the height of the frame at the bottom.

Gdk::Gravity Gtk::Window::get_gravity (  )  const

Gets the value set by set_gravity().

Returns:
Window gravity.

Glib::RefPtr<const WindowGroup> Gtk::Window::get_group (  )  const

Returns: the Gtk::WindowGroup for a window or the default group.

Returns:
The Gtk::WindowGroup for a window or the default group
Since gtkmm 2.10:

Glib::RefPtr<WindowGroup> Gtk::Window::get_group (  ) 

Returns: the Gtk::WindowGroup for a window or the default group.

Ret