Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Window Class Reference

A GtkWindow C++ wrapper class. More...

`#include <inti/gtk/window.h>`

Inheritance diagram for Inti::Gtk::Window:

List of all members.

## Public Member Functions

Constructors

- Window (WindowType type=WINDOW_TOPLEVEL)
    Construct a new window which is a toplevel window and can contain other widgets.
- virtual ~Window ()
    Destructor.

Accessors

- GtkWindow * gtk_window () const
    Get a pointer to the GtkWindow structure.
- GtkWindowClass * gtk_window_class () const
    Get a pointer to the GtkWindowClass structure.
- operator GtkWindow * () const
    Conversion operator; safely converts a Window to a GtkWindow pointer.
- bool is_toplevel () const
    Returns true if the window type is WINDOW_TOPLEVEL.
- bool is_popup () const
    Returns true if the window type is WINDOW_POPUP.
- String get_title () const
    Retrieves the title of the window (see set_title()).
- String get_role () const
    Returns the role of the window (see set_role() for further explanation).
- Widget * get_focus () const
    Retrieves the current focused widget within the window.
- Window * get_transient_for () const
    Fetches the transient parent for this window (see set_transient_for()).
- Gdk::WindowTypeHint get_type_hint () const
    Gets the type hint for this window (see set_type_hint()).
- bool get_skip_taskbar_hint () const
    Gets the value set by set_skip_taskbar_hint().
- bool get_skip_pager_hint () const
    Gets the value set by set_skip_pager_hint().
- bool get_destroy_with_parent () const
    Returns true if the window will be destroyed with its transient parent (see set_destroy_with_parent()).
- bool get_resizable () const
    Gets the value set by set_resizable().
- Gdk::Gravity get_gravity () const
    Gets the value set by set_gravity().
- Gdk::Screen * get_screen () const
    Returns the Gdk::Screen associated with the window.
- bool get_has_frame () const
    Returns whether the window has a frame window exterior to gtk_window()->window (see set_has_frame()).
- void get_frame_dimensions (int *left, int *top, int *right, int *bottom) const
    Retrieves the dimensions of the frame window for this toplevel.
- bool get_decorated () const
    Returns true if the window has been set to have decorations such as a title bar via set_decorated().
- bool get_icon_list (std::vector< Gdk::Pixbuf * > &icons) const
    Retrieves the list of icons set by set_icon_list().
- Gdk::Pixbuf * get_icon () const
    Gets the value set by set_icon(), or if you've called set_icon_list(), gets the first icon in the icon list.
- bool get_modal () const
    Returns true if the window is modal and establishes a grab when shown (see set_modal()).
- Gdk::ModifierTypeField get_mnemonic_modifier () const
    Returns the mnemonic modifier for this window (see set_mnemonic_modifier()).
- void get_default_size (int *width, int *height) const
    Gets the default size of the window.
- void get_size (int *width, int *height) const
    Obtains the current size of the window.
- void get_position (int *root_x, int *root_y) const
    This method returns the position you need to pass to move() to keep window in its current position; the meaning of the returned value varies with window gravity (see move() for more details).
- Gdk::Point get_position () const
    This method returns the position you need to pass to move() to keep window in its current position, as a Gdk::Point (see get_position(int *, int *) const).
- WindowGroup * get_group () const
    Returns the group for the window or the default group.

Methods

- void set_title (const String &title)
    Sets the title of the window.
- void set_wmclass (const String &wmclass_name, const String &wmclass_class)
    Sets the X Window System "class" and "name" hints for a window.
- void set_role (const String &role)
    This method is only useful on X11, not with other GTK+ targets.
- AccelGroup * add_accel_group (AccelGroup *accel_group=0)
    Associate accel_group with the window, such that calling Gtk::AccelGroup_activate() on the window will activate accelerators in accel_group.
- void remove_accel_group (AccelGroup &accel_group)
    Reverses the effects of add_accel_group().
- void set_position (WindowPosition position)
    Sets a position constraint for this window.
- bool activate_focus ()
    Activate the current focused widget.
- void set_focus (Widget *focus)
    If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window.
- void set_default (Widget *default_widget)
    The default widget is the widget that's activated when the user presses Enter in a dialog, for example.
- bool activate_default ()
    Activate the default widget.
- void set_transient_for (Window *parent)
    Dialog windows should be set transient for the main application window they were spawned from.
- void set_type_hint (Gdk::WindowTypeHint hint)
    By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.
- void set_skip_taskbar_hint (bool setting)
    Windows may set a hint asking the desktop environment not to display the window in the task bar; this method toggles this hint.
- void set_skip_pager_hint (bool setting)
    Windows may set a hint asking the desktop environment not to display the window in the pager; this function toggles this hint.
- void set_destroy_with_parent (bool setting)
    If setting is true, then destroying the transient parent of window will also destroy the window itself.
- void set_resizable (bool resizable)
    Sets whether the user can resize a window.
- void set_gravity (Gdk::Gravity gravity)
    Window gravity defines the meaning of coordinates passed to move() (see move() and Gdk::Gravity for more details).
- void set_geometry_hints (Widget *geometry_widget, const Gdk::Geometry &geometry)
    This function sets up hints about how a window can be resized by the user.
- void set_screen (const Gdk::Screen &screen)
    Sets the Gdk::Screen where the window is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.
- void set_has_frame (bool setting)
    This is a special-purpose method for the framebuffer port, that causes GTK+ to draw its own window border.
- void set_frame_dimensions (int left, int top, int right, int bottom)
    (Note: this is a special-purpose method intended for the framebuffer port; see set_has_frame()
- void set_decorated (bool setting)
    Ask the window manager to decorate or not decorate the window with a title bar, etc.
- void set_icon_list (std::vector< Gdk::Pixbuf * > &icons)
    Sets up the icon representing the window.
- void set_icon (Gdk::Pixbuf &icon)
    Sets up the icon representing the window.
- bool set_icon_from_file (const String &filename, G::Error *error=0)
    Sets the icon for the window.
- void set_modal (bool modal)
    Sets a window modal or non-modal.
- void add_mnemonic (unsigned int keyval, Widget &target)
    Adds a mnemonic to this window.
- void remove_mnemonic (unsigned int keyval, Widget &target)
    Removes a mnemonic from this window.
- bool mnemonic_activate (unsigned int keyval, Gdk::ModifierTypeField modifier)
    Activates the targets associated with the mnemonic.
- void set_mnemonic_modifier (Gdk::ModifierTypeField modifier)
    Sets the mnemonic modifier for this window.
- void present ()
    Presents a window to the user.
- void iconify ()
    Asks to iconify (minimize) the specified window.
- void deiconify ()
    Asks to deiconify (unminimize) the specified window.
- void stick ()
    Asks to stick the window, which means that it will appear on all user desktops.
- void unstick ()
    Asks to unstick the window, which means that it will appear on only one of the user's desktops.
- void maximize ()
    Asks to maximize window, so that it becomes full-screen.
- void unmaximize ()
    Asks to unmaximize window.
- void fullscreen ()
    Asks to place the window in the fullscreen state.
- void unfullscreen ()
    Asks to toggle off the fullscreen state for the window.
- void begin_resize_drag (Gdk::WindowEdge edge, int button, int root_x, int root_y, unsigned int timestamp)
    Starts resizing a window.
- void begin_move_drag (int button, int root_x, int root_y, unsigned int timestamp)
    Starts moving a window.
- void set_default_size (int width, int height)
    Sets the default size of a window.
- void resize (int width, int height)
    Resizes the window as if the user had done so, obeying geometry constraints.
- void move (int x, int y)
    Asks the window manager to move window to the given position.
- void move (const Gdk::Point &point)
    Asks the window manager to move window to the given point (see move(int, int)).
- bool parse_geometry (const char *geometry)
    Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this.
- void reshow_with_initial_size ()
    Hides window, then reshows it, resetting the default size and position of the window (used by GUI builders only).

Property Proxies

- const TypePropertyProxy prop_type ()
    The type of the window (WindowType : Read / Write / Construct Only).
- const TitlePropertyProxy prop_title ()
    The title of the window (String : Read / Write).
- const AllowShrinkPropertyProxy prop_allow_shrink ()
    If true, the window has no mimimum size.
- const AllowGrowPropertyProxy prop_allow_grow ()
    If true, users can expand the window beyond its minimum size (bool : Read / Write).
- const ResizablePropertyProxy prop_resizable ()
    If true, users can resize the window (bool : Read / Write).
- const ModalPropertyProxy prop_modal ()
    If true, the window is modal and other windows will not be usable while this one is up (bool : Read / Write).
- const WindowPositionPropertyProxy prop_window_position ()
    The initial position of the window (WindowPosition : Read / Write).
- const DefaultWidthPropertyProxy prop_default_width ()
    The default width of the window, used when initially showing the window (int : Read / Write).
- const DefaultHeightPropertyProxy prop_default_height ()
    The default height of the window, used when initially showing the window (int : Read / Write).
- const DestroyWithParentPropertyProxy prop_destroy_with_parent ()
    If this window should be destroyed when the parent is destroyed (bool : Read / Write).
- const IconPropertyProxy prop_icon ()
    Icon for this window (Gdk::Pixbuf* : Read / Write).
- const ScreenPropertyProxy prop_screen ()
    The screen where this window will be displayed (Gdk::Screen* : Read / Write).
- const IsActivePropertyProxy prop_is_active ()
    Whether the toplevel is the current active window (bool : Read / Write).
- const HasToplevelFocusPropertyProxy prop_has_toplevel_focus ()
    Whether the input focus is within this Gtk::Window (bool : Read / Write).
- const TypeHintPropertyProxy prop_type_hint ()
    Hint to help the desktop environment understand what kind of window this is and how to treat it (Gdk::WindowTypeHint : Read / Write).
- const SkipTaskbarHintPropertyProxy prop_skip_taskbar_hint ()
    Set true if the window should not be in the task bar (bool : Read / Write).
- const SkipPagerHintPropertyProxy prop_skip_pager_hint ()
    Set true if the window should not be in the pager (bool : Read / Write).

Signal Proxies

- const SetFocusSignalProxy sig_set_focus ()
    Connect to the set_focus_signal; emitted when the focus widget for the window changes.
- const FrameEventSignalProxy sig_frame_event ()
    Connect to the frame_event_signal; emitted whenever the window receives an event targeted at the frame.
- const KeysChangedSignalProxy sig_keys_changed ()
    Connect to the keys_changed_signal; emitted when the windows menmonic and/or accelerator keys have changed.
- const DeleteEventSignalProxy sig_delete_event ()
    Connect to the delete_event_signal; emitted when the user tries to close an application from the window manager frame.

## Static Public Member Functions

- bool get_default_icon_list (std::vector< Gdk::Pixbuf * > &icons)
    Gets the icon list set by set_default_icon_list().
- bool list_toplevels (std::vector< Widget * > &toplevels)
    Retrieves a list of all existing toplevel windows.
- void set_default_icon_list (std::vector< Gdk::Pixbuf * > &icons)
    Sets an icon list to be used as fallback for windows that haven't had set_icon_list() called on them to set up a window-specific icon list.
- bool set_default_icon_from_file (const String &filename, G::Error *error=0)
    Sets an icon to be used as a fallback for windows that haven't had set_icon_list() called on them from a file on disk.
- void set_auto_startup_notification (bool setting)
    Whether to do automatic startup notification.

## Protected Member Functions

Constructors

- Window (GtkWindow *window, bool reference=false)
    Construct a new Window from an existing GtkWindow.

Signal Handlers

- virtual void on_set_focus (Widget *focus)
    Called when the focus widget for the window changes.
- virtual bool on_frame_event (const Gdk::Event &event)
    Called whenever the window receives an event targeted at the frame.
- virtual void on_keys_changed ()
    Called when the windows menmonic and/or accelerator keys have changed.
- virtual bool on_delete_event (const Gdk::EventAny &event)
    Called when the user tries to close an application from the window manager frame.

## Detailed Description

A GtkWindow C++ wrapper class.

Window is usually the first widget instantiated in an application program and for regular applications (i.e. non-popup) is known a top-level widget. Its primary job is to provide a communication interface bewteen your application and the window manager. When the user resizes the application's main window with the window manager, that information is passed to the Window. Window is derived from Bin and thus can only have one child.

## Constructor & Destructor Documentation

Inti::Gtk::Window::Window | ( | GtkWindow * | window,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new Window from an existing GtkWindow.

Parameters:

  window | A pointer to a GtkWindow.
  reference | Set false if the initial reference count is floating, set true if it's not.

The window can be a newly created GtkWindow or an existing GtkWindow (see G::Object::Object).

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

Construct a new window which is a toplevel window and can contain other widgets.

Parameters:

  type | The type of window.

Nearly always, the type of the window should be WINDOW_TOPLEVEL. If you're implementing something like a popup menu from scratch (which is a bad idea, just use Menu), you might use WINDOW_POPUP. WINDOW_POPUP is not for dialogs, though in some other toolkits dialogs are called "popups". In GTK+, WINDOW_POPUP means a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the window manager. If you simply want an undecorated window (no window borders), use set_decorated(), don't use WINDOW_POPUP.

## Member Function Documentation

bool Inti::Gtk::Window::activate_default | ( |  | ) |

Activate the default widget.

Returns:
  true if the default widget was activatable.

Activation is what happens when you press Enter on a widget during key navigation; clicking a button, selecting a menu item, etc. If the default widget isn't activatable, then the current focused widget will be activated. If the focused widget isn't activatable, this method returns false.

bool Inti::Gtk::Window::activate_focus | ( |  | ) |

Activate the current focused widget.

Returns:
  true if the widget was activatable.

Activation is what happens when you press Enter on a widget during key navigation; clicking a button, selecting a menu item, etc. If widget isn't activatable, this method returns false.

AccelGroup* Inti::Gtk::Window::add_accel_group | ( | AccelGroup * | accel_group = 0 | ) |

Associate accel_group with the window, such that calling Gtk::AccelGroup_activate() on the window will activate accelerators in accel_group.

Parameters:

  accel_group | An AccelGroup.

If accel_group is null a newly created AccelGroup owned by the window is returned, otherwise accel_group is returned.

void Inti::Gtk::Window::add_mnemonic | ( | unsigned int | keyval,
|  | Widget & | target
| ) |

Adds a mnemonic to this window.

Parameters:

  keyval | The mnemonic.
  target | The widget that gets activated by the mnemonic.

void Inti::Gtk::Window::begin_move_drag | ( | int | button,
|  | int | root_x,
|  | int | root_y,
|  | unsigned int | timestamp
| ) |

Starts moving a window.

Parameters:

  button | The mouse button that initiated the drag.
  root_x | The X position where the user clicked to initiate the drag, in root window coordinates.
  root_y | The Y position where the user clicked to initiate the drag in root window coordinates.
  timestamp | The timestamp from the click event that initiated the drag.

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

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

Starts resizing a window.

Parameters:

  edge | The position of the resize control.
  button | The mouse button that initiated the drag.
  root_x | The X position where the user clicked to initiate the drag, in root window coordinates.
  root_y | The Y position where the user clicked to initiate the drag in root window coordinates.
  timestamp | The timestamp from the click event that initiated the drag.

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

void Inti::Gtk::Window::deiconify | ( |  | ) |

| Asks to deiconify (unminimize) the specified window. Note that you shouldn't assume the window is definitely deiconified afterward, because other entities (e.g. the user or window manager) could iconify it again before your code which assumes deiconification gets to run. You can track iconification via the "window_state_event" signal on the window.

void Inti::Gtk::Window::fullscreen | ( |  | ) |

Asks to place the window in the fullscreen state.

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

bool Inti::Gtk::Window::get_default_icon_list | ( | std::vector< Gdk::Pixbuf * > & | icons | ) | `[static]`

Gets the icon list set by set_default_icon_list().

Parameters:

  icons | A reference to a vector of Gdk::Pixbuf* to hold the list.

Returns:
  true if the vector is not empty.

The pixbufs in the list have not had their reference count incremented, so don't unreference them.

void Inti::Gtk::Window::get_default_size | ( | int * | width,
|  | int * | height
| ) | const

Gets the default size of the window.

Parameters:

  width | The location to store the default width, or null.
  height | The location to store the default height, or null.

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

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

Retrieves the current focused widget within the window.

Returns:
  The currently focused widget.

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

void Inti::Gtk::Window::get_frame_dimensions | ( | int * | left,
|  | int * | top,
|  | int * | right,
|  | int * | bottom
| ) | const

Retrieves the dimensions of the frame window for this toplevel.

See set_has_frame(), set_frame_dimensions().

Parameters:

  left | The location to store the width of the frame at the left, or null.
  top | The location to store the height of the frame at the top, or null.
  right | The location to store the width of the frame at the returns, or null.
  bottom | The location to store the height of the frame at the bottom, or null.

This is a special-purpose method intended for the framebuffer port; see set_has_frame(). It will not return the size of the window border drawn by the window manager, which is the normal case when using a windowing system. See Gdk::Window::get_frame_extents() to get the standard window border extents.)

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

Gets the value set by set_gravity().

Returns:
  The window gravity.

bool Inti::Gtk::Window::get_has_frame | ( |  | ) | const

Returns whether the window has a frame window exterior to gtk_window()->window (see set_has_frame()).

Returns:
  true if a frame has been added to the window via set_has_frame().

Gdk::Pixbuf* Inti::Gtk::Window::get_icon | ( |  | ) | const

Gets the value set by set_icon(), or if you've called set_icon_list(), gets the first icon in the icon list.

Returns:
  The icon for window.

bool Inti::Gtk::Window::get_icon_list | ( | std::vector< Gdk::Pixbuf * > & | icons | ) | const

Retrieves the list of icons set by set_icon_list().

Parameters:

  icons | A reference to a vector of Gdk::Pixbuf* to hold the list.

Returns:
  true if the vector is not empty.

The reference count on each member won't be incremented.

Gdk::ModifierTypeField Inti::Gtk::Window::get_mnemonic_modifier | ( |  | ) | const

Returns the mnemonic modifier for this window (see set_mnemonic_modifier()).

Returns:
  The modifier mask used to activate mnemonics on this window.

void Inti::Gtk::Window::get_position | ( | int * | root_x,
|  | int * | root_y
| ) | const

This method returns the position you need to pass to move() to keep window in its current position; the meaning of the returned value varies with window gravity (see move() for more details).

Parameters:

  root_x | The return location for X coordinate of gravity-determined reference point.
  root_y | The return location for Y coordinate of gravity-determined reference point.

If you haven't changed the window gravity, its gravity will be GRAVITY_NORTH_WEST. This means that get_position() gets the position of the top-left corner of the window manager frame for the window. move() sets the position of this same top-left corner. get_position() is not 100% reliable because the X Window System does not specify a way to obtain the geometry of the decorations placed on a window by the window manager. Thus GTK+ is using a "best guess" that works with most window managers. Moreover, nearly all window managers are historically broken with respect to their handling of window gravity. So moving a window to its current position as returned by get_position() tends to result in moving the window slightly. Window managers are slowly getting better over time. If a window has gravity GRAVITY_STATIC the window manager frame is not relevant, and thus get_position() will always produce accurate results. However you can't use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations. If you are saving and restoring your application's window positions, you should know that it's impossible for applications to do this without getting it somewhat wrong because applications do not have sufficient knowledge of window manager state. The Correct Mechanism is to support the session management protocol (see the "GnomeClient" object in the GNOME libraries for example) and allow the window manager to save your window sizes and positions.

bool Inti::Gtk::Window::get_resizable | ( |  | ) | const

Gets the value set by set_resizable().

Returns:
  true if the user can resize the window.

String Inti::Gtk::Window::get_role | ( |  | ) | const

Returns the role of the window (see set_role() for further explanation).

Returns:
  The role of the window if set, or a null String.

void Inti::Gtk::Window::get_size | ( | int * | width,
|  | int * | height
| ) | const

Obtains the current size of the window.

Parameters:

  width | The return location for width, or null.
  height | The return location for height, or null.

If the window is not onscreen, it returns the size GTK+ will suggest to the window manager for the initial window size (but this is not reliably the same as the size the window manager will actually select). The size obtained by get_size() is the last size received in a GdkEventConfigure, that is, GTK+ uses its locally-stored size, rather than querying the X server for the size. As a result, if you call resize() then immediately call get_size(), the size won't have taken effect yet. After the window manager processes the resize request, GTK+ receives notification that the size has changed via a configure event, and the size of the window gets updated.

Note 1: Nearly any use of this function creates a race condition, because the size of the window may change between the time that you get the size and the time that you perform some action assuming that size is the current size. To avoid race conditions, connect to "configure_event" on the window and adjust your size-dependent state to match the size delivered in the GdkEventConfigure.

Note 2: The returned size does not include the size of the window manager decorations (aka the window frame or border). Those are not drawn by GTK+ and GTK+ has no reliable method of determining their size.

Note 3: If you are getting a window size in order to position the window onscreen, there may be a better way. The preferred way is to simply set the window's semantic type with set_type_hint(), which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with set_transient_for() window managers will often center the dialog over its parent window. It's much preferred to let the window manager handle these things rather than doing it yourself, because all applications will behave consistently and according to user preferences if the window manager handles it. Also, the window manager can take the size of the window decorations/border into account, while your application cannot.

In any case, if you insist on application-specified window positioning, there's still a better way than doing it yourself - set_position() will frequently handle the details for you.

bool Inti::Gtk::Window::get_skip_pager_hint | ( |  | ) | const

Gets the value set by set_skip_pager_hint().

Returns:
  true if the window shouldn't be in the pager.

bool Inti::Gtk::Window::get_skip_taskbar_hint | ( |  | ) | const

Gets the value set by set_skip_taskbar_hint().

Returns:
  true if the window shouldn't be in the taskbar.

String Inti::Gtk::Window::get_title | ( |  | ) | const

Retrieves the title of the window (see set_title()).

Returns:
  The title of the window, or a null String if none has been set explicitely.

Window* Inti::Gtk::Window::get_transient_for | ( |  | ) | const

Fetches the transient parent for this window (see set_transient_for()).

Returns:
  The transient parent for this window, or null if no transient parent has been set.

Gdk::WindowTypeHint Inti::Gtk::Window::get_type_hint | ( |  | ) | const

Gets the type hint for this window (see set_type_hint()).

Returns:
  The type hint for the window.

void Inti::Gtk::Window::iconify | ( |  | ) |

Asks to iconify (minimize) the specified window.

Note that you shouldn't assume the window is definitely iconified afterward, because other entities (e.g. the user or window manager) could deiconify it again, or there may not be a window manager in which case iconification isn't possible, etc. But normally the window will end up iconified. Just don't write code that crashes if not. It's permitted to call this method before showing a window, in which case the window will be iconified before it ever appears onscreen. You can track iconification via the "window_state_event" signal on the window.

bool Inti::Gtk::Window::list_toplevels | ( | std::vector< Widget * > & | toplevels | ) | `[static]`

Retrieves a list of all existing toplevel windows.

Parameters:

  toplevels | A reference to a vector of Widget* to hold the list.

Returns:
  true if the vector is not empty.

The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call ref() on all the widgets first, and then unref() all the widgets afterwards.

void Inti::Gtk::Window::maximize | ( |  | ) |

Asks to maximize window, so that it becomes full-screen.

Note that you shouldn't assume the window is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization. But normally the window will end up maximized. Just don't write code that crashes if not. It's permitted to call this method before showing a window, in which case the window will be maximized when it appears onscreen initially. You can track maximization via the "window_state_event" signal on the window.

bool Inti::Gtk::Window::mnemonic_activate | ( | unsigned int | keyval,
|  | Gdk::ModifierTypeField | modifier
| ) |

Activates the targets associated with the mnemonic.

Parameters:

  keyval | The mnemonic.
  modifier | The modifiers

Returns:
  true if the activation is done.

void Inti::Gtk::Window::move | ( | const Gdk::Point & | point | ) |

Asks the window manager to move window to the given point (see move(int, int)).

Parameters:

  point | The X,Y coordinates to move window to, as a Gdk::Point.

void Inti::Gtk::Window::move | ( | int | x,
|  | int | y
| ) |

Asks the window manager to move window to the given position.

Parameters:

  x | The X coordinate to move window to.
  y | The Y coordinate to move window to.

Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown.

Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point. By default the gravity is GRAVITY_NORTH_WEST, so the reference point is simply the x, y supplied to move(). The top-left corner of the window decorations (aka window frame or border) will be placed at x, y. Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is GRAVITY_NORTH_WEST) and move the window to 0,0. To position a window at the bottom right corner of the screen, you would set GRAVITY_SOUTH_EAST, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point. So, to place a window in the bottom right corner you would first set gravity to south east, then write:

                 move(gdk_screen_width() - window_width, gdk_screen_height() - window_height).

virtual bool Inti::Gtk::Window::on_delete_event | ( | const Gdk::EventAny & | event | ) | `[protected, virtual]`

Called when the user tries to close an application from the window manager frame.

Parameters:

  event | The Gdk::Event.

Returns:
  false to allow the application window to close.

The event.type() method will return the type identifier Gdk::DELETE. The event.window() method will return the Gdk::Window reporting the event. The event.send_event() method indicates whether the event came from the X server or another source. Returning true will prevent the application window from closing.

Note: this event handler is declared in Window because only top-level windows can receive the delete_event.

virtual bool Inti::Gtk::Window::on_frame_event | ( | const Gdk::Event & | event | ) | `[protected, virtual]`

Called whenever the window receives an event targeted at the frame.

Parameters:

  event | The Gdk::Event.

Returns:
  false to allow the default frame event handler to be called.

Returning true will prevent further propagation of this event and the default frame event handler will not be called. This handler is typically called when a user tries to resize the window frame. Returning true will prevent the frame being resized and returning false will allow the resizing to proceed.

virtual void Inti::Gtk::Window::on_set_focus | ( | Widget * | focus | ) | `[protected, virtual]`

Called when the focus widget for the window changes.

Parameters:

  focus | The focus widget, or null if the focus is unset.

bool Inti::Gtk::Window::parse_geometry | ( | const char * | geometry | ) |

Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this.

Parameters:

  geometry | The geometry string.

Returns:
  true if string was parsed successfully.

This method does work on all GTK+ ports including Win32 but is primarily intended for an X environment. If either a size or a position can be extracted from the geometry string, parse_geometry() returns true and calls set_default_size() and/or move() to resize/move the window. If parse_geometry() returns true, it will also set the Gdk::HINT_USER_POS and/or Gdk::HINT_USER_SIZE hints indicating to the window manager that the size/position of the window was user-specified. This causes most window managers to honor the geometry.

void Inti::Gtk::Window::present | ( |  | ) |

Presents a window to the user.

This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences. If the window is hidden, this method calls Gtk::Widget::show() as well. This method should be used when the user tries to open a window that's already open. Say for example the preferences dialog is currently open, and the user chooses Preferences from the menu a second time; use present() to move the already-open dialog where the user can see it.

const AllowShrinkPropertyProxy Inti::Gtk::Window::prop_allow_shrink | ( |  | ) | `[inline]`

| If true, the window has no mimimum size. Setting this to true is 99% of the time a bad idea (bool : Read / Write).

void Inti::Gtk::Window::remove_accel_group | ( | AccelGroup & | accel_group | ) |

Reverses the effects of add_accel_group().

Parameters:

  accel_group | An AccelGroup.

void Inti::Gtk::Window::remove_mnemonic | ( | unsigned int | keyval,
|  | Widget & | target
| ) |

Removes a mnemonic from this window.

Parameters:

  keyval | The mnemonic.
  target | The widget that gets activated by the mnemonic.

void Inti::Gtk::Window::resize | ( | int | width,
|  | int | height
| ) |

Resizes the window as if the user had done so, obeying geometry constraints.

Parameters:

  width | The width in pixels to resize the window to.
  height | The height in pixels to resize the window to.

The default geometry constraint is that windows may not be smaller than their size request; to override this constraint, call Gtk::Widget::set_size_request() to set the window's request to a smaller value. If resize() is called before showing a window for the first time, it overrides any default size set with set_default_size(). Windows may not be resized smaller than 1 by 1 pixels.

void Inti::Gtk::Window::set_auto_startup_notification | ( | bool | setting | ) | `[static]`

Whether to do automatic startup notification.

Parameters:

  setting | Set true to automatically do startup notification.

By default, after showing the first Gtk::Window for each Gdk::Screen, GTK+ calls gdk_screen_notify_startup_complete(). Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example. In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.

void Inti::Gtk::Window::set_decorated | ( | bool | setting | ) |

Ask the window manager to decorate or not decorate the window with a title bar, etc.

Parameters:

  setting | Set true to decorate the window.

By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow GTK+ to disable these decorations, creating a borderless window. If you set the decorated property to false using this function, GTK+ will do its best to convince the window manager not to decorate the window. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling Gtk::Widget::show().

void Inti::Gtk::Window::set_default | ( | Widget * | default_widget | ) |

The default widget is the widget that's activated when the user presses Enter in a dialog, for example.

Parameters:

  default_widget | The widget to be the default, or null to unset the default widget.

This method sets or unsets the default widget for a Window. When setting (rather than unsetting) the default widget it's generally easier to call grab_focus() on the widget. Before making a widget the default widget, you must set the CAN_DEFAULT flag on the widget you'd like to make the default using Gtk::Widget::set_flags().

bool Inti::Gtk::Window::set_default_icon_from_file | ( | const String & | filename,
|  | G::Error * | error = 0
| ) | `[static]`

Sets an icon to be used as a fallback for windows that haven't had set_icon_list() called on them from a file on disk.

Parameters:

  filename | The location of the icon file
  error | The location of a G::Error object to store any error, or null.

Returns:
  true if setting the icon succeeded.

Note: Warns on failure if error is null.

void Inti::Gtk::Window::set_default_icon_list | ( | std::vector< Gdk::Pixbuf * > & | icons | ) | `[static]`

Sets an icon list to be used as fallback for windows that haven't had set_icon_list() called on them to set up a window-specific icon list.

Parameters:

  icons | A reference to a vector of Gdk::Pixbuf* that holds the list.

This method allows you to set up the icon for all windows in your application at once. See set_icon_list() for more details.

void Inti::Gtk::Window::set_default_size | ( | int | width,
|  | int | height
| ) |

Sets the default size of a window.

Parameters:

  width | The width in pixels, or -1 to unset the default width.
  height | The height in pixels, or -1 to unset the default height.

If the window's "natural" size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the window (set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

Unlike set_size_request(), which sets a size request for a widget and thus would keep users from shrinking the window, this method only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the "natural" default size (the size request of the window).

For more control over a window's initial size and how resizing works, investigate set_geometry_hints(). For some uses, resize() is a more appropriate method. resize() changes the current size of the window, rather than the size to be used on initial display. resize() always affects the window itself, not the geometry widget. The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size. Windows can't actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size.

void Inti::Gtk::Window::set_destroy_with_parent | ( | bool | setting | ) |

If setting is true, then destroying the transient parent of window will also destroy the window itself.

Parameters:

  setting | Whether to destroy window with its transient parent.

This is useful for dialogs that shouldn't persist beyond the lifetime of the main window they're associated with, for example.

void Inti::Gtk::Window::set_focus | ( | Widget * | focus | ) |

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window.

Parameters:

  focus | The new focus widget, or null to unset the current focus widget.

If focus is null, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, it is usually more convenient to use Gtk::Widget::grab_focus() instead of this method.

void Inti::Gtk::Window::set_frame_dimensions | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom
| ) |

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

Parameters:

  left | The width of the left border.
  top | The height of the top border.
  right | The width of the right border.
  bottom | The height of the bottom border.

This method will have no effect on the window border drawn by the window manager, which is the normal case when using the X Window system. For windows with frames (see set_has_frame()) this method can be used to change the size of the frame border.

void Inti::Gtk::Window::set_geometry_hints | ( | Widget * | geometry_widget,
|  | const Gdk::Geometry & | geometry
| ) |

This function sets up hints about how a window can be resized by the user.

Parameters:

  geometry_widget | The widget the geometry hints will be applied to, or null for the toplevel widget.
  geometry | A Gdk::Geometry object containing geometry information.

You can set a minimum and maximum size; allowed resize increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. See the Gdk::Geometry.

void Inti::Gtk::Window::set_gravity | ( | Gdk::Gravity | gravity | ) |

Window gravity defines the meaning of coordinates passed to move() (see move() and Gdk::Gravity for more details).

Parameters:

  gravity | The window gravity

The default window gravity is GRAVITY_NORTH_WEST which will typically "do what you mean."

void Inti::Gtk::Window::set_has_frame | ( | bool | setting | ) |

This is a special-purpose method for the framebuffer port, that causes GTK+ to draw its own window border.

Parameters:

  setting | Set true if the window is to have a frame.

For most applications, you want set_decorated() instead, which tells the window manager whether to draw the window border. If this method is called on a window with setting of true, before it is realized or showed, it will have a "frame" window around window->window, accessible in gtk_window()->frame. Using the signal frame_event you can recieve all events targeted at the frame.

This method is used by the linux-fb port to implement managed windows, but it could concievably be used by X-programs that want to do their own window decorations.

void Inti::Gtk::Window::set_icon | ( | Gdk::Pixbuf & | icon | ) |

Sets up the icon representing the window.

Parameters:

  icon | The icon image, or null.

This icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. The icon should be provided in whatever size it was naturally drawn; that is, don't scale the image before passing it to GTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. If you have your icon hand-drawn in multiple sizes, use set_icon_list(). Then the best size will be used. This method is equivalent to calling set_icon_list() with one element in the list. See also set_default_icon_list() to set the icon for all windows in your application in one go.

bool Inti::Gtk::Window::set_icon_from_file | ( | const String & | filename,
|  | G::Error * | error = 0
| ) |

Sets the icon for the window.

Parameters:

  filename | The location of the icon file.
  error | The location of a G::Error object to store any error, or null.

Returns:
  true if setting the icon succeeded.

This method is equivalent to calling set_icon() with a pixbuf created by loading the image from filename. There are several examples of using G::Error in the source code for inti-demo program.

Note: Warns on failure if error is null.

void Inti::Gtk::Window::set_icon_list | ( | std::vector< Gdk::Pixbuf * > & | icons | ) |

Sets up the icon representing the window.

Parameters:

  icons | A reference to a vector of Gdk::Pixbuf* that holds the list.

The icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. set_icon_list() allows you to pass in the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is available in; that is, don't scale the image before passing it to GTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling. Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them. See also set_default_icon_list() to set the icon for all windows in your application in one go.

Note that transient windows (those who have been set transient for another window using set_transient_for()) will inherit their icon from their transient parent. So there's no need to explicitly set the icon on transient windows.

void Inti::Gtk::Window::set_mnemonic_modifier | ( | Gdk::ModifierTypeField | modifier | ) |

Sets the mnemonic modifier for this window.

Parameters:

  modifier | The modifier mask used to activate mnemonics on this window.

void Inti::Gtk::Window::set_modal | ( | bool | modal | ) |

Sets a window modal or non-modal.

Parameters:

  modal | Whether the window is modal.

Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of the main application windows, use set_transient_for() to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

void Inti::Gtk::Window::set_position | ( | WindowPosition | position | ) |

Sets a position constraint for this window.

Parameters:

  position | A position constraint.

If the old or new constraint is WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

void Inti::Gtk::Window::set_resizable | ( | bool | resizable | ) |

Sets whether the user can resize a window.

Parameters:

  resizable | true if the user can resize this window.

Windows are user resizable by default.

void Inti::Gtk::Window::set_role | ( | const String & | role | ) |

This method is only useful on X11, not with other GTK+ targets.

Parameters:

  role | The unique identifier for the window to be used when restoring a session.

In combination with the window title, the window role allows a window manager to identify "the same" window when an application is restarted. So for example you might set the "toolbox" role on your app's toolbox window, so that when the user restarts their session, the window manager can put the toolbox back in the same place. If a window already has a unique title, you don't need to set the role, since the window manager can use the title to identify the window when restoring the session.

void Inti::Gtk::Window::set_screen | ( | const Gdk::Screen & | screen | ) |

Sets the Gdk::Screen where the window is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.

Parameters:

  screen | A Gdk::Screen.

void Inti::Gtk::Window::set_skip_pager_hint | ( | bool | setting | ) |

Windows may set a hint asking the desktop environment not to display the window in the pager; this function toggles this hint.

Parameters:

  setting | Set true to keep this window from appearing in the pager.

A "pager" is any desktop navigation tool such as a workspace switcher that displays a thumbnail representation of the windows on the screen.

void Inti::Gtk::Window::set_skip_taskbar_hint | ( | bool | setting | ) |

Windows may set a hint asking the desktop environment not to display the window in the task bar; this method toggles this hint.

Parameters:

  setting | Set true to keep this window from appearing in the task bar.

void Inti::Gtk::Window::set_title | ( | const String & | title | ) |

Sets the title of the window.

Parameters:

  title | The title of the window.

The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager, so exactly how the title appears to users may vary according to a user's exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example.

void Inti::Gtk::Window::set_transient_for | ( | Window * | parent | ) |

Dialog windows should be set transient for the main application window they were spawned from.

Parameters:

  parent | The parent window.

This method allows window managers to e.g. keep a dialog on top of the main window, or center the dialog over the main window.

void Inti::Gtk::Window::set_type_hint | ( | Gdk::WindowTypeHint | hint | ) |

By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.

Parameters:

  hint | The window type.

This method should be called before the window becomes visible. Gtk::Dialog will sometimes call set_type_hint() on your behalf, so you wont need to.

void Inti::Gtk::Window::set_wmclass | ( | const String & | wmclass_name,
|  | const String & | wmclass_class
| ) |

Sets the X Window System "class" and "name" hints for a window.

Parameters:

  wmclass_name | The window name hint.
  wmclass_class | The window class hint.

Don't use this method. According to the ICCCM, you should always set wmclass_name and wmclass_class to the same value for all windows in an application, and GTK+ sets them to that value by default, so calling this method is sort of pointless. However, you may want to call set_role() on each window in your application, for the benefit of the session manager. Setting the role allows the window manager to restore window positions when loading a saved session.

void Inti::Gtk::Window::stick | ( |  | ) |

Asks to stick the window, which means that it will appear on all user desktops.

Note that you shouldn't assume the window is definitely stuck afterward, because other entities (e.g. the user or window manager) could unstick it again, and some window managers do not support sticking windows. But normally the window will end up stuck. Just don't write code that crashes if not. It's permitted to call this method before showing a window. You can track stickiness via the "window_state_event" signal on the window.

void Inti::Gtk::Window::unfullscreen | ( |  | ) |

Asks to toggle off the fullscreen state for the window.

Note that you shouldn't assume the window is definitely not full screen afterward, because other entities (e.g. the user or window manager) could fullscreen it again, and not all window managers honor requests to unfullscreen windows. But normally the window will end up restored to its normal state. Just don't write code that crashes if not. You can track the fullscreen state via the Gtk::Widget "window_state_event" signal.

void Inti::Gtk::Window::unmaximize | ( |  | ) |

Asks to unmaximize window.

Note that you shouldn't assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) could maximize it again, and not all window managers honor requests to unmaximize. But normally the window will end up unmaximized. Just don't write code that crashes if not. You can track maximization via the "window_state_event" signal on the window.

void Inti::Gtk::Window::unstick | ( |  | ) |

Asks to unstick the window, which means that it will appear on only one of the user's desktops.

Note that you shouldn't assume the window is definitely unstuck afterward, because other entities (e.g. the user or window manager) could stick it again. But normally the window will end up stuck. Just don't write code that crashes if not. You can track stickiness via the "window_state_event" signal on the window.

The documentation for this class was generated from the following file:

- gtk/window.h

Main Page - Footer