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

NAME

6       Gtk2::Window - wrapper for GtkWindow
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   string or undef = Gtk2::Window->get_default_icon_name
140       Gets the value set by "Gtk2::Window->set_default_icon_name".
141
142       Since: gtk+ 2.16
143
144   Gtk2::Window->set_default_icon_name ($name)
145       ·   $name (string or undef)
146
147       Since: gtk+ 2.6
148
149   Gtk2::Window->set_default_icon ($icon)
150       ·   $icon (Gtk2::Gdk::Pixbuf)
151
152       Since: gtk+ 2.4
153
154   $window->set_default ($default_widget)
155       ·   $default_widget (Gtk2::Widget or undef)
156
157   (width, height) = $window->get_default_size
158   $window->set_default_size ($width, $height)
159       ·   $width (integer)
160
161       ·   $height (integer)
162
163   widget or undef = $window->get_default_widget
164       Since: gtk+ 2.14
165
166   $window->deiconify
167   boolean = $window->get_deletable
168       Since: gtk+ 2.10
169
170   $window->set_deletable ($setting)
171       ·   $setting (boolean)
172
173       Since: gtk+ 2.10
174
175   boolean = $window->get_destroy_with_parent
176   $window->set_destroy_with_parent ($setting)
177       ·   $setting (boolean)
178
179   widget or undef = $window->get_focus
180   boolean = $window->get_focus_on_map
181       Since: gtk+ 2.6
182
183   $window->set_focus_on_map ($setting)
184       ·   $setting (boolean)
185
186       Since: gtk+ 2.6
187
188   $window->set_focus ($focus=undef)
189       ·   $focus (Gtk2::Widget or undef)
190
191   (left, top, right, bottom) = $window->get_frame_dimensions
192   $window->set_frame_dimensions ($left, $top, $right, $bottom)
193       ·   $left (integer)
194
195       ·   $top (integer)
196
197       ·   $right (integer)
198
199       ·   $bottom (integer)
200
201   $window->fullscreen
202       Since: gtk+ 2.2
203
204   $window->set_geometry_hints ($geometry_widget, $geometry)
205   $window->set_geometry_hints ($geometry_widget, $geometry, $geom_mask)
206       ·   $geometry_widget (Gtk2::Widget)
207
208       ·   $geom_mask (Gtk2::Gdk::WindowHints) optional, usually inferred from
209           $geometry
210
211       ·   $geometry (scalar) Gtk2::Gdk::Geometry or hashref
212
213       See "Gtk2::Gdk::Window::set_geometry_hints" on the $geometry and
214       $geom_mask arguments.
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_group
228       Since: gtk+ 2.22
229
230   boolean = $window->has_toplevel_focus
231       Since: gtk+ 2.4
232
233   $window->set_icon_from_file ($filename)
234       ·   $filename (localized file name)
235
236       May croak with a Glib::Error in $@ on failure.
237
238       Since: gtk+ 2.2
239
240   pixbuf or undef = $window->get_icon
241   list = $window->get_icon_list
242       Retrieves the list of icons set by set_icon_list().
243
244   $window->set_icon_list (...)
245       ·   ... (list) of Gtk2::Gdk::Pixbuf's
246
247       Sets up the icon representing a Gtk2::Window. The icon is used when the
248       window is minimized (also known as iconified). Some window managers or
249       desktop environments may also place it in the window frame, or display
250       it in other contexts.
251
252       set_icon_list () allows you to pass in the same icon in several hand-
253       drawn sizes. The list should contain the natural sizes your icon is
254       available in; that is, don't scale the image before passing it to GTK+.
255       Scaling is postponed until the last minute, when the desired final size
256       is known, to allow best quality.
257
258       By passing several sizes, you may improve the final image quality of
259       the icon, by reducing or eliminating automatic image scaling.
260
261       Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
262       larger images (64x64, 128x128) if you have them.
263
264   string or undef = $window->get_icon_name
265       Since: gtk+ 2.6
266
267   $window->set_icon_name ($name)
268       ·   $name (string)
269
270       Since: gtk+ 2.6
271
272   $window->set_icon ($icon)
273       ·   $icon (Gtk2::Gdk::Pixbuf or undef)
274
275   $window->iconify
276   boolean = $window->is_active
277       Since: gtk+ 2.4
278
279   $window->set_keep_above ($setting)
280       ·   $setting (boolean)
281
282       Since: gtk+ 2.4
283
284   $window->set_keep_below ($setting)
285       ·   $setting (boolean)
286
287       Since: gtk+ 2.4
288
289   list = Gtk2::Window->list_toplevels
290       Returns a list of all existing toplevel windows.
291
292   $window->maximize
293   boolean = $window->mnemonic_activate ($keyval, $modifier)
294       ·   $keyval (integer)
295
296       ·   $modifier (Gtk2::Gdk::ModifierType)
297
298   modifiertype = $window->get_mnemonic_modifier
299   $window->set_mnemonic_modifier ($modifier)
300       ·   $modifier (Gtk2::Gdk::ModifierType)
301
302   boolean = $window->get_mnemonics_visible
303       Since: gtk+ 2.20
304
305   $window->set_mnemonics_visible ($setting)
306       ·   $setting (boolean)
307
308       Since: gtk+ 2.20
309
310   boolean = $window->get_modal
311   $window->set_modal ($modal)
312       ·   $modal (boolean)
313
314   $window->move ($x, $y)
315       ·   $x (integer)
316
317       ·   $y (integer)
318
319   double = $window->get_opacity
320       Since: gtk+ 2.12
321
322   $window->set_opacity ($opacity)
323       ·   $opacity (double)
324
325       Since: gtk+ 2.12
326
327   boolean = $window->parse_geometry ($geometry)
328       ·   $geometry (string)
329
330   (root_x, root_y) = $window->get_position
331   $window->set_position ($position)
332       ·   $position (Gtk2::WindowPosition)
333
334   $window->present
335   $window->present_with_time ($timestamp)
336       ·   $timestamp (unsigned)
337
338       Since: gtk+ 2.8
339
340   boolean = $window->propagate_key_event ($event)
341       ·   $event (Gtk2::Gdk::Event::Key)
342
343       Since: gtk+ 2.4
344
345   $window->remove_accel_group ($accel_group)
346       ·   $accel_group (Gtk2::AccelGroup)
347
348   $window->remove_embedded_xid ($xid)
349       ·   $xid (integer)
350
351   $window->remove_mnemonic ($keyval, $target)
352       ·   $keyval (integer)
353
354       ·   $target (Gtk2::Widget)
355
356   $window->reshow_with_initial_size
357   boolean = $window->get_resizable
358   $window->set_resizable ($resizable)
359       ·   $resizable (boolean)
360
361   $window->resize ($width, $height)
362       ·   $width (integer)
363
364       ·   $height (integer)
365
366   string = $window->get_role
367   $window->set_role ($role)
368       ·   $role (string)
369
370   screen = $window->get_screen
371       Since: gtk+ 2.2
372
373   $window->set_screen ($screen)
374       ·   $screen (Gtk2::Gdk::Screen)
375
376       Since: gtk+ 2.2
377
378   (width, height) = $window->get_size
379   boolean = $window->get_skip_pager_hint
380       Since: gtk+ 2.2
381
382   $window->set_skip_pager_hint ($setting)
383       ·   $setting (boolean)
384
385       Since: gtk+ 2.2
386
387   boolean = $window->get_skip_taskbar_hint
388       Since: gtk+ 2.2
389
390   $window->set_skip_taskbar_hint ($setting)
391       ·   $setting (boolean)
392
393       Since: gtk+ 2.2
394
395   $window->set_startup_id ($startup_id)
396       ·   $startup_id (string)
397
398       Since: gtk+ 2.12
399
400   $window->stick
401   string = $window->get_title
402   $window->set_title ($title=undef)
403       ·   $title (string or undef)
404
405   window or undef = $window->get_transient_for
406   $window->set_transient_for ($parent)
407       ·   $parent (Gtk2::Window or undef)
408
409   windowtypehint = $window->get_type_hint
410   $window->set_type_hint ($hint)
411       ·   $hint (Gtk2::Gdk::WindowTypeHint)
412
413   $window->unfullscreen
414       Since: gtk+ 2.2
415
416   $window->unmaximize
417   $window->unstick
418   boolean = $window->get_urgency_hint
419       Since: gtk+ 2.8
420
421   $window->set_urgency_hint ($setting)
422       ·   $setting (boolean)
423
424       Since: gtk+ 2.8
425
426   windowtype = $window->get_window_type
427       Since: gtk+ 2.20
428
429   $window->set_wmclass ($wmclass_name, $wmclass_class)
430       ·   $wmclass_name (string)
431
432       ·   $wmclass_class (string)
433

PROPERTIES

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

SIGNALS

543       activate-default (Gtk2::Window)
544       activate-focus (Gtk2::Window)
545       boolean = frame-event (Gtk2::Window, Gtk2::Gdk::Event)
546       keys-changed (Gtk2::Window)
547       set-focus (Gtk2::Window, Gtk2::Widget)
548

ENUMS AND FLAGS

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

SEE ALSO

690       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
691       Gtk2::Container, Gtk2::Bin
692
694       Copyright (C) 2003-2011 by the gtk2-perl team.
695
696       This software is licensed under the LGPL.  See Gtk2 for a full notice.
697
698
699
700perl v5.30.1                      2020-01-30                   Gtk2::Window(3)
Impressum