Next: Gtk2::WindowGroup | Previous: Gtk2::Widget | [Gtk2-Perl - Table of Contents] | [Gtk2-Perl - Index] |
Gtk2::Window
A Gtk2::Window is a top-level window displayed on the root window and interacting (or not) with the window manager. It can be an application's main window, a dialog, or a temporary such as a popup splash window.
The default action for a delete-event
(normally from the window
manager close button) is to destroy the window with
$window->destroy
. In your main window you might want to exit
the main loop when that happens.
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit });
If you install a handler for delete-event
and return true, meaning
"don't propagate", you can do something other than destroy the window.
For example
$toplevel->signal_connect (delete_event => sub { if (any_unsaved_documents()) { popup_ask_save_before_exit_dialog(); return Gtk2::EVENT_STOP; # don't go to default destroy } else { return Gtk2::EVENT_PROPAGATE; } });
In a dialog or secondary app window you might not want to destroy but instead just hide ready for later re-use.
$dialog->signal_connect (delete_event => \&Gtk2::Widget::hide_on_delete);
The choice between destroying or hiding is normally just a matter of memory saved against the time to re-create, and how likely the dialog might be needed again. (However if you build windows with Glade it's not particularly easy to re-create them there, so you'll mostly want to just hide in that case.)
A hidden toplevel window is still in
Gtk2::Window->list_toplevels
and that's a good place to search
for an existing window of a desired type to $window->present
again.
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gtk2::Bin +----Gtk2::Window
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable
Since: gtk+ 2.4
Since: gtk+ 2.4
Since: gtk+ 2.4
Since: gtk+ 2.2
$edge (Gtk2::Gdk::WindowEdge)
$button (integer)
$root_x (integer)
$root_y (integer)
$timestamp (unsigned)
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.2
Gets the value set by $window->set_default_icon_list.
Since: gtk+ 2.6
Since: gtk+ 2.4
Since: gtk+ 2.10
Since: gtk+ 2.10
Since: gtk+ 2.6
Since: gtk+ 2.6
Since: gtk+ 2.2
$geometry_widget (Gtk2::Widget)
$geom_mask (Gtk2::Gdk::WindowHints) optional, usually inferred from $geometry
$geometry (scalar) Gtk2::Gdk::Geometry or hashref
See Gtk2::Gdk::Window::set_geometry_hints
on the $geometry and $geom_mask arguments.
Since: gtk+ 2.10
Since: gtk+ 2.4
May croak with a Glib::Error in $@ on failure.
Since: gtk+ 2.2
Retrieves the list of icons set by set_icon_list().
Sets up the icon representing a Gtk2::Window. The icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts.
set_icon_list () allows you to pass in the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is available in; that is, don't scale the image before passing it to GTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.
By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.
Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them.
Since: gtk+ 2.6
Since: gtk+ 2.6
Since: gtk+ 2.4
Since: gtk+ 2.4
Since: gtk+ 2.4
Returns a list of all existing toplevel windows.
Since: gtk+ 2.12
Since: gtk+ 2.12
Since: gtk+ 2.8
Since: gtk+ 2.4
Since: gtk+ 2.2
Since: gtk+ 2.2
Since: gtk+ 2.2
Since: gtk+ 2.2
Since: gtk+ 2.2
Since: gtk+ 2.2
Since: gtk+ 2.12
Since: gtk+ 2.2
Since: gtk+ 2.8
Since: gtk+ 2.8
'north-west' / 'GDK_GRAVITY_NORTH_WEST'
'north' / 'GDK_GRAVITY_NORTH'
'north-east' / 'GDK_GRAVITY_NORTH_EAST'
'west' / 'GDK_GRAVITY_WEST'
'center' / 'GDK_GRAVITY_CENTER'
'east' / 'GDK_GRAVITY_EAST'
'south-west' / 'GDK_GRAVITY_SOUTH_WEST'
'south' / 'GDK_GRAVITY_SOUTH'
'south-east' / 'GDK_GRAVITY_SOUTH_EAST'
'static' / 'GDK_GRAVITY_STATIC'
'shift-mask' / 'GDK_SHIFT_MASK'
'lock-mask' / 'GDK_LOCK_MASK'
'control-mask' / 'GDK_CONTROL_MASK'
'mod1-mask' / 'GDK_MOD1_MASK'
'mod2-mask' / 'GDK_MOD2_MASK'
'mod3-mask' / 'GDK_MOD3_MASK'
'mod4-mask' / 'GDK_MOD4_MASK'
'mod5-mask' / 'GDK_MOD5_MASK'
'button1-mask' / 'GDK_BUTTON1_MASK'
'button2-mask' / 'GDK_BUTTON2_MASK'
'button3-mask' / 'GDK_BUTTON3_MASK'
'button4-mask' / 'GDK_BUTTON4_MASK'
'button5-mask' / 'GDK_BUTTON5_MASK'
'super-mask' / 'GDK_SUPER_MASK'
'hyper-mask' / 'GDK_HYPER_MASK'
'meta-mask' / 'GDK_META_MASK'
'release-mask' / 'GDK_RELEASE_MASK'
'modifier-mask' / 'GDK_MODIFIER_MASK'
'north-west' / 'GDK_WINDOW_EDGE_NORTH_WEST'
'north' / 'GDK_WINDOW_EDGE_NORTH'
'north-east' / 'GDK_WINDOW_EDGE_NORTH_EAST'
'west' / 'GDK_WINDOW_EDGE_WEST'
'east' / 'GDK_WINDOW_EDGE_EAST'
'south-west' / 'GDK_WINDOW_EDGE_SOUTH_WEST'
'south' / 'GDK_WINDOW_EDGE_SOUTH'
'south-east' / 'GDK_WINDOW_EDGE_SOUTH_EAST'
'pos' / 'GDK_HINT_POS'
'min-size' / 'GDK_HINT_MIN_SIZE'
'max-size' / 'GDK_HINT_MAX_SIZE'
'base-size' / 'GDK_HINT_BASE_SIZE'
'aspect' / 'GDK_HINT_ASPECT'
'resize-inc' / 'GDK_HINT_RESIZE_INC'
'win-gravity' / 'GDK_HINT_WIN_GRAVITY'
'user-pos' / 'GDK_HINT_USER_POS'
'user-size' / 'GDK_HINT_USER_SIZE'
'normal' / 'GDK_WINDOW_TYPE_HINT_NORMAL'
'dialog' / 'GDK_WINDOW_TYPE_HINT_DIALOG'
'menu' / 'GDK_WINDOW_TYPE_HINT_MENU'
'toolbar' / 'GDK_WINDOW_TYPE_HINT_TOOLBAR'
'splashscreen' / 'GDK_WINDOW_TYPE_HINT_SPLASHSCREEN'
'utility' / 'GDK_WINDOW_TYPE_HINT_UTILITY'
'dock' / 'GDK_WINDOW_TYPE_HINT_DOCK'
'desktop' / 'GDK_WINDOW_TYPE_HINT_DESKTOP'
'dropdown-menu' / 'GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU'
'popup-menu' / 'GDK_WINDOW_TYPE_HINT_POPUP_MENU'
'tooltip' / 'GDK_WINDOW_TYPE_HINT_TOOLTIP'
'notification' / 'GDK_WINDOW_TYPE_HINT_NOTIFICATION'
'combo' / 'GDK_WINDOW_TYPE_HINT_COMBO'
'dnd' / 'GDK_WINDOW_TYPE_HINT_DND'
'none' / 'GTK_WIN_POS_NONE'
'center' / 'GTK_WIN_POS_CENTER'
'mouse' / 'GTK_WIN_POS_MOUSE'
'center-always' / 'GTK_WIN_POS_CENTER_ALWAYS'
'center-on-parent' / 'GTK_WIN_POS_CENTER_ON_PARENT'
Copyright (C) 2003-2008 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.