1Gtk2::Window(3)       User Contributed Perl Documentation      Gtk2::Window(3)
2
3
4

NAME

6       Gtk2::Window
7

DESCRIPTION

9       A Gtk2::Window is a top-level window displayed on the root window and
10       interacting (or not) with the window manager.  It can be an
11       application's main window, a dialog, or a temporary such as a popup
12       splash window.
13
14   Delete Event and Destroy
15       The default action for a "delete-event" (normally from the window
16       manager close button) is to destroy the window with "$window->destroy".
17       In your main window you might want to exit the main loop when that
18       happens.
19
20           $toplevel->signal_connect (destroy => sub { Gtk2->main_quit });
21
22       If you install a handler for "delete-event" and return true, meaning
23       "don't propagate", you can do something other than destroy the window.
24       For example
25
26           $toplevel->signal_connect (delete_event => sub {
27              if (any_unsaved_documents()) {
28                popup_ask_save_before_exit_dialog();
29                return Gtk2::EVENT_STOP;  # don't go to default destroy
30              } else {
31                return Gtk2::EVENT_PROPAGATE;
32              }
33           });
34
35       In a dialog or secondary app window you might not want to destroy but
36       instead just hide ready for later re-use.
37
38           $dialog->signal_connect
39             (delete_event => \&Gtk2::Widget::hide_on_delete);
40
41       The choice between destroying or hiding is normally just a matter of
42       memory saved against the time to re-create, and how likely the dialog
43       might be needed again.  (However if you build windows with Glade it's
44       not particularly easy to re-create them there, so you'll mostly want to
45       just hide in that case.)
46
47       A hidden toplevel window is still in "Gtk2::Window->list_toplevels" and
48       that's a good place to search for an existing window of a desired type
49       to "$window->present" again.
50

HIERARCHY

52         Glib::Object
53         +----Glib::InitiallyUnowned
54              +----Gtk2::Object
55                   +----Gtk2::Widget
56                        +----Gtk2::Container
57                             +----Gtk2::Bin
58                                  +----Gtk2::Window
59

INTERFACES

61         Glib::Object::_Unregistered::AtkImplementorIface
62         Gtk2::Buildable
63

METHODS

65   widget = Gtk2::Window->new ($type=GTK_WINDOW_TOPLEVEL)
66           ·   $type (Gtk2::WindowType)
67
68   boolean = $window->get_accept_focus
69           Since: gtk+ 2.4
70
71   $window->set_accept_focus ($setting)
72           ·   $setting (boolean)
73
74           Since: gtk+ 2.4
75
76   boolean = $window->activate_default
77   boolean = $window->activate_focus
78   boolean = $window->activate_key ($event)
79           ·   $event (Gtk2::Gdk::Event::Key)
80
81           Since: gtk+ 2.4
82
83   $window->add_accel_group ($accel_group)
84           ·   $accel_group (Gtk2::AccelGroup)
85
86   $window->add_embedded_xid ($xid)
87           ·   $xid (integer)
88
89   $window->add_mnemonic ($keyval, $target)
90           ·   $keyval (integer)
91
92           ·   $target (Gtk2::Widget)
93
94   Gtk2::Window->set_auto_startup_notification ($setting)
95           ·   $setting (boolean)
96
97           Since: gtk+ 2.2
98
99   $window->begin_move_drag ($button, $root_x, $root_y, $timestamp)
100           ·   $button (integer)
101
102           ·   $root_x (integer)
103
104           ·   $root_y (integer)
105
106           ·   $timestamp (unsigned)
107
108   $window->begin_resize_drag ($edge, $button, $root_x, $root_y, $timestamp)
109           ·   $edge (Gtk2::Gdk::WindowEdge)
110
111           ·   $button (integer)
112
113           ·   $root_x (integer)
114
115           ·   $root_y (integer)
116
117           ·   $timestamp (unsigned)
118
119   boolean = $window->get_decorated
120   $window->set_decorated ($setting)
121           ·   $setting (boolean)
122
123   Gtk2::Window->set_default_icon_from_file ($filename)
124   $window->set_default_icon_from_file ($filename)
125           ·   $filename (localized file name)
126
127           May croak with a Glib::Error in $@ on failure.
128
129           Since: gtk+ 2.2
130
131   list = Gtk2::Window->get_default_icon_list
132           Gets the value set by $window->set_default_icon_list.
133
134   $window->set_default_icon_list ($pixbuf1, ...)
135           ·   ... (list)
136
137           ·   $pixbuf1 (Gtk2::Gdk::Pixbuf)
138
139   Gtk2::Window->set_default_icon_name ($name)
140           ·   $name (string)
141
142           Since: gtk+ 2.6
143
144   Gtk2::Window->set_default_icon ($icon)
145           ·   $icon (Gtk2::Gdk::Pixbuf)
146
147           Since: gtk+ 2.4
148
149   $window->set_default ($default_widget)
150           ·   $default_widget (Gtk2::Widget or undef)
151
152   (width, height) = $window->get_default_size
153   $window->set_default_size ($width, $height)
154           ·   $width (integer)
155
156           ·   $height (integer)
157
158   widget or undef = $window->get_default_widget
159           Since: gtk+ 2.14
160
161   $window->deiconify
162   boolean = $window->get_deletable
163           Since: gtk+ 2.10
164
165   $window->set_deletable ($setting)
166           ·   $setting (boolean)
167
168           Since: gtk+ 2.10
169
170   boolean = $window->get_destroy_with_parent
171   $window->set_destroy_with_parent ($setting)
172           ·   $setting (boolean)
173
174   widget or undef = $window->get_focus
175   boolean = $window->get_focus_on_map
176           Since: gtk+ 2.6
177
178   $window->set_focus_on_map ($setting)
179           ·   $setting (boolean)
180
181           Since: gtk+ 2.6
182
183   $window->set_focus ($focus=undef)
184           ·   $focus (Gtk2::Widget or undef)
185
186   (left, top, right, bottom) = $window->get_frame_dimensions
187   $window->set_frame_dimensions ($left, $top, $right, $bottom)
188           ·   $left (integer)
189
190           ·   $top (integer)
191
192           ·   $right (integer)
193
194           ·   $bottom (integer)
195
196   $window->fullscreen
197           Since: gtk+ 2.2
198
199   $window->set_geometry_hints ($geometry_widget, $geometry)
200   $window->set_geometry_hints ($geometry_widget, $geometry, $geom_mask)
201           ·   $geometry_widget (Gtk2::Widget)
202
203           ·   $geometry_ref (scalar)
204
205           ·   $geom_mask_sv (scalar)
206
207           ·   $geom_mask (Gtk2::Gdk::WindowHints) optional, usually inferred
208               from $geometry
209
210           ·   $geometry (Gtk2::Gdk::Geometry)
211
212           The geom_mask argument, describing which fields in the geometry are
213           valid, is optional.  If omitted it will be inferred from the
214           geometry itself.
215
216   gravity = $window->get_gravity
217   $window->set_gravity ($gravity)
218           ·   $gravity (Gtk2::Gdk::Gravity)
219
220   windowgroup or undef = $window->get_group
221           Since: gtk+ 2.10
222
223   boolean = $window->get_has_frame
224   $window->set_has_frame ($setting)
225           ·   $setting (boolean)
226
227   boolean = $window->has_toplevel_focus
228           Since: gtk+ 2.4
229
230   $window->set_icon_from_file ($filename)
231           ·   $filename (localized file name)
232
233           May croak with a Glib::Error in $@ on failure.
234
235           Since: gtk+ 2.2
236
237   pixbuf or undef = $window->get_icon
238   list = $window->get_icon_list
239           Retrieves the list of icons set by set_icon_list ().
240
241   $window->set_icon_list (...)
242           ·   ... (list) of Gtk2::Gdk::Pixbuf's
243
244           Sets up the icon representing a Gtk2::Window. The icon is used when
245           the window is minimized (also known as iconified). Some window
246           managers or desktop environments may also place it in the window
247           frame, or display it in other contexts.
248
249           set_icon_list () allows you to pass in the same icon in several
250           hand-drawn sizes. The list should contain the natural sizes your
251           icon is available in; that is, don't scale the image before passing
252           it to GTK+.  Scaling is postponed until the last minute, when the
253           desired final size is known, to allow best quality.
254
255           By passing several sizes, you may improve the final image quality
256           of the icon, by reducing or eliminating automatic image scaling.
257
258           Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
259           larger images (64x64, 128x128) if you have them.
260
261   string or undef = $window->get_icon_name
262           Since: gtk+ 2.6
263
264   $window->set_icon_name ($name)
265           ·   $name (string)
266
267           Since: gtk+ 2.6
268
269   $window->set_icon ($icon)
270           ·   $icon (Gtk2::Gdk::Pixbuf or undef)
271
272   $window->iconify
273   boolean = $window->is_active
274           Since: gtk+ 2.4
275
276   $window->set_keep_above ($setting)
277           ·   $setting (boolean)
278
279           Since: gtk+ 2.4
280
281   $window->set_keep_below ($setting)
282           ·   $setting (boolean)
283
284           Since: gtk+ 2.4
285
286   list = Gtk2::Window->list_toplevels
287           Returns a list of all existing toplevel windows.
288
289   $window->maximize
290   boolean = $window->mnemonic_activate ($keyval, $modifier)
291           ·   $keyval (integer)
292
293           ·   $modifier (Gtk2::Gdk::ModifierType)
294
295   modifiertype = $window->get_mnemonic_modifier
296   $window->set_mnemonic_modifier ($modifier)
297           ·   $modifier (Gtk2::Gdk::ModifierType)
298
299   boolean = $window->get_modal
300   $window->set_modal ($modal)
301           ·   $modal (boolean)
302
303   $window->move ($x, $y)
304           ·   $x (integer)
305
306           ·   $y (integer)
307
308   double = $window->get_opacity
309           Since: gtk+ 2.12
310
311   $window->set_opacity ($opacity)
312           ·   $opacity (double)
313
314           Since: gtk+ 2.12
315
316   boolean = $window->parse_geometry ($geometry)
317           ·   $geometry (string)
318
319   (root_x, root_y) = $window->get_position
320   $window->set_position ($position)
321           ·   $position (Gtk2::WindowPosition)
322
323   $window->present
324   $window->present_with_time ($timestamp)
325           ·   $timestamp (unsigned)
326
327           Since: gtk+ 2.8
328
329   boolean = $window->propagate_key_event ($event)
330           ·   $event (Gtk2::Gdk::Event::Key)
331
332           Since: gtk+ 2.4
333
334   $window->remove_accel_group ($accel_group)
335           ·   $accel_group (Gtk2::AccelGroup)
336
337   $window->remove_embedded_xid ($xid)
338           ·   $xid (integer)
339
340   $window->remove_mnemonic ($keyval, $target)
341           ·   $keyval (integer)
342
343           ·   $target (Gtk2::Widget)
344
345   $window->reshow_with_initial_size
346   boolean = $window->get_resizable
347   $window->set_resizable ($resizable)
348           ·   $resizable (boolean)
349
350   $window->resize ($width, $height)
351           ·   $width (integer)
352
353           ·   $height (integer)
354
355   string = $window->get_role
356   $window->set_role ($role)
357           ·   $role (string)
358
359   screen = $window->get_screen
360           Since: gtk+ 2.2
361
362   $window->set_screen ($screen)
363           ·   $screen (Gtk2::Gdk::Screen)
364
365           Since: gtk+ 2.2
366
367   (width, height) = $window->get_size
368   boolean = $window->get_skip_pager_hint
369           Since: gtk+ 2.2
370
371   $window->set_skip_pager_hint ($setting)
372           ·   $setting (boolean)
373
374           Since: gtk+ 2.2
375
376   boolean = $window->get_skip_taskbar_hint
377           Since: gtk+ 2.2
378
379   $window->set_skip_taskbar_hint ($setting)
380           ·   $setting (boolean)
381
382           Since: gtk+ 2.2
383
384   $window->set_startup_id ($startup_id)
385           ·   $startup_id (string)
386
387           Since: gtk+ 2.12
388
389   $window->stick
390   string = $window->get_title
391   $window->set_title ($title=undef)
392           ·   $title (string or undef)
393
394   window or undef = $window->get_transient_for
395   $window->set_transient_for ($parent)
396           ·   $parent (Gtk2::Window or undef)
397
398   windowtypehint = $window->get_type_hint
399   $window->set_type_hint ($hint)
400           ·   $hint (Gtk2::Gdk::WindowTypeHint)
401
402   $window->unfullscreen
403           Since: gtk+ 2.2
404
405   $window->unmaximize
406   $window->unstick
407   boolean = $window->get_urgency_hint
408           Since: gtk+ 2.8
409
410   $window->set_urgency_hint ($setting)
411           ·   $setting (boolean)
412
413           Since: gtk+ 2.8
414
415   $window->set_wmclass ($wmclass_name, $wmclass_class)
416           ·   $wmclass_name (string)
417
418           ·   $wmclass_class (string)
419

PROPERTIES

421       'accept-focus' (boolean : readable / writable / private)
422           TRUE if the window should receive the input focus.
423
424       'allow-grow' (boolean : readable / writable / private)
425           If TRUE, users can expand the window beyond its minimum size
426
427       'allow-shrink' (boolean : readable / writable / private)
428           If TRUE, the window has no mimimum size. Setting this to TRUE is
429           99% of the time a bad idea
430
431       'decorated' (boolean : readable / writable / private)
432           Whether the window should be decorated by the window manager
433
434       'default-height' (integer : readable / writable / private)
435           The default height of the window, used when initially showing the
436           window
437
438       'default-width' (integer : readable / writable / private)
439           The default width of the window, used when initially showing the
440           window
441
442       'deletable' (boolean : readable / writable / private)
443           Whether the window frame should have a close button
444
445       'destroy-with-parent' (boolean : readable / writable / private)
446           If this window should be destroyed when the parent is destroyed
447
448       'focus-on-map' (boolean : readable / writable / private)
449           TRUE if the window should receive the input focus when mapped.
450
451       'gravity' (Gtk2::Gdk::Gravity : readable / writable / private)
452           The window gravity of the window
453
454       'has-toplevel-focus' (boolean : readable / private)
455           Whether the input focus is within this GtkWindow
456
457       'icon' (Gtk2::Gdk::Pixbuf : readable / writable / private)
458           Icon for this window
459
460       'icon-name' (string : readable / writable / private)
461           Name of the themed icon for this window
462
463       'is-active' (boolean : readable / private)
464           Whether the toplevel is the current active window
465
466       'mnemonics-visible' (boolean : readable / writable / private)
467           Whether mnemonics are currently visible in this window
468
469       'modal' (boolean : readable / writable / private)
470           If TRUE, the window is modal (other windows are not usable while
471           this one is up)
472
473       'opacity' (double : readable / writable / private)
474           The opacity of the window, from 0 to 1
475
476       'resizable' (boolean : readable / writable / private)
477           If TRUE, users can resize the window
478
479       'role' (string : readable / writable / private)
480           Unique identifier for the window to be used when restoring a
481           session
482
483       'screen' (Gtk2::Gdk::Screen : readable / writable / private)
484           The screen where this window will be displayed
485
486       'skip-pager-hint' (boolean : readable / writable / private)
487           TRUE if the window should not be in the pager.
488
489       'skip-taskbar-hint' (boolean : readable / writable / private)
490           TRUE if the window should not be in the task bar.
491
492       'startup-id' (string : writable / private)
493           Unique startup identifier for the window used by startup-
494           notification
495
496       'title' (string : readable / writable / private)
497           The title of the window
498
499       'transient-for' (Gtk2::Window : readable / writable / construct /
500       private)
501           The transient parent of the dialog
502
503       'type' (Gtk2::WindowType : readable / writable / construct-only /
504       private)
505           The type of the window
506
507       'type-hint' (Gtk2::Gdk::WindowTypeHint : readable / writable / private)
508           Hint to help the desktop environment understand what kind of window
509           this is and how to treat it.
510
511       'urgency-hint' (boolean : readable / writable / private)
512           TRUE if the window should be brought to the user's attention.
513
514       'window-position' (Gtk2::WindowPosition : readable / writable /
515       private)
516           The initial position of the window
517

SIGNALS

519       keys-changed (Gtk2::Window)
520       set-focus (Gtk2::Window, Gtk2::Widget)
521       boolean = frame-event (Gtk2::Window, Gtk2::Gdk::Event)
522       activate-focus (Gtk2::Window)
523       activate-default (Gtk2::Window)
524

ENUMS AND FLAGS

526   enum Gtk2::Gdk::Gravity
527       ·   'north-west' / 'GDK_GRAVITY_NORTH_WEST'
528
529       ·   'north' / 'GDK_GRAVITY_NORTH'
530
531       ·   'north-east' / 'GDK_GRAVITY_NORTH_EAST'
532
533       ·   'west' / 'GDK_GRAVITY_WEST'
534
535       ·   'center' / 'GDK_GRAVITY_CENTER'
536
537       ·   'east' / 'GDK_GRAVITY_EAST'
538
539       ·   'south-west' / 'GDK_GRAVITY_SOUTH_WEST'
540
541       ·   'south' / 'GDK_GRAVITY_SOUTH'
542
543       ·   'south-east' / 'GDK_GRAVITY_SOUTH_EAST'
544
545       ·   'static' / 'GDK_GRAVITY_STATIC'
546
547   flags Gtk2::Gdk::ModifierType
548       ·   'shift-mask' / 'GDK_SHIFT_MASK'
549
550       ·   'lock-mask' / 'GDK_LOCK_MASK'
551
552       ·   'control-mask' / 'GDK_CONTROL_MASK'
553
554       ·   'mod1-mask' / 'GDK_MOD1_MASK'
555
556       ·   'mod2-mask' / 'GDK_MOD2_MASK'
557
558       ·   'mod3-mask' / 'GDK_MOD3_MASK'
559
560       ·   'mod4-mask' / 'GDK_MOD4_MASK'
561
562       ·   'mod5-mask' / 'GDK_MOD5_MASK'
563
564       ·   'button1-mask' / 'GDK_BUTTON1_MASK'
565
566       ·   'button2-mask' / 'GDK_BUTTON2_MASK'
567
568       ·   'button3-mask' / 'GDK_BUTTON3_MASK'
569
570       ·   'button4-mask' / 'GDK_BUTTON4_MASK'
571
572       ·   'button5-mask' / 'GDK_BUTTON5_MASK'
573
574       ·   'super-mask' / 'GDK_SUPER_MASK'
575
576       ·   'hyper-mask' / 'GDK_HYPER_MASK'
577
578       ·   'meta-mask' / 'GDK_META_MASK'
579
580       ·   'release-mask' / 'GDK_RELEASE_MASK'
581
582       ·   'modifier-mask' / 'GDK_MODIFIER_MASK'
583
584   enum Gtk2::Gdk::WindowEdge
585       ·   'north-west' / 'GDK_WINDOW_EDGE_NORTH_WEST'
586
587       ·   'north' / 'GDK_WINDOW_EDGE_NORTH'
588
589       ·   'north-east' / 'GDK_WINDOW_EDGE_NORTH_EAST'
590
591       ·   'west' / 'GDK_WINDOW_EDGE_WEST'
592
593       ·   'east' / 'GDK_WINDOW_EDGE_EAST'
594
595       ·   'south-west' / 'GDK_WINDOW_EDGE_SOUTH_WEST'
596
597       ·   'south' / 'GDK_WINDOW_EDGE_SOUTH'
598
599       ·   'south-east' / 'GDK_WINDOW_EDGE_SOUTH_EAST'
600
601   flags Gtk2::Gdk::WindowHints
602       ·   'pos' / 'GDK_HINT_POS'
603
604       ·   'min-size' / 'GDK_HINT_MIN_SIZE'
605
606       ·   'max-size' / 'GDK_HINT_MAX_SIZE'
607
608       ·   'base-size' / 'GDK_HINT_BASE_SIZE'
609
610       ·   'aspect' / 'GDK_HINT_ASPECT'
611
612       ·   'resize-inc' / 'GDK_HINT_RESIZE_INC'
613
614       ·   'win-gravity' / 'GDK_HINT_WIN_GRAVITY'
615
616       ·   'user-pos' / 'GDK_HINT_USER_POS'
617
618       ·   'user-size' / 'GDK_HINT_USER_SIZE'
619
620   enum Gtk2::Gdk::WindowTypeHint
621       ·   'normal' / 'GDK_WINDOW_TYPE_HINT_NORMAL'
622
623       ·   'dialog' / 'GDK_WINDOW_TYPE_HINT_DIALOG'
624
625       ·   'menu' / 'GDK_WINDOW_TYPE_HINT_MENU'
626
627       ·   'toolbar' / 'GDK_WINDOW_TYPE_HINT_TOOLBAR'
628
629       ·   'splashscreen' / 'GDK_WINDOW_TYPE_HINT_SPLASHSCREEN'
630
631       ·   'utility' / 'GDK_WINDOW_TYPE_HINT_UTILITY'
632
633       ·   'dock' / 'GDK_WINDOW_TYPE_HINT_DOCK'
634
635       ·   'desktop' / 'GDK_WINDOW_TYPE_HINT_DESKTOP'
636
637       ·   'dropdown-menu' / 'GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU'
638
639       ·   'popup-menu' / 'GDK_WINDOW_TYPE_HINT_POPUP_MENU'
640
641       ·   'tooltip' / 'GDK_WINDOW_TYPE_HINT_TOOLTIP'
642
643       ·   'notification' / 'GDK_WINDOW_TYPE_HINT_NOTIFICATION'
644
645       ·   'combo' / 'GDK_WINDOW_TYPE_HINT_COMBO'
646
647       ·   'dnd' / 'GDK_WINDOW_TYPE_HINT_DND'
648
649   enum Gtk2::WindowPosition
650       ·   'none' / 'GTK_WIN_POS_NONE'
651
652       ·   'center' / 'GTK_WIN_POS_CENTER'
653
654       ·   'mouse' / 'GTK_WIN_POS_MOUSE'
655
656       ·   'center-always' / 'GTK_WIN_POS_CENTER_ALWAYS'
657
658       ·   'center-on-parent' / 'GTK_WIN_POS_CENTER_ON_PARENT'
659
660   enum Gtk2::WindowType
661       ·   'toplevel' / 'GTK_WINDOW_TOPLEVEL'
662
663       ·   'popup' / 'GTK_WINDOW_POPUP'
664

SEE ALSO

666       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
667       Gtk2::Container, Gtk2::Bin
668
670       Copyright (C) 2003-2008 by the gtk2-perl team.
671
672       This software is licensed under the LGPL.  See Gtk2 for a full notice.
673
674
675
676perl v5.12.0                      2010-05-02                   Gtk2::Window(3)
Impressum