2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_WINDOW_H
4 #define _GTKMM_WINDOW_H
12 * Copyright (C) 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <glibmm/object.h>
30 #include <glibmm/listhandle.h>
31 #include <gtkmm/bin.h>
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GtkWindow GtkWindow;
36 typedef struct _GtkWindowClass GtkWindowClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 { class Window_Class; } // namespace Gtk
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
43 typedef struct _GtkWindowGroup GtkWindowGroup;
44 typedef struct _GtkWindowGroupClass GtkWindowGroupClass;
45 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
49 { class WindowGroup_Class; } // namespace Gtk
58 * This represents all widgets which are physical windows controlled
59 * by the window manager.
61 * The window will be hidden when the window manager's close button is clicked. Override on_delete_event() to stop this.
63 * Gtk::manage() has no effect on Windows because they have no parent Containers.
67 class Window : public Bin
70 #ifndef DOXYGEN_SHOULD_SKIP_THIS
71 typedef Window CppObjectType;
72 typedef Window_Class CppClassType;
73 typedef GtkWindow BaseObjectType;
74 typedef GtkWindowClass BaseClassType;
75 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82 friend class Window_Class;
83 static CppClassType window_class_;
86 Window(const Window&);
87 Window& operator=(const Window&);
90 explicit Window(const Glib::ConstructParams& construct_params);
91 explicit Window(GtkWindow* castitem);
93 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97 static GType get_type() G_GNUC_CONST;
98 static GType get_base_type() G_GNUC_CONST;
101 ///Provides access to the underlying C GtkObject.
102 GtkWindow* gobj() { return reinterpret_cast<GtkWindow*>(gobject_); }
104 ///Provides access to the underlying C GtkObject.
105 const GtkWindow* gobj() const { return reinterpret_cast<GtkWindow*>(gobject_); }
109 //C++ methods used to invoke GTK+ virtual functions:
112 //GTK+ Virtual Functions (override these to change behaviour):
114 //Default Signal Handlers::
115 virtual void on_set_focus(Widget* focus);
116 virtual bool on_frame_event(GdkEvent* event);
123 explicit Window(WindowType type = WINDOW_TOPLEVEL);
125 /** The title of the window.
127 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
128 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
129 * the value of the property changes.
131 Glib::PropertyProxy<Glib::ustring> property_title() ;
133 /** The title of the window.
135 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
136 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
137 * the value of the property changes.
139 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_title() const;
143 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
144 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
145 * the value of the property changes.
147 Glib::PropertyProxy<bool> property_allow_shrink() ;
151 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
152 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
153 * the value of the property changes.
155 Glib::PropertyProxy_ReadOnly<bool> property_allow_shrink() const;
159 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
160 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
161 * the value of the property changes.
163 Glib::PropertyProxy<bool> property_allow_grow() ;
167 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
168 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
169 * the value of the property changes.
171 Glib::PropertyProxy_ReadOnly<bool> property_allow_grow() const;
175 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
176 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
177 * the value of the property changes.
179 Glib::PropertyProxy<bool> property_resizable() ;
183 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
184 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
185 * the value of the property changes.
187 Glib::PropertyProxy_ReadOnly<bool> property_resizable() const;
191 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
192 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
193 * the value of the property changes.
195 Glib::PropertyProxy<bool> property_modal() ;
199 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
200 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
201 * the value of the property changes.
203 Glib::PropertyProxy_ReadOnly<bool> property_modal() const;
205 /** The initial position of the window.
207 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
208 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
209 * the value of the property changes.
211 Glib::PropertyProxy<WindowPosition> property_window_position() ;
213 /** The initial position of the window.
215 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
216 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
217 * the value of the property changes.
219 Glib::PropertyProxy_ReadOnly<WindowPosition> property_window_position() const;
221 /** The default width of the window
223 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
224 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
225 * the value of the property changes.
227 Glib::PropertyProxy<int> property_default_width() ;
229 /** The default width of the window
231 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
232 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
233 * the value of the property changes.
235 Glib::PropertyProxy_ReadOnly<int> property_default_width() const;
237 /** The default height of the window
239 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
240 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
241 * the value of the property changes.
243 Glib::PropertyProxy<int> property_default_height() ;
245 /** The default height of the window
247 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
248 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
249 * the value of the property changes.
251 Glib::PropertyProxy_ReadOnly<int> property_default_height() const;
253 /** If this window should be destroyed when the parent is destroyed.
255 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
256 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
257 * the value of the property changes.
259 Glib::PropertyProxy<bool> property_destroy_with_parent() ;
261 /** If this window should be destroyed when the parent is destroyed.
263 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
264 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
265 * the value of the property changes.
267 Glib::PropertyProxy_ReadOnly<bool> property_destroy_with_parent() const;
269 /** Icon for this window.
271 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
272 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
273 * the value of the property changes.
275 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_icon() ;
277 /** Icon for this window.
279 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
280 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
281 * the value of the property changes.
283 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > property_icon() const;
286 /** The screen where this window will be displayed.
288 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
289 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
290 * the value of the property changes.
292 Glib::PropertyProxy< Glib::RefPtr<Gdk::Screen> > property_screen() ;
294 /** The screen where this window will be displayed.
296 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
297 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
298 * the value of the property changes.
300 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Screen> > property_screen() const;
302 /** Whether the toplevel is the current active window.
304 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
305 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
306 * the value of the property changes.
308 Glib::PropertyProxy_ReadOnly<bool> property_is_active() const;
311 /** Whether the input focus is within this GtkWindow.
313 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
314 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
315 * the value of the property changes.
317 Glib::PropertyProxy_ReadOnly<bool> property_has_toplevel_focus() const;
320 /** Hint to help the desktop environment understand what kind of window this is and how to treat it.
322 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
323 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
324 * the value of the property changes.
326 Glib::PropertyProxy<GdkWindowTypeHint> property_type_hint() ;
328 /** Hint to help the desktop environment understand what kind of window this is and how to treat it.
330 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
331 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
332 * the value of the property changes.
334 Glib::PropertyProxy_ReadOnly<GdkWindowTypeHint> property_type_hint() const;
336 /** TRUE if the window should not be in the task bar.
338 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
339 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
340 * the value of the property changes.
342 Glib::PropertyProxy<bool> property_skip_taskbar_hint() ;
344 /** TRUE if the window should not be in the task bar.
346 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
347 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
348 * the value of the property changes.
350 Glib::PropertyProxy_ReadOnly<bool> property_skip_taskbar_hint() const;
352 /** TRUE if the window should not be in the pager.
354 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
355 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
356 * the value of the property changes.
358 Glib::PropertyProxy<bool> property_skip_pager_hint() ;
360 /** TRUE if the window should not be in the pager.
362 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
363 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
364 * the value of the property changes.
366 Glib::PropertyProxy_ReadOnly<bool> property_skip_pager_hint() const;
368 /** Unique identifier for the window to be used when restoring a session.
370 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
371 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
372 * the value of the property changes.
374 Glib::PropertyProxy<Glib::ustring> property_role() ;
376 /** Unique identifier for the window to be used when restoring a session.
378 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
379 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
380 * the value of the property changes.
382 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_role() const;
384 /** Whether the window should be decorated by the window manager.
386 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
387 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
388 * the value of the property changes.
390 Glib::PropertyProxy<bool> property_decorated() ;
392 /** Whether the window should be decorated by the window manager.
394 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
395 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
396 * the value of the property changes.
398 Glib::PropertyProxy_ReadOnly<bool> property_decorated() const;
400 /** The window gravity of the window.
402 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
403 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
404 * the value of the property changes.
406 Glib::PropertyProxy<Gdk::Gravity> property_gravity() ;
408 /** The window gravity of the window.
410 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
411 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
412 * the value of the property changes.
414 Glib::PropertyProxy_ReadOnly<Gdk::Gravity> property_gravity() const;
417 bool is_toplevel() const;
418 bool is_dialog() const;
419 bool is_popup() const;
421 WindowType get_window_type() const;
423 //: This is special to the GTK+ linux-fb port.
424 Glib::RefPtr<Gdk::Window> get_frame();
425 Glib::RefPtr<const Gdk::Window> get_frame() const;
428 Glib::SignalProxy1< void,Widget* > signal_set_focus();
431 Glib::SignalProxy1< bool,GdkEvent* > signal_frame_event();
434 //Keybinding signals:
437 /** Sets the title of the Gtk::Window. The title of a window will be
438 * displayed in its title bar; on the X %Window System, the title bar
439 * is rendered by the window
440 * manager, so exactly how the title appears to users may vary
441 * according to a user's exact configuration. The title should help a
442 * user distinguish this window from other windows they may have
443 * open. A good title might include the application name and current
444 * document filename, for example.
445 * @param title Title of the window.
447 void set_title(const Glib::ustring& title);
450 /** Retrieves the title of the window. See set_title().
451 * @return The title of the window, or <tt>0</tt> if none has
452 * been set explicitely. The returned string is owned by the widget
453 * and must not be modified or freed.
455 Glib::ustring get_title() const;
458 /** Don't use this function. It sets the X %Window System "class" and
459 * "name" hints for a window. According to the ICCCM, you should
460 * always set these to the same value for all windows in an
461 * application, and GTK+ sets them to that value by default, so calling
462 * this function is sort of pointless. However, you may want to call
463 * set_role() on each window in your application, for the
464 * benefit of the session manager. Setting the role allows the window
465 * manager to restore window positions when loading a saved session.
466 * @param wmclass_name Window name hint.
467 * @param wmclass_class Window class hint.
469 void set_wmclass(const Glib::ustring& wmclass_name,
470 const Glib::ustring& wmclass_class);
473 /** This function is only useful on X11, not with other GTK+ targets.
475 * In combination with the window title, the window role allows a
476 * window manager to identify "the
477 * same" window when an application is restarted. So for example you
478 * might set the "toolbox" role on your app's toolbox window, so that
479 * when the user restarts their session, the window manager can put
480 * the toolbox back in the same place.
482 * If a window already has a unique title, you don't need to set the
483 * role, since the WM can use the title to identify the window when
484 * restoring the session.
485 * @param role Unique identifier for the window to be used when restoring a session.
487 void set_role(const Glib::ustring& role);
489 //: Returns the role of the window.
490 //- See {set_role()} for further explanation.
492 /** Returns the role of the window. See set_role() for
493 * further explanation.
494 * @return The role of the window if set, or <tt>0</tt>. The
495 * returned is owned by the widget and must not be modified
498 Glib::ustring get_role() const;
501 /** Associate @a accel_group with @a window , such that calling
502 * gtk_accel_groups_activate() on @a window will activate accelerators
503 * in @a accel_group .
504 * @param accel_group A Gtk::AccelGroup.
506 void add_accel_group(const Glib::RefPtr<AccelGroup>& accel_group);
509 /** Reverses the effects of add_accel_group().
510 * @param accel_group A Gtk::AccelGroup.
512 void remove_accel_group(const Glib::RefPtr<AccelGroup>& accel_group);
515 /** Sets a position constraint for this window. If the old or new
516 * constraint is Gtk::WIN_POS_CENTER_ALWAYS, this will also cause
517 * the window to be repositioned to satisfy the new constraint.
518 * @param position A position constraint.
520 void set_position(WindowPosition position);
523 /** Activates the current focused widget within the window.
524 * @return <tt>true</tt> if a widget got activated.
526 bool activate_focus();
529 /** If @a focus is not the current focus widget, and is focusable, sets
530 * it as the focus widget for the window. To set the focus to a particular
531 * widget in the toplevel, it is usually more convenient to use
532 * Gtk::Widget::grab_focus() instead of this function.
533 * @param focus Widget to be the new focus widget.
535 void set_focus(Gtk::Widget& focus);
539 /** Retrieves the current focused widget within the window.
540 * Note that this is the widget that would have the focus
541 * if the toplevel window focused; if the toplevel window
542 * is not focused then <tt>GTK_WIDGET_HAS_FOCUS (widget)</tt> will
543 * not be <tt>true</tt> for the widget.
544 * @return The currently focused widget, or <tt>0</tt> if there is none.
548 /** Retrieves the current focused widget within the window.
549 * Note that this is the widget that would have the focus
550 * if the toplevel window focused; if the toplevel window
551 * is not focused then <tt>GTK_WIDGET_HAS_FOCUS (widget)</tt> will
552 * not be <tt>true</tt> for the widget.
553 * @return The currently focused widget, or <tt>0</tt> if there is none.
555 const Widget* get_focus() const;
557 /** The default widget is the widget that's activated when the user
558 * presses Enter in a dialog (for example). This function sets the default widget for a Gtk::Window. When setting
559 * (rather than unsetting) the default widget it's generally easier to
560 * call Gtk::Widget::grab_focus() on the widget. Before making a widget
561 * the default widget, you must set the Gtk::CAN_DEFAULT flag on the
562 * widget you'd like to make the default using GTK_WIDGET_SET_FLAGS().
563 * @param default_widget Widget to be the default.
565 void set_default(Gtk::Widget& default_widget);
566 void unset_default();
569 /** Activates the default widget for the window, unless the current
570 * focused widget has been configured to receive the default action
571 * (see Gtk::RECEIVES_DEFAULT in Gtk::WidgetFlags), in which case the
572 * focused widget is activated.
573 * @return <tt>true</tt> if a widget got activated.
575 bool activate_default();
578 /** Dialog windows should be set transient for the main application
579 * window they were spawned from. This allows window managers to e.g. keep the
580 * dialog on top of the main window, or center the dialog over the
581 * main window. Gtk::Dialog::new_with_buttons() and other convenience
582 * functions in GTK+ will sometimes call
583 * set_transient_for() on your behalf.
585 * On Windows, this function will and put the child window
586 * on top of the parent, much as the window manager would have
588 * @param parent Parent window.
590 void set_transient_for(Window& parent);
593 /** Fetches the transient parent for this window. See
594 * set_transient_for().
595 * @return The transient parent for this window, or <tt>0</tt>
596 * if no transient parent has been set.
598 Window* get_transient_for();
600 /** Fetches the transient parent for this window. See
601 * set_transient_for().
602 * @return The transient parent for this window, or <tt>0</tt>
603 * if no transient parent has been set.
605 const Window* get_transient_for() const;
608 /** By setting the type hint for the window, you allow the window
609 * manager to decorate and handle the window in a way which is
610 * suitable to the function of the window in your application.
612 * This function should be called before the window becomes visible.
614 * Gtk::Dialog::new_with_buttons() and other convenience functions in GTK+
615 * will sometimes call set_type_hint() on your behalf.
616 * @param hint The window type.
618 void set_type_hint(Gdk::WindowTypeHint hint);
621 /** Gets the type hint for this window. See set_type_hint().
622 * @return The type hint for @a window .
624 Gdk::WindowTypeHint get_type_hint() const;
627 /** Windows may set a hint asking the desktop environment not to display
628 * the window in the task bar. This function sets this hint.
631 * @param setting <tt>true</tt> to keep this window from appearing in the task bar.
633 void set_skip_taskbar_hint(bool setting = true);
635 /** Gets the value set by set_skip_taskbar_hint()
636 * @return <tt>true</tt> if window shouldn't be in taskbar
640 bool get_skip_taskbar_hint() const;
643 /** Windows may set a hint asking the desktop environment not to display
644 * the window in the pager. This function sets this hint.
645 * (A "pager" is any desktop navigation tool such as a workspace
646 * switcher that displays a thumbnail representation of the windows
650 * @param setting <tt>true</tt> to keep this window from appearing in the pager.
652 void set_skip_pager_hint(bool setting = true);
654 /** Gets the value set by set_skip_pager_hint().
655 * @return <tt>true</tt> if window shouldn't be in pager
659 bool get_skip_pager_hint() const;
661 //_WRAP_METHOD(void set_destroy_with_parent(bool setting = true), gtk_window_set_destroy_with_parent)
662 // I don't that that this is ever a good thing for C++.murrayc.
665 /** Returns whether the window will be destroyed with its transient parent. See
666 * set_destroy_with_parent().
667 * @return <tt>true</tt> if the window will be destroyed with its transient parent.
669 bool get_destroy_with_parent() const;
670 // I don't that that this is ever a good thing for C++.murrayc.
673 /** Sets whether the user can resize a window. Windows are user resizable
675 * @param resizable <tt>true</tt> if the user can resize this window.
677 void set_resizable(bool resizable = true);
680 /** Gets the value set by set_resizable().
681 * @return <tt>true</tt> if the user can resize the window.
683 bool get_resizable() const;
686 /** Window gravity defines the meaning of coordinates passed to
687 * move(). See move() and Gdk::Gravity for
690 * The default window gravity is Gdk::GRAVITY_NORTH_WEST which will
691 * typically "do what you mean."
692 * @param gravity Window gravity.
694 void set_gravity(Gdk::Gravity gravity);
697 /** Gets the value set by set_gravity().
698 * @return Window gravity.
700 Gdk::Gravity get_gravity() const;
703 /** This function sets up hints about how a window can be resized by
704 * the user. You can set a minimum and maximum size; allowed resize
705 * increments (e.g. for xterm, you can only resize by the size of a
706 * character); aspect ratios; and more. See the Gdk::Geometry struct.
707 * @param geometry_widget Widget the geometry hints will be applied to.
708 * @param geometry Struct containing geometry information.
709 * @param geom_mask Mask indicating which struct fields should be paid attention to.
711 void set_geometry_hints(Widget& geometry_widget,
712 const Gdk::Geometry& geometry,
713 Gdk::WindowHints geom_mask);
716 /** Sets the Gdk::Screen where the @a window is displayed; if
717 * the window is already mapped, it will be unmapped, and
718 * then remapped on the new screen.
721 * @param screen A Gdk::Screen.
723 void set_screen(const Glib::RefPtr<Gdk::Screen>& screen);
726 /** Returns the Gdk::Screen associated with @a window .
727 * @return A Gdk::Screen.
731 Glib::RefPtr<Gdk::Screen> get_screen();
733 /** Returns the Gdk::Screen associated with @a window .
734 * @return A Gdk::Screen.
738 Glib::RefPtr<const Gdk::Screen> get_screen() const;
741 /** (Note: this is a special-purpose function for the framebuffer port,
742 * that causes GTK+ to draw its own window border. For most applications,
743 * you want set_decorated() instead, which tells the window
744 * manager whether to draw the window border.)
746 * If this function is called on a window with setting of <tt>true</tt>, before
747 * it is realized or showed, it will have a "frame" window around
748 * @a window ->window, accessible in @a window ->frame. Using the signal
749 * frame_event you can receive all events targeted at the frame.
751 * This function is used by the linux-fb port to implement managed
752 * windows, but it could concievably be used by X-programs that
753 * want to do their own window decorations.
754 * @param setting A boolean.
756 void set_has_frame(bool setting = true);
759 /** Accessor for whether the window has a frame window exterior to
760 * @a window ->window. Gets the value set by set_has_frame().
761 * @return <tt>true</tt> if a frame has been added to the window
762 * via set_has_frame().
764 bool get_has_frame() const;
767 /** (Note: this is a special-purpose function intended for the framebuffer
768 * port; see set_has_frame(). It will have no effect on the
769 * window border drawn by the window manager, which is the normal
770 * case when using the X %Window system.)
772 * For windows with frames (see set_has_frame()) this function
773 * can be used to change the size of the frame border.
774 * @param left The width of the left border.
775 * @param top The height of the top border.
776 * @param right The width of the right border.
777 * @param bottom The height of the bottom border.
779 void set_frame_dimensions(int left, int top,
780 int right, int bottom);
783 /** (Note: this is a special-purpose function intended for the
784 * framebuffer port; see set_has_frame(). It will not
785 * return the size of the window border drawn by the window manager, which is the normal
786 * case when using a windowing system. See
787 * gdk_window_get_frame_extents() to get the standard window border
790 * Retrieves the dimensions of the frame window for this toplevel.
791 * See set_has_frame(), set_frame_dimensions().
792 * @param left Location to store the width of the frame at the left.
793 * @param top Location to store the height of the frame at the top.
794 * @param right Location to store the width of the frame at the returns.
795 * @param bottom Location to store the height of the frame at the bottom.
797 void get_frame_dimensions(int& left, int& top,
798 int& right, int& bottom) const;
801 /** By default, windows are decorated with a title bar, resize
802 * controls, etc. Some window
803 * managers allow GTK+ to disable these decorations, creating a
804 * borderless window. If you set the decorated property to <tt>false</tt>
805 * using this function, GTK+ will do its best to convince the window
806 * manager not to decorate the window. Depending on the system, this
807 * function may not have any effect when called on a window that is
808 * already visible, so you should call it before calling gtk_window_show().
810 * On Windows, this function always works, since there's no window manager
812 * @param setting <tt>true</tt> to decorate the window.
814 void set_decorated(bool setting = true);
816 /** Returns whether the window has been set to have decorations
817 * such as a title bar via set_decorated().
818 * @return <tt>true</tt> if the window has been set to have decorations.
820 bool get_decorated() const;
823 /** Retrieves the list of icons set by set_icon_list().
824 * The list is copied, but the reference count on each
825 * member won't be incremented.
826 * @return Copy of window's icon list.
828 Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > get_icon_list();
830 /** Retrieves the list of icons set by set_icon_list().
831 * The list is copied, but the reference count on each
832 * member won't be incremented.
833 * @return Copy of window's icon list.
835 Glib::ListHandle< Glib::RefPtr<const Gdk::Pixbuf> > get_icon_list() const;
838 /** Sets up the icon representing a Gtk::Window. The icon is used when
839 * the window is minimized (also known as iconified). Some window
840 * managers or desktop environments may also place it in the window
841 * frame, or display it in other contexts.
843 * set_icon_list() allows you to pass in the same icon in
844 * several hand-drawn sizes. The list should contain the natural sizes
845 * your icon is available in; that is, don't scale the image before
846 * passing it to GTK+. Scaling is postponed until the last minute,
847 * when the desired final size is known, to allow best quality.
849 * By passing several sizes, you may improve the final image quality
850 * of the icon, by reducing or eliminating automatic image scaling.
852 * Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
853 * larger images (64x64, 128x128) if you have them.
855 * See also set_default_icon_list() to set the icon
856 * for all windows in your application in one go.
858 * Note that transient windows (those who have been set transient for another
859 * window using set_transient_for()) will inherit their
860 * icon from their transient parent. So there's no need to explicitly
861 * set the icon on transient windows.
862 * @param list List of Gdk::Pixbuf.
864 void set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list);
867 /** Sets up the icon representing a Gtk::Window. This icon is used when
868 * the window is minimized (also known as iconified). Some window
869 * managers or desktop environments may also place it in the window
870 * frame, or display it in other contexts.
872 * The icon should be provided in whatever size it was naturally
873 * drawn; that is, don't scale the image before passing it to
874 * GTK+. Scaling is postponed until the last minute, when the desired
875 * final size is known, to allow best quality.
877 * If you have your icon hand-drawn in multiple sizes, use
878 * set_icon_list(). Then the best size will be used.
880 * This function is equivalent to calling set_icon_list()
881 * with a 1-element list.
883 * See also set_default_icon_list() to set the icon
884 * for all windows in your application in one go.
885 * @param icon Icon image, or <tt>0</tt>.
887 void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon);
890 /** Sets the icon for the window.
892 * This function is equivalent to calling set_icon()
893 * with a pixbuf created by loading the image from @a filename .
894 * @param filename Location of icon file.
895 * @return <tt>true</tt> if setting the icon succeeded.
899 bool set_icon_from_file(const std::string& filename);
902 /** Gets the value set by set_icon() (or if you've
903 * called set_icon_list(), gets the first icon in
905 * @return Icon for window.
907 Glib::RefPtr<Gdk::Pixbuf> get_icon();
909 /** Gets the value set by set_icon() (or if you've
910 * called set_icon_list(), gets the first icon in
912 * @return Icon for window.
914 Glib::RefPtr<const Gdk::Pixbuf> get_icon() const;
917 /** Sets an icon list to be used as fallback for windows that haven't
918 * had set_icon_list() called on them to set up a
919 * window-specific icon list. This function allows you to set up the
920 * icon for all windows in your app at once.
922 * See set_icon_list() for more details.
923 * @param list A list of Gdk::Pixbuf.
925 static void set_default_icon_list(
926 const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list);
929 /** Gets the value set by Gtk::Window::set_default_icon_list().
930 * @return Copy of default icon list.
932 static Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > get_default_icon_list();
935 /** Sets an icon to be used as fallback for windows that haven't
936 * had set_icon_list() called on them from a file
937 * on disk. Warns on failure if @a err is <tt>0</tt>.
938 * @param filename Location of icon file.
939 * @return <tt>true</tt> if setting the icon succeeded.
943 static bool set_default_icon_from_file(const std::string& filename);
945 /** By default, after showing the first Gtk::Window for each Gdk::Screen,
946 * GTK+ calls gdk_screen_notify_startup_complete(). Call this
947 * function to disable the automatic startup notification. You might
948 * do this if your first window is a splash screen, and you want to
949 * delay notification until after your real main window has been
950 * shown, for example.
952 * In that example, you would disable startup notification
953 * temporarily, show your splash screen, then re-enable it so that
954 * showing the main window would automatically result in notification.
957 * @param setting <tt>true</tt> to automatically do startup notification.
959 static void set_auto_startup_notification(bool setting = true);
962 /** Sets a window modal or non-modal. Modal windows prevent interaction
963 * with other windows in the same application. To keep modal dialogs
964 * on top of main application windows, use
965 * set_transient_for() to make the dialog transient for the
966 * parent; most window managers
967 * will then disallow lowering the dialog below the parent.
968 * @param modal Whether the window is modal.
970 void set_modal(bool modal = true);
973 /** Returns whether the window is modal. See set_modal().
974 * @return <tt>true</tt> if the window is set to be modal and
975 * establishes a grab when shown.
977 bool get_modal() const;
980 /** Returns a list of all existing toplevel windows. The widgets
981 * in the list are not individually referenced. If you want
982 * to iterate through the list and perform actions involving
983 * callbacks that might destroy the widgets, you <em>must</em> call
984 * <tt>g_list_foreach (result, (GFunc)g_object_ref, <tt>0</tt>)</tt> first, and
985 * then unref all the widgets afterwards.
986 * @return List of toplevel widgets.
988 static Glib::ListHandle<Window*> list_toplevels();
991 /** Adds a mnemonic to this window.
992 * @param keyval The mnemonic.
993 * @param target The widget that gets activated by the mnemonic.
995 void add_mnemonic(guint keyval, Widget& target);
998 /** Removes a mnemonic from this window.
999 * @param keyval The mnemonic.
1000 * @param target The widget that gets activated by the mnemonic.
1002 void remove_mnemonic(guint keyval, Widget& target);
1005 /** Activates the targets associated with the mnemonic.
1006 * @param keyval The mnemonic.
1007 * @param modifier The modifiers.
1008 * @return <tt>true</tt> if the activation is done.
1010 bool mnemonic_activate(guint keyval, Gdk::ModifierType modifier);
1013 /** Sets the mnemonic modifier for this window.
1014 * @param modifier The modifier mask used to activate
1015 * mnemonics on this window.
1017 void set_mnemonic_modifier(Gdk::ModifierType modifier);
1020 /** Returns the mnemonic modifier for this window. See
1021 * set_mnemonic_modifier().
1022 * @return The modifier mask used to activate
1023 * mnemonics on this window.
1025 Gdk::ModifierType get_mnemonic_modifier();
1028 /** Presents a window to the user. This may mean raising the window
1029 * in the stacking order, deiconifying it, moving it to the current
1030 * desktop, and/or giving it the keyboard focus, possibly dependent
1031 * on the user's platform, window manager, and preferences.
1033 * If @a window is hidden, this function calls Gtk::Widget::show()
1036 * This function should be used when the user tries to open a window
1037 * that's already open. Say for example the preferences dialog is
1038 * currently open, and the user chooses Preferences from the menu
1039 * a second time; use present() to move the already-open dialog
1040 * where the user can see it.
1045 /** Asks to iconify (i.e.\ minimize) the specified @a window . Note that
1046 * you shouldn't assume the window is definitely iconified afterward,
1047 * because other entities (e.g. the user or window manager) could deiconify it
1048 * again, or there may not be a window manager in which case
1049 * iconification isn't possible, etc. But normally the window will end
1050 * up iconified. Just don't write code that crashes if not.
1052 * It's permitted to call this function before showing a window,
1053 * in which case the window will be iconified before it ever appears
1056 * You can track iconification via the "window_state_event" signal
1061 /** Asks to deiconify (i.e.\ unminimize) the specified @a window . Note
1062 * that you shouldn't assume the window is definitely deiconified
1063 * afterward, because other entities (e.g. the user or window manager) could iconify it
1064 * again before your code which assumes deiconification gets to run.
1066 * You can track iconification via the "window_state_event" signal
1072 /** Asks to stick @a window , which means that it will appear on all user
1073 * desktops. Note that you shouldn't assume the window is definitely
1074 * stuck afterward, because other entities (e.g. the user or window manager) could unstick it
1075 * again, and some window managers do not support sticking
1076 * windows. But normally the window will end up stuck. Just don't
1077 * write code that crashes if not.
1079 * It's permitted to call this function before showing a window.
1081 * You can track stickiness via the "window_state_event" signal
1086 /** Asks to unstick @a window , which means that it will appear on only
1087 * one of the user's desktops. Note that you shouldn't assume the
1088 * window is definitely unstuck afterward, because other entities
1089 * (e.g. the user or window
1090 * manager) could stick it again. But normally the window will
1091 * end up stuck. Just don't write code that crashes if not.
1093 * You can track stickiness via the "window_state_event" signal
1099 /** Asks to maximize @a window , so that it becomes full-screen. Note that
1100 * you shouldn't assume the window is definitely maximized afterward,
1101 * because other entities (e.g. the user or window manager) could unmaximize it
1102 * again, and not all window managers support maximization. But
1103 * normally the window will end up maximized. Just don't write code
1104 * that crashes if not.
1106 * It's permitted to call this function before showing a window,
1107 * in which case the window will be maximized when it appears onscreen
1110 * You can track maximization via the "window_state_event" signal
1115 /** Asks to unmaximize @a window . Note that you shouldn't assume the
1116 * window is definitely unmaximized afterward, because other entities
1117 * (e.g. the user or window
1118 * manager) could maximize it again, and not all window
1119 * managers honor requests to unmaximize. But normally the window will
1120 * end up unmaximized. Just don't write code that crashes if not.
1122 * You can track maximization via the "window_state_event" signal
1128 /** Asks to place @a window in the fullscreen state. Note that you
1129 * shouldn't assume the window is definitely full screen afterward,
1130 * because other entities (e.g. the user or window manager) could unfullscreen it
1131 * again, and not all window managers honor requests to fullscreen
1132 * windows. But normally the window will end up fullscreen. Just
1133 * don't write code that crashes if not.
1135 * You can track the fullscreen state via the "window_state_event" signal
1142 /** Asks to toggle off the fullscreen state for @a window . Note that you
1143 * shouldn't assume the window is definitely not full screen
1144 * afterward, because other entities (e.g. the user or window manager) could fullscreen it
1145 * again, and not all window managers honor requests to unfullscreen
1146 * windows. But normally the window will end up restored to its normal
1147 * state. Just don't write code that crashes if not.
1149 * You can track the fullscreen state via the "window_state_event" signal
1154 void unfullscreen();
1157 /** Starts resizing a window. This function is used if an application
1158 * has window resizing controls. When GDK can support it, the resize
1159 * will be done using the standard mechanism for the window manager or windowing
1160 * system. Otherwise, GDK will try to emulate window resizing,
1161 * potentially not all that well, depending on the windowing system.
1162 * @param button Mouse button that initiated the drag.
1163 * @param edge Position of the resize control.
1164 * @param root_x X position where the user clicked to initiate the drag, in root window coordinates.
1165 * @param root_y Y position where the user clicked to initiate the drag.
1166 * @param timestamp Timestamp from the click event that initiated the drag.
1168 void begin_resize_drag(Gdk::WindowEdge edge,
1169 int button, int root_x, int root_y, guint32 timestamp);
1172 /** Starts moving a window. This function is used if an application has
1173 * window movement grips. When GDK can support it, the window movement
1174 * will be done using the standard mechanism for the window manager or windowing
1175 * system. Otherwise, GDK will try to emulate window movement,
1176 * potentially not all that well, depending on the windowing system.
1177 * @param button Mouse button that initiated the drag.
1178 * @param root_x X position where the user clicked to initiate the drag, in root window coordinates.
1179 * @param root_y Y position where the user clicked to initiate the drag.
1180 * @param timestamp Timestamp from the click event that initiated the drag.
1182 void begin_move_drag(
1183 int button, int root_x, int root_y, guint32 timestamp);
1186 /** Sets the default size of a window. If the window's "natural" size
1187 * (its size request) is larger than the default, the default will be
1188 * ignored. More generally, if the default size does not obey the
1189 * geometry hints for the window (set_geometry_hints() can
1190 * be used to set these explicitly), the default size will be clamped
1191 * to the nearest permitted size.
1193 * Unlike Gtk::Widget::set_size_request(), which sets a size request for
1194 * a widget and thus would keep users from shrinking the window, this
1195 * function only sets the initial size, just as if the user had
1196 * resized the window themselves. Users can still shrink the window
1197 * again as they normally would. Setting a default size of -1 means to
1198 * use the "natural" default size (the size request of the window).
1200 * For more control over a window's initial size and how resizing works,
1201 * investigate set_geometry_hints().
1203 * For some uses, resize() is a more appropriate function.
1204 * resize() changes the current size of the window, rather
1205 * than the size to be used on initial display. resize() always
1206 * affects the window itself, not the geometry widget.
1208 * The default size of a window only affects the first time a window is
1209 * shown; if a window is hidden and re-shown, it will remember the size
1210 * it had prior to hiding, rather than using the default size.
1212 * Windows can't actually be 0x0 in size, they must be at least 1x1, but
1213 * passing 0 for @a width and @a height is OK, resulting in a 1x1 default size.
1214 * @param width Width in pixels, or -1 to unset the default width.
1215 * @param height Height in pixels, or -1 to unset the default height.
1217 void set_default_size(int width, int height);
1220 /** Gets the default size of the window. A value of -1 for the width or
1221 * height indicates that a default size has not been explicitly set
1222 * for that dimension, so the "natural" size of the window will be
1224 * @param width Location to store the default width.
1225 * @param height Location to store the default height.
1227 void get_default_size(int& width, int& height) const;
1230 /** Resizes the window as if the user had done so, obeying geometry
1231 * constraints. The default geometry constraint is that windows may
1232 * not be smaller than their size request; to override this
1233 * constraint, call Gtk::Widget::set_size_request() to set the window's
1234 * request to a smaller value.
1236 * If resize() is called before showing a window for the
1237 * first time, it overrides any default size set with
1238 * set_default_size().
1240 * Windows may not be resized smaller than 1 by 1 pixels.
1241 * @param width Width in pixels to resize the window to.
1242 * @param height Height in pixels to resize the window to.
1244 void resize(int width, int height);
1247 /** Obtains the current size of @a window . If @a window is not onscreen,
1248 * it returns the size GTK+ will suggest to the window manager for the initial window
1249 * size (but this is not reliably the same as the size the window
1250 * manager will actually select). The size obtained by
1251 * get_size() is the last size received in a
1252 * Gdk::EventConfigure, that is, GTK+ uses its locally-stored size,
1253 * rather than querying the X server for the size. As a result, if you
1254 * call resize() then immediately call
1255 * get_size(), the size won't have taken effect yet. After
1256 * the window manager processes the resize request, GTK+ receives
1257 * notification that the size has changed via a configure event, and
1258 * the size of the window gets updated.
1260 * @note Nearly any use of this function creates a race condition,
1261 * because the size of the window may change between the time that you
1262 * get the size and the time that you perform some action assuming
1263 * that size is the current size. To avoid race conditions, connect to
1264 * "configure_event" on the window and adjust your size-dependent
1265 * state to match the size delivered in the Gdk::EventConfigure.
1267 * @note The returned size does <em>not</em> include the
1268 * size of the window manager decorations (aka the window frame or
1269 * border). Those are not drawn by GTK+ and GTK+ has no reliable
1270 * method of determining their size.
1272 * @note If you are getting a window size in order to position
1273 * the window onscreen, there may be a better way. The preferred
1274 * way is to simply set the window's semantic type with
1275 * set_type_hint(), which allows the window manager to
1276 * e.g. center dialogs. Also, if you set the transient parent of
1277 * dialogs with set_transient_for() window managers
1278 * will often center the dialog over its parent window. It's
1279 * much preferred to let the window manager handle these
1280 * things rather than doing it yourself, because all apps will
1281 * behave consistently and according to user prefs if the window
1282 * manager handles it. Also, the window manager can take the size
1283 * of the window decorations/border into account, while your
1284 * application cannot.
1286 * In any case, if you insist on application-specified window
1287 * positioning, there's <em>still</em> a better way than
1288 * doing it yourself - set_position() will frequently
1289 * handle the details for you.
1290 * @param width Return location for width.
1291 * @param height Return location for height.
1293 void get_size(int& width, int& height) const;
1296 /** Asks the window manager to move
1297 * @a window to the given position. %Window managers are free to ignore
1298 * this; most window managers ignore requests for initial window
1299 * positions (instead using a user-defined placement algorithm) and
1300 * honor requests after the window has already been shown.
1302 * @note the position is the position of the gravity-determined
1303 * reference point for the window. The gravity determines two things:
1304 * first, the location of the reference point in root window
1305 * coordinates; and second, which point on the window is positioned at
1306 * the reference point.
1308 * By default the gravity is Gdk::GRAVITY_NORTH_WEST, so the reference
1309 * point is simply the @a x , @a y supplied to move(). The
1310 * top-left corner of the window decorations (aka window frame or
1311 * border) will be placed at @a x , @a y . Therefore, to position a window
1312 * at the top left of the screen, you want to use the default gravity
1313 * (which is Gdk::GRAVITY_NORTH_WEST) and move the window to 0,0.
1315 * To position a window at the bottom right corner of the screen, you
1316 * would set Gdk::GRAVITY_SOUTH_EAST, which means that the reference
1317 * point is at @a x + the window width and @a y + the window height, and
1318 * the bottom-right corner of the window border will be placed at that
1319 * reference point. So, to place a window in the bottom right corner
1320 * you would first set gravity to south east, then write:
1321 * <tt>gtk_window_move (window, gdk_screen_width() - window_width,
1322 * gdk_screen_height() - window_height)</tt>.
1324 * The Extended Window Manager Hints specification at
1325 * http://www.freedesktop.org/standards/wm-spec has a
1326 * nice table of gravities in the "implementation notes" section.
1328 * The get_position() documentation may also be relevant.
1329 * @param x X coordinate to move window to.
1330 * @param y Y coordinate to move window to.
1332 void move(int x, int y);
1335 /** This function returns the position you need to pass to
1336 * move() to keep @a window in its current position. This
1337 * means that the meaning of the returned value varies with window
1338 * gravity. See move() for more details.
1340 * If you haven't changed the window gravity, its gravity will be
1341 * Gdk::GRAVITY_NORTH_WEST. This means that get_position()
1342 * gets the position of the top-left corner of the window manager
1343 * frame for the window. move() sets the position of this
1344 * same top-left corner.
1346 * get_position() is not 100% reliable because the X %Window System
1347 * does not specify a way to obtain the geometry of the
1348 * decorations placed on a window by the window manager.
1349 * Thus GTK+ is using a "best guess" that works with most
1352 * Moreover, nearly all window managers are historically broken with
1353 * respect to their handling of window gravity. So moving a window to
1354 * its current position as returned by get_position() tends
1355 * to result in moving the window slightly. %Window managers are
1356 * slowly getting better over time.
1358 * If a window has gravity Gdk::GRAVITY_STATIC the window manager
1359 * frame is not relevant, and thus get_position() will
1360 * always produce accurate results. However you can't use static
1361 * gravity to do things like place a window in a corner of the screen,
1362 * because static gravity ignores the window manager decorations.
1364 * If you are saving and restoring your application's window
1365 * positions, you should know that it's impossible for applications to
1366 * do this without getting it somewhat wrong because applications do
1367 * not have sufficient knowledge of window manager state. The Correct
1368 * Mechanism is to support the session management protocol (see the
1369 * "GnomeClient" object in the GNOME libraries for example) and allow
1370 * the window manager to save your window sizes and positions.
1371 * @param root_x Return location for X coordinate of gravity-determined reference point.
1372 * @param root_y Return location for Y coordinate of gravity-determined reference point.
1374 void get_position(int& root_x, int& root_y) const;
1377 /** Parses a standard X %Window System geometry string - see the
1378 * manual page for X (type 'man X') for details on this.
1379 * parse_geometry() does work on all GTK+ ports
1380 * including Win32 but is primarily intended for an X environment.
1382 * If either a size or a position can be extracted from the
1383 * geometry string, parse_geometry() returns <tt>true</tt>
1384 * and calls set_default_size() and/or move()
1385 * to resize/move the window.
1387 * If parse_geometry() returns <tt>true</tt>, it will also
1388 * set the Gdk::HINT_USER_POS and/or Gdk::HINT_USER_SIZE hints
1389 * indicating to the window manager that the size/position of
1390 * the window was user-specified. This causes most window
1391 * managers to honor the geometry.
1393 * Note that for parse_geometry() to work as expected, it has
1394 * to be called when the window has its "final" size, i.e. after calling
1395 * Gtk::Widget::show_all() on the contents and set_geometry_hints()
1400 * main (int argc, char *argv[])
1402 * GtkWidget *window, vbox;
1403 * GdkGeometry size_hints;
1405 * gtk_init (&argc, &argv);
1407 * window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
1408 * vbox = gtk_vbox_new (<tt>false</tt>, 0);
1410 * gtk_container_add (GTK_CONTAINER (window), vbox);
1411 * fill_with_content (vbox);
1412 * gtk_widget_show_all (vbox);
1415 * 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST
1418 * gtk_window_set_geometry_hints (GTK_WINDOW (window),
1421 * GDK_HINT_MIN_SIZE |
1422 * GDK_HINT_BASE_SIZE |
1423 * GDK_HINT_RESIZE_INC);
1427 * if (!gtk_window_parse_geometry (GTK_WINDOW (window), argv[1]))
1428 * fprintf (stderr, "Failed to parse '%s'<tt>\\n</tt>", argv[1]);
1431 * gtk_widget_show_all (window);
1437 * @param geometry Geometry string.
1438 * @return <tt>true</tt> if string was parsed successfully.
1440 bool parse_geometry(const Glib::ustring& geometry);
1443 /** Hides @a window , then reshows it, resetting the
1444 * default size and position of the window. Used
1445 * by GUI builders only.
1447 void reshow_with_initial_size();
1450 /** Sets an icon to be used as fallback for windows that haven't
1451 * had set_icon() called on them from a pixbuf.
1454 * @param icon The icon.
1456 static void set_default_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon);
1458 /** Asks to keep @a window above, so that it stays on top. Note that
1459 * you shouldn't assume the window is definitely above afterward,
1460 * because other entities (e.g. the user or window manager) could not keep it above,
1461 * and not all window managers support keeping windows above. But
1462 * normally the window will end kept above. Just don't write code
1463 * that crashes if not.
1465 * It's permitted to call this function before showing a window,
1466 * in which case the window will be kept above when it appears onscreen
1469 * You can track the above state via the "window_state_event" signal
1472 * Note that, according to the Extended Window Manager Hints
1473 * specification, the above state is mainly meant for user preferences and should not be used
1474 * by applications e.g. for drawing attention to their dialogs.
1477 * @param setting Whether to keep @a window above other windows.
1479 void set_keep_above(bool setting = true);
1481 /** Asks to keep @a window below, so that it stays in bottom. Note that
1482 * you shouldn't assume the window is definitely below afterward,
1483 * because other entities (e.g. the user or window manager) could not keep it below,
1484 * and not all window managers support putting windows below. But
1485 * normally the window will be kept below. Just don't write code
1486 * that crashes if not.
1488 * It's permitted to call this function before showing a window,
1489 * in which case the window will be kept below when it appears onscreen
1492 * You can track the below state via the "window_state_event" signal
1495 * Note that, according to the Extended Window Manager Hints
1496 * specification, the above state is mainly meant for user preferences and should not be used
1497 * by applications e.g. for drawing attention to their dialogs.
1500 * @param setting Whether to keep @a window below other windows.
1502 void set_keep_below(bool setting = true);
1505 /** Returns a default accel group for this window
1506 * This is a gtkmm-specific function. This accel group can not
1509 Glib::RefPtr<AccelGroup> get_accel_group();
1511 /** Brings the window to the front.
1512 * This is just a more obvious convenience wrapper for get_window()->raise().
1514 virtual void raise();
1516 ///Overriden to warn that it doesn't make sense to use Gtk::manage() on this class because it has no parent container.
1517 virtual void set_manage();
1521 //See comments in the implementations:
1523 void _destroy_c_instance();
1527 //We'll create an accel_group if it's requested, and remember it.
1528 //Otherwise, you'd have to create it, add it to the window, then remember it somewhere else while you add it to other widgets.
1529 Glib::RefPtr<AccelGroup> accel_group_;
1535 class WindowGroup : public Glib::Object
1538 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1541 typedef WindowGroup CppObjectType;
1542 typedef WindowGroup_Class CppClassType;
1543 typedef GtkWindowGroup BaseObjectType;
1544 typedef GtkWindowGroupClass BaseClassType;
1546 private: friend class WindowGroup_Class;
1547 static CppClassType windowgroup_class_;
1551 WindowGroup(const WindowGroup&);
1552 WindowGroup& operator=(const WindowGroup&);
1555 explicit WindowGroup(const Glib::ConstructParams& construct_params);
1556 explicit WindowGroup(GtkWindowGroup* castitem);
1558 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1561 virtual ~WindowGroup();
1563 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1564 static GType get_type() G_GNUC_CONST;
1565 static GType get_base_type() G_GNUC_CONST;
1568 ///Provides access to the underlying C GObject.
1569 GtkWindowGroup* gobj() { return reinterpret_cast<GtkWindowGroup*>(gobject_); }
1571 ///Provides access to the underlying C GObject.
1572 const GtkWindowGroup* gobj() const { return reinterpret_cast<GtkWindowGroup*>(gobject_); }
1574 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
1575 GtkWindowGroup* gobj_copy();
1585 static Glib::RefPtr<WindowGroup> create();
1588 /** Adds a window to a Gtk::WindowGroup.
1589 * @param window The Gtk::Window to add.
1591 void add_window(Window& window);
1593 /** Removes a window from a Gtk::WindowGroup.
1594 * @param window The Gtk::Window to remove.
1596 void remove_window(Window& window);
1602 //C++ methods used to invoke GTK+ virtual functions:
1605 //GTK+ Virtual Functions (override these to change behaviour):
1607 //Default Signal Handlers::
1617 /** @relates Gtk::Window
1618 * @param object The C instance
1619 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
1620 * @result A C++ instance that wraps this C instance.
1622 Gtk::Window* wrap(GtkWindow* object, bool take_copy = false);
1627 /** @relates Gtk::WindowGroup
1628 * @param object The C instance
1629 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
1630 * @result A C++ instance that wraps this C instance.
1632 Glib::RefPtr<Gtk::WindowGroup> wrap(GtkWindowGroup* object, bool take_copy = false);
1636 #endif /* _GTKMM_WINDOW_H */