Class

GtkWindow

Description [src]

class Gtk.Window : Gtk.Bin
  implements Atk.ImplementorIface, Gtk.Buildable {
  priv: GtkWindowPrivate*
}

A GtkWindow is a toplevel window which can contain other widgets. Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,…).

GtkWindow as GtkBuildable

The GtkWindow implementation of the GtkBuildable interface supports a custom <accel-groups> element, which supports any number of <group> elements representing the GtkAccelGroup objects you want to add to your window (synonymous with gtk_window_add_accel_group().

It also supports the <initial-focus> element, whose name property names the widget to receive the focus when the window is mapped.

An example of a UI definition fragment with accel groups:

<object class="GtkWindow">
  <accel-groups>
    <group name="accelgroup1"/>
  </accel-groups>
  <initial-focus name="thunderclap"/>
</object>

...

<object class="GtkAccelGroup" id="accelgroup1"/>

The GtkWindow implementation of the GtkBuildable interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.

CSS nodes

window.background
├── decoration
├── <titlebar child>.titlebar [.default-decoration]
╰── <child>

GtkWindow has a main CSS node with name window and style class .background, and a subnode with name decoration.

Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also represents window states with the following style classes on the main node: .tiled, .maximized, .fullscreen. Specialized types of window often add their own discriminating style classes, such as .popup or .tooltip.

GtkWindow adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.

Hierarchy

hierarchy this GtkWindow implements_0 AtkImplementorIface this--implements_0 implements_1 GtkBuildable this--implements_1 ancestor_0 GtkBin ancestor_0--this ancestor_1 GtkContainer ancestor_1--ancestor_0 ancestor_2 GtkWidget ancestor_2--ancestor_1 ancestor_3 GInitiallyUnowned ancestor_3--ancestor_2 ancestor_4 GObject ancestor_4--ancestor_3

Constructors

gtk_window_new

Creates a new GtkWindow, which is a toplevel window that can contain other widgets. Nearly always, the type of the window should be #GTK_WINDOW_TOPLEVEL. If you’re implementing something like a popup menu from scratch (which is a bad idea, just use GtkMenu), you might use #GTK_WINDOW_POPUP. #GTK_WINDOW_POPUP is not for dialogs, though in some other toolkits dialogs are called “popups”. In GTK+, #GTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the [window manager][gtk-X11-arch].

Functions

gtk_window_get_default_icon_list

Gets the value set by gtk_window_set_default_icon_list(). The list is a copy and should be freed with g_list_free(), but the pixbufs in the list have not had their reference count incremented.

gtk_window_get_default_icon_name

Returns the fallback icon name for windows that has been set with gtk_window_set_default_icon_name(). The returned string is owned by GTK+ and should not be modified. It is only valid until the next call to gtk_window_set_default_icon_name().

since: 2.16

gtk_window_list_toplevels

Returns a list of all existing toplevel windows. 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 g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the widgets afterwards.

gtk_window_set_auto_startup_notification

By default, after showing the first GtkWindow, GTK+ calls gdk_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.

since: 2.2

gtk_window_set_default_icon

Sets an icon to be used as fallback for windows that haven’t had gtk_window_set_icon() called on them from a pixbuf.

since: 2.4

gtk_window_set_default_icon_from_file

Sets an icon to be used as fallback for windows that haven’t had gtk_window_set_icon_list() called on them from a file on disk. Warns on failure if err is NULL.

since: 2.2

gtk_window_set_default_icon_list

Sets an icon list to be used as fallback for windows that haven’t had gtk_window_set_icon_list() called on them to set up a window-specific icon list. This function allows you to set up the icon for all windows in your app at once.

gtk_window_set_default_icon_name

Sets an icon to be used as fallback for windows that haven’t had gtk_window_set_icon_list() called on them from a named themed icon, see gtk_window_set_icon_name().

since: 2.6

gtk_window_set_interactive_debugging

Opens or closes the [interactive debugger][interactive-debugging], which offers access to the widget hierarchy of the application and to useful debugging tools.

since: 3.14

Instance methods

gtk_window_activate_default

Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see gtk_widget_set_receives_default()), in which case the focused widget is activated.

gtk_window_activate_focus

Activates the current focused widget within the window.

gtk_window_activate_key

Activates mnemonics and accelerators for this GtkWindow. This is normally called by the default ::key_press_event handler for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.

since: 2.4

gtk_window_add_accel_group

Associate accel_group with window, such that calling gtk_accel_groups_activate() on window will activate accelerators in accel_group.

gtk_window_add_mnemonic

Adds a mnemonic to this window.

gtk_window_begin_move_drag

Starts moving a window. This function 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][gtk-X11-arch] or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.

gtk_window_begin_resize_drag

Starts resizing a window. This function 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][gtk-X11-arch] or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.

gtk_window_close

Requests that the window is closed, similar to what happens when a window manager close button is clicked.

since: 3.10

gtk_window_deiconify

Asks to deiconify (i.e. 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][gtk-X11-arch])) could iconify it again before your code which assumes deiconification gets to run.

gtk_window_fullscreen

Asks to place 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][gtk-X11-arch]) 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.

since: 2.2

gtk_window_fullscreen_on_monitor

Asks to place window in the fullscreen state. Note that you shouldn’t assume the window is definitely full screen afterward.

since: 3.18

gtk_window_get_accept_focus

Gets the value set by gtk_window_set_accept_focus().

since: 2.4

gtk_window_get_application

Gets the GtkApplication associated with the window (if any).

since: 3.0

gtk_window_get_attached_to

Fetches the attach widget for this window. See gtk_window_set_attached_to().

since: 3.4

gtk_window_get_decorated

Returns whether the window has been set to have decorations such as a title bar via gtk_window_set_decorated().

gtk_window_get_default_size

Gets the default size of the window. 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.

gtk_window_get_default_widget

Returns the default widget for window. See gtk_window_set_default() for more details.

since: 2.14

gtk_window_get_deletable

Returns whether the window has been set to have a close button via gtk_window_set_deletable().

since: 2.10

gtk_window_get_destroy_with_parent

Returns whether the window will be destroyed with its transient parent. See gtk_window_set_destroy_with_parent ().

gtk_window_get_focus

Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then gtk_widget_has_focus (widget) will not be TRUE for the widget.

gtk_window_get_focus_on_map

Gets the value set by gtk_window_set_focus_on_map().

since: 2.6

gtk_window_get_focus_visible

Gets the value of the GtkWindow:focus-visible property.

since: 3.2

gtk_window_get_gravity

Gets the value set by gtk_window_set_gravity().

gtk_window_get_group

Returns the group for window or the default group, if window is NULL or if window does not have an explicit window group.

since: 2.10

gtk_window_get_has_resize_grip

Determines whether the window may have a resize grip.

deprecated: 3.14 since: 3.0

gtk_window_get_hide_titlebar_when_maximized

Returns whether the window has requested to have its titlebar hidden when maximized. See gtk_window_set_hide_titlebar_when_maximized ().

since: 3.4

gtk_window_get_icon

Gets the value set by gtk_window_set_icon() (or if you’ve called gtk_window_set_icon_list(), gets the first icon in the icon list).

gtk_window_get_icon_list

Retrieves the list of icons set by gtk_window_set_icon_list(). The list is copied, but the reference count on each member won’t be incremented.

gtk_window_get_icon_name

Returns the name of the themed icon for the window, see gtk_window_set_icon_name().

since: 2.6

gtk_window_get_mnemonic_modifier

Returns the mnemonic modifier for this window. See gtk_window_set_mnemonic_modifier().

gtk_window_get_mnemonics_visible

Gets the value of the GtkWindow:mnemonics-visible property.

since: 2.20

gtk_window_get_modal

Returns whether the window is modal. See gtk_window_set_modal().

gtk_window_get_opacity

Fetches the requested opacity for this window. See gtk_window_set_opacity().

deprecated: 3.8 since: 2.12

gtk_window_get_position

This function returns the position you need to pass to gtk_window_move() to keep window in its current position. This means that the meaning of the returned value varies with window gravity. See gtk_window_move() for more details.

gtk_window_get_resizable

Gets the value set by gtk_window_set_resizable().

gtk_window_get_resize_grip_area

If a window has a resize grip, this will retrieve the grip position, width and height into the specified GdkRectangle.

deprecated: 3.14 since: 3.0

gtk_window_get_role

Returns the role of the window. See gtk_window_set_role() for further explanation.

gtk_window_get_screen

Returns the GdkScreen associated with window.

since: 2.2

gtk_window_get_size

Obtains the current size of window.

gtk_window_get_skip_pager_hint

Gets the value set by gtk_window_set_skip_pager_hint().

since: 2.2

gtk_window_get_skip_taskbar_hint

Gets the value set by gtk_window_set_skip_taskbar_hint()

since: 2.2

gtk_window_get_title

Retrieves the title of the window. See gtk_window_set_title().

gtk_window_get_titlebar

Returns the custom titlebar that has been set with gtk_window_set_titlebar().

since: 3.16

gtk_window_get_transient_for

Fetches the transient parent for this window. See gtk_window_set_transient_for().

gtk_window_get_type_hint

Gets the type hint for this window. See gtk_window_set_type_hint().

gtk_window_get_urgency_hint

Gets the value set by gtk_window_set_urgency_hint()

since: 2.8

gtk_window_get_window_type

Gets the type of the window. See GtkWindowType.

since: 2.20

gtk_window_has_group

Returns whether window has an explicit window group.

gtk_window_has_toplevel_focus

Returns whether the input focus is within this GtkWindow. For real toplevel windows, this is identical to gtk_window_is_active(), but for embedded windows, like GtkPlug, the results will differ.

since: 2.4

gtk_window_iconify

Asks to iconify (i.e. 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][gtk-X11-arch]) 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.

gtk_window_is_active

Returns whether the window is part of the current active toplevel. (That is, the toplevel window receiving keystrokes.) The return value is TRUE if the window is active toplevel itself, but also if it is, say, a GtkPlug embedded in the active toplevel. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window. See gtk_window_has_toplevel_focus()

since: 2.4

gtk_window_is_maximized

Retrieves the current maximized state of window.

since: 3.12

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][gtk-X11-arch]) 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.

gtk_window_mnemonic_activate

Activates the targets associated with the mnemonic.

gtk_window_move

Asks the [window manager][gtk-X11-arch] to move window to the given position. 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.

gtk_window_parse_geometry

Parses a standard X Window System geometry string - see the manual page for X (type “man X”) for details on this. gtk_window_parse_geometry() does work on all GTK+ ports including Win32 but is primarily intended for an X environment.

deprecated: 3.20 

gtk_window_present

Presents a window to the user. This function should not be used as when it is called, it is too late to gather a valid timestamp to allow focus stealing prevention to work correctly.

gtk_window_present_with_time

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.

since: 2.8

gtk_window_propagate_key_event

Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event. This is normally called by the default ::key_press_event and ::key_release_event handlers for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.

since: 2.4

gtk_window_remove_accel_group

Reverses the effects of gtk_window_add_accel_group().

gtk_window_remove_mnemonic

Removes a mnemonic from this window.

gtk_window_reshow_with_initial_size

Hides window, then reshows it, resetting the default size and position of the window. Used by GUI builders only.

deprecated: 3.10 

gtk_window_resize

Resizes the window as if the user had done so, obeying geometry constraints. 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.

gtk_window_resize_grip_is_visible

Determines whether a resize grip is visible for the specified window.

deprecated: 3.14 since: 3.0

gtk_window_resize_to_geometry

Like gtk_window_resize(), but width and height are interpreted in terms of the base size and increment set with gtk_window_set_geometry_hints.

deprecated: 3.20 since: 3.0

gtk_window_set_accept_focus

Windows may set a hint asking the desktop environment not to receive the input focus. This function sets this hint.

since: 2.4

gtk_window_set_application

Sets or unsets the GtkApplication associated with the window.

since: 3.0

gtk_window_set_attached_to

Marks window as attached to attach_widget. This creates a logical binding between the window and the widget it belongs to, which is used by GTK+ to propagate information such as styling or accessibility to window as if it was a children of attach_widget.

since: 3.4

gtk_window_set_decorated

By default, windows are decorated with a title bar, resize controls, etc. Some [window managers][gtk-X11-arch] 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().

gtk_window_set_default

The default widget is the widget that’s activated when the user presses Enter in a dialog (for example). This function sets or unsets the default widget for a GtkWindow. When setting (rather than unsetting) the default widget it’s generally easier to call gtk_widget_grab_default() on the widget. Before making a widget the default widget, you must call gtk_widget_set_can_default() on the widget you’d like to make the default.

gtk_window_set_default_geometry

Like gtk_window_set_default_size(), but width and height are interpreted in terms of the base size and increment set with gtk_window_set_geometry_hints.

deprecated: 3.20 since: 3.0

gtk_window_set_default_size

Sets the default size of a window. 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 (gtk_window_set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

gtk_window_set_deletable

By default, windows have a close button in the window frame. Some [window managers][gtk-X11-arch] allow GTK+ to disable this button. If you set the deletable property to FALSE using this function, GTK+ will do its best to convince the window manager not to show a close button. 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().

since: 2.10

gtk_window_set_destroy_with_parent

If setting is TRUE, then destroying the transient parent of window will also destroy window itself. This is useful for dialogs that shouldn’t persist beyond the lifetime of the main window they’re associated with, for example.

gtk_window_set_focus

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. 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 function.

gtk_window_set_focus_on_map

Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped. This function sets this hint.

since: 2.6

gtk_window_set_focus_visible

Sets the GtkWindow:focus-visible property.

since: 3.2

gtk_window_set_geometry_hints

This function sets up hints about how a window can be resized by the user. 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 GdkGeometry struct.

gtk_window_set_gravity

Window gravity defines the meaning of coordinates passed to gtk_window_move(). See gtk_window_move() and GdkGravity for more details.

gtk_window_set_has_resize_grip

Sets whether window has a corner resize grip.

deprecated: 3.14 since: 3.0

gtk_window_set_has_user_ref_count

Tells GTK+ whether to drop its extra reference to the window when gtk_widget_destroy() is called.

since: 3.0

gtk_window_set_hide_titlebar_when_maximized

If setting is TRUE, then window will request that it’s titlebar should be hidden when maximized. This is useful for windows that don’t convey any information other than the application name in the titlebar, to put the available screen space to better use. If the underlying window system does not support the request, the setting will not have any effect.

since: 3.4

gtk_window_set_icon

Sets up the icon representing a GtkWindow. 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. On others, the icon is not used at all, so your mileage may vary.

gtk_window_set_icon_from_file

Sets the icon for window. Warns on failure if err is NULL.

since: 2.2

gtk_window_set_icon_list

Sets up the icon representing a GtkWindow. 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. On others, the icon is not used at all, so your mileage may vary.

gtk_window_set_icon_name

Sets the icon for the window from a named themed icon. See the docs for GtkIconTheme for more details. On some platforms, the window icon is not used at all.

since: 2.6

gtk_window_set_keep_above

Asks to keep window above, so that it stays on top. Note that you shouldn’t assume the window is definitely above afterward, because other entities (e.g. the user or [window manager][gtk-X11-arch]) could not keep it above, and not all window managers support keeping windows above. But normally the window will end kept above. Just don’t write code that crashes if not.

since: 2.4

gtk_window_set_keep_below

Asks to keep window below, so that it stays in bottom. Note that you shouldn’t assume the window is definitely below afterward, because other entities (e.g. the user or [window manager][gtk-X11-arch]) could not keep it below, and not all window managers support putting windows below. But normally the window will be kept below. Just don’t write code that crashes if not.

since: 2.4

gtk_window_set_mnemonic_modifier

Sets the mnemonic modifier for this window.

gtk_window_set_mnemonics_visible

Sets the GtkWindow:mnemonics-visible property.

since: 2.20

gtk_window_set_modal

Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use gtk_window_set_transient_for() to make the dialog transient for the parent; most [window managers][gtk-X11-arch] will then disallow lowering the dialog below the parent.

gtk_window_set_opacity

Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) On X11 this has any effect only on X screens with a compositing manager running. See gtk_widget_is_composited(). On Windows it should work always.

deprecated: 3.8 since: 2.12

gtk_window_set_position

Sets a position constraint for this window. If the old or new constraint is GTK_WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

gtk_window_set_resizable

Sets whether the user can resize a window. Windows are user resizable by default.

gtk_window_set_role

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

gtk_window_set_screen

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

since: 2.2

gtk_window_set_skip_pager_hint

Windows may set a hint asking the desktop environment not to display the window in the pager. This function sets this hint. (A “pager” is any desktop navigation tool such as a workspace switcher that displays a thumbnail representation of the windows on the screen.)

since: 2.2

gtk_window_set_skip_taskbar_hint

Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint.

since: 2.2

gtk_window_set_startup_id

Startup notification identifiers are used by desktop environment to track application startup, to provide user feedback and other features. This function changes the corresponding property on the underlying GdkWindow. Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling gtk_window_present() or any equivalent function generating a window map event.

since: 2.12

gtk_window_set_title

Sets the title of the GtkWindow. 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][gtk-X11-arch], 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.

gtk_window_set_titlebar

Sets a custom titlebar for window.

since: 3.10

gtk_window_set_transient_for

Dialog windows should be set transient for the main application window they were spawned from. This allows [window managers][gtk-X11-arch] to e.g. keep the dialog on top of the main window, or center the dialog over the main window. gtk_dialog_new_with_buttons() and other convenience functions in GTK+ will sometimes call gtk_window_set_transient_for() on your behalf.

gtk_window_set_type_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.

gtk_window_set_urgency_hint

Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint.

since: 2.8

gtk_window_set_wmclass

Don’t use this function. It sets the X Window System “class” and “name” hints for a window. According to the ICCCM, you should always set these to the same value for all windows in an application, and GTK+ sets them to that value by default, so calling this function is sort of pointless. However, you may want to call gtk_window_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.

deprecated: 3.22 

gtk_window_stick

Asks to stick 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][gtk-X11-arch] 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.

gtk_window_unfullscreen

Asks to toggle off the fullscreen state for 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][gtk-X11-arch]) 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.

since: 2.2

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][gtk-X11-arch]) 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.

gtk_window_unstick

Asks to unstick 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][gtk-X11-arch]) could stick it again. But normally the window will end up unstuck. Just don’t write code that crashes if not.

Methods inherited from GtkBin (1)
gtk_bin_get_child

Gets the child of the GtkBin, or NULL if the bin contains no child widget. The returned widget does not have a reference added, so you do not need to unref it.

Methods inherited from GtkContainer (33)

Please see GtkContainer for a full list of methods.

Methods inherited from GtkWidget (263)

Please see GtkWidget for a full list of methods.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GtkBuildable (10)
gtk_buildable_add_child

Adds a child to buildable. type is an optional string describing how the child should be added.

since: 2.12

gtk_buildable_construct_child

Constructs a child of buildable with the name name.

since: 2.12

gtk_buildable_custom_finished

This is similar to gtk_buildable_parser_finished() but is called once for each custom tag handled by the buildable.

since: 2.12

gtk_buildable_custom_tag_end

This is called at the end of each custom element handled by the buildable.

since: 2.12

gtk_buildable_custom_tag_start

This is called for each unknown element under <child>.

since: 2.12

gtk_buildable_get_internal_child

Get the internal child called childname of the buildable object.

since: 2.12

gtk_buildable_get_name

Gets the name of the buildable object.

since: 2.12

gtk_buildable_parser_finished

Called when the builder finishes the parsing of a [GtkBuilder UI definition][BUILDER-UI]. Note that this will be called once for each time gtk_builder_add_from_file() or gtk_builder_add_from_string() is called on a builder.

since: 2.12

gtk_buildable_set_buildable_property

Sets the property name name to value on the buildable object.

since: 2.12

gtk_buildable_set_name

Sets the name of the buildable object.

since: 2.12

Properties

Gtk.Window:accept-focus

Whether the window should receive the input focus.

since: 2.4

Gtk.Window:application

The GtkApplication associated with the window.

since: 3.0

Gtk.Window:attached-to

The widget to which this window is attached. See gtk_window_set_attached_to().

since: 3.4

Gtk.Window:decorated

Whether the window should be decorated by the window manager.

since: 2.4

Gtk.Window:default-height
No description available.

Gtk.Window:default-width
No description available.

Gtk.Window:deletable

Whether the window frame should have a close button.

since: 2.10

Gtk.Window:destroy-with-parent
No description available.

Gtk.Window:focus-on-map

Whether the window should receive the input focus when mapped.

since: 2.6

Gtk.Window:focus-visible

Whether ‘focus rectangles’ are currently visible in this window.

since: 2.20

Gtk.Window:gravity

The window gravity of the window. See gtk_window_move() and GdkGravity for more details about window gravity.

since: 2.4

Gtk.Window:has-resize-grip

Whether the window has a corner resize grip.

deprecated: 3.14 since: 3.0

Gtk.Window:has-toplevel-focus
No description available.

Gtk.Window:hide-titlebar-when-maximized

Whether the titlebar should be hidden during maximization.

since: 3.4

Gtk.Window:icon
No description available.

Gtk.Window:icon-name

The :icon-name property specifies the name of the themed icon to use as the window icon. See GtkIconTheme for more details.

since: 2.6

Gtk.Window:is-active
No description available.

Gtk.Window:is-maximized
No description available.

Gtk.Window:mnemonics-visible

Whether mnemonics are currently visible in this window.

since: 2.20

Gtk.Window:modal
No description available.

Gtk.Window:resizable
No description available.

Gtk.Window:resize-grip-visible

Whether a corner resize grip is currently shown.

deprecated: 3.14 since: 3.0

Gtk.Window:role
No description available.

Gtk.Window:screen
No description available.

Gtk.Window:skip-pager-hint
No description available.

Gtk.Window:skip-taskbar-hint
No description available.

Gtk.Window:startup-id

The :startup-id is a write-only property for setting window’s startup notification identifier. See gtk_window_set_startup_id() for more details.

since: 2.12

Gtk.Window:title
No description available.

Gtk.Window:transient-for

The transient parent of the window. See gtk_window_set_transient_for() for more details about transient windows.

since: 2.10

Gtk.Window:type
No description available.

Gtk.Window:type-hint
No description available.

Gtk.Window:urgency-hint
No description available.

Gtk.Window:window-position
No description available.

Properties inherited from GtkContainer (3)
Gtk.Container:border-width
No description available.

Gtk.Container:child
No description available.

Gtk.Container:resize-mode
No description available.

Properties inherited from GtkWidget (39)
Gtk.Widget:app-paintable
No description available.

Gtk.Widget:can-default
No description available.

Gtk.Widget:can-focus
No description available.

Gtk.Widget:composite-child
No description available.

Gtk.Widget:double-buffered

Whether the widget is double buffered.

deprecated: 3.14 since: 2.18

Gtk.Widget:events
No description available.

Gtk.Widget:expand

Whether to expand in both directions. Setting this sets both GtkWidget:hexpand and GtkWidget:vexpand.

since: 3.0

Gtk.Widget:focus-on-click

Whether the widget should grab focus when it is clicked with the mouse.

since: 3.20

Gtk.Widget:halign

How to distribute horizontal space if widget gets extra space, see GtkAlign.

since: 3.0

Gtk.Widget:has-default
No description available.

Gtk.Widget:has-focus
No description available.

Gtk.Widget:has-tooltip

Enables or disables the emission of GtkWidget::query-tooltip on widget. A value of TRUE indicates that widget can have a tooltip, in this case the widget will be queried using GtkWidget::query-tooltip to determine whether it will provide a tooltip or not.

since: 2.12

Gtk.Widget:height-request
No description available.

Gtk.Widget:hexpand

Whether to expand horizontally. See gtk_widget_set_hexpand().

since: 3.0

Gtk.Widget:hexpand-set

Whether to use the GtkWidget:hexpand property. See gtk_widget_get_hexpand_set().

since: 3.0

Gtk.Widget:is-focus
No description available.

Gtk.Widget:margin

Sets all four sides’ margin at once. If read, returns max margin on any side.

since: 3.0

Gtk.Widget:margin-bottom

Margin on bottom side of widget.

since: 3.0

Gtk.Widget:margin-end

Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

since: 3.12

Gtk.Widget:margin-left

Margin on left side of widget.

deprecated: 3.12 since: 3.0

Gtk.Widget:margin-right

Margin on right side of widget.

deprecated: 3.12 since: 3.0

Gtk.Widget:margin-start

Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

since: 3.12

Gtk.Widget:margin-top

Margin on top side of widget.

since: 3.0

Gtk.Widget:name
No description available.

Gtk.Widget:no-show-all
No description available.

Gtk.Widget:opacity

The requested opacity of the widget. See gtk_widget_set_opacity() for more details about window opacity.

since: 3.8

Gtk.Widget:parent
No description available.

Gtk.Widget:receives-default
No description available.

Gtk.Widget:scale-factor

The scale factor of the widget. See gtk_widget_get_scale_factor() for more details about widget scaling.

since: 3.10

Gtk.Widget:sensitive
No description available.

Gtk.Widget:style

The style of the widget, which contains information about how it will look (colors, etc).

deprecated: Unknown 

Gtk.Widget:tooltip-markup

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. Also see gtk_tooltip_set_markup().

since: 2.12

Gtk.Widget:tooltip-text

Sets the text of tooltip to be the given string.

since: 2.12

Gtk.Widget:valign

How to distribute vertical space if widget gets extra space, see GtkAlign.

since: 3.0

Gtk.Widget:vexpand

Whether to expand vertically. See gtk_widget_set_vexpand().

since: 3.0

Gtk.Widget:vexpand-set

Whether to use the GtkWidget:vexpand property. See gtk_widget_get_vexpand_set().

since: 3.0

Gtk.Widget:visible
No description available.

Gtk.Widget:width-request
No description available.

Gtk.Widget:window

The widget’s window if it is realized, NULL otherwise.

since: 2.14

Signals

Gtk.Window::activate-default

The ::activate-default signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user activates the default widget of window.

Gtk.Window::activate-focus

The ::activate-focus signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user activates the currently focused widget of window.

Gtk.Window::enable-debugging

The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user enables or disables interactive debugging. When toggle is TRUE, interactive debugging is toggled on or off, when it is FALSE, the debugger will be pointed at the widget under the pointer.

Gtk.Window::keys-changed

The ::keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.

Gtk.Window::set-focus

This signal is emitted whenever the currently focused widget in this window changes.

since: 2.24

Signals inherited from GtkContainer (4)
GtkContainer::add
No description available.

GtkContainer::check-resize
No description available.

GtkContainer::remove
No description available.

GtkContainer::set-focus-child
No description available.

Signals inherited from GtkWidget (69)
GtkWidget::accel-closures-changed
No description available.

GtkWidget::button-press-event

The ::button-press-event signal will be emitted when a button (typically from a mouse) is pressed.

GtkWidget::button-release-event

The ::button-release-event signal will be emitted when a button (typically from a mouse) is released.

GtkWidget::can-activate-accel

Determines whether an accelerator that activates the signal identified by signal_id can currently be activated. This signal is present to allow applications and derived widgets to override the default GtkWidget handling for determining whether an accelerator can be activated.

GtkWidget::child-notify

The ::child-notify signal is emitted for each [child property][child-properties] that has changed on an object. The signal’s detail holds the property name.

GtkWidget::composited-changed

The ::composited-changed signal is emitted when the composited status of widgets screen changes. See gdk_screen_is_composited().

deprecated: 3.22 

GtkWidget::configure-event

The ::configure-event signal will be emitted when the size, position or stacking of the widgets window has changed.

GtkWidget::damage-event

Emitted when a redirected window belonging to widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into.

since: 2.14

GtkWidget::delete-event

The ::delete-event signal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting gtk_widget_hide_on_delete() to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it.

GtkWidget::destroy

Signals that all holders of a reference to the widget should release the reference that they hold. May result in finalization of the widget if all references are released.

GtkWidget::destroy-event

The ::destroy-event signal is emitted when a GdkWindow is destroyed. You rarely get this signal, because most widgets disconnect themselves from their window before they destroy it, so no widget owns the window at destroy time.

GtkWidget::direction-changed

The ::direction-changed signal is emitted when the text direction of a widget changes.

GtkWidget::drag-begin

The ::drag-begin signal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with e.g. gtk_drag_source_set_icon_pixbuf().

GtkWidget::drag-data-delete

The ::drag-data-delete signal is emitted on the drag source when a drag with the action GDK_ACTION_MOVE is successfully completed. The signal handler is responsible for deleting the data that has been dropped. What “delete” means depends on the context of the drag operation.

GtkWidget::drag-data-get

The ::drag-data-get signal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill data with the data in the format which is indicated by info. See gtk_selection_data_set() and gtk_selection_data_set_text().

GtkWidget::drag-data-received

The ::drag-data-received signal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call gdk_drag_status() and not finish the drag. If the data was received in response to a GtkWidget::drag-drop signal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call gtk_drag_finish(), setting the success parameter depending on whether the data was processed successfully.

GtkWidget::drag-drop

The ::drag-drop signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns FALSE and no further processing is necessary. Otherwise, the handler returns TRUE. In this case, the handler must ensure that gtk_drag_finish() is called to let the source know that the drop is done. The call to gtk_drag_finish() can be done either directly or in a GtkWidget::drag-data-received handler which gets triggered by calling gtk_drag_get_data() to receive the data for one or more of the supported targets.

GtkWidget::drag-end

The ::drag-end signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in GtkWidget::drag-begin.

GtkWidget::drag-failed

The ::drag-failed signal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DnD operation based on the type of error, it returns TRUE is the failure has been already handled (not showing the default “drag operation failed” animation), otherwise it returns FALSE.

since: 2.12

GtkWidget::drag-leave

The ::drag-leave signal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in GtkWidget::drag-motion, e.g. undo highlighting with gtk_drag_unhighlight().

GtkWidget::drag-motion

The ::drag-motion signal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns FALSE and no further processing is necessary. Otherwise, the handler returns TRUE. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling gdk_drag_status().

GtkWidget::draw

This signal is emitted when a widget is supposed to render itself. The widgets top left corner must be painted at the origin of the passed in context and be sized to the values returned by gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height().

since: 3.0

GtkWidget::enter-notify-event

The ::enter-notify-event will be emitted when the pointer enters the widgets window.

GtkWidget::event

The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic ::event signal, another, more specific, signal that matches the type of event delivered (e.g. GtkWidget::key-press-event) and finally a generic GtkWidget::event-after signal.

GtkWidget::event-after

After the emission of the GtkWidget::event signal and (optionally) the second more specific signal, ::event-after will be emitted regardless of the previous two signals handlers return values.

GtkWidget::focus
No description available.

GtkWidget::focus-in-event

The ::focus-in-event signal will be emitted when the keyboard focus enters the widgets window.

GtkWidget::focus-out-event

The ::focus-out-event signal will be emitted when the keyboard focus leaves the widgets window.

GtkWidget::grab-broken-event

Emitted when a pointer or keyboard grab on a window belonging to widget gets broken.

since: 2.8

GtkWidget::grab-focus
No description available.

GtkWidget::grab-notify

The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.

GtkWidget::hide

The ::hide signal is emitted when widget is hidden, for example with gtk_widget_hide().

GtkWidget::hierarchy-changed

The ::hierarchy-changed signal is emitted when the anchored state of a widget changes. A widget is “anchored” when its toplevel ancestor is a GtkWindow. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.

GtkWidget::key-press-event

The ::key-press-event signal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed.

GtkWidget::key-release-event

The ::key-release-event signal is emitted when a key is released.

GtkWidget::keynav-failed

Gets emitted if keyboard navigation fails. See gtk_widget_keynav_failed() for details.

since: 2.12

GtkWidget::leave-notify-event

The ::leave-notify-event will be emitted when the pointer leaves the widgets window.

GtkWidget::map

The ::map signal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled with gtk_widget_set_visible()) and all its parents up to the toplevel widget are also visible. Once the map has occurred, GtkWidget::map-event will be emitted.

GtkWidget::map-event

The ::map-event signal will be emitted when the widgets window is mapped. A window is mapped when it becomes visible on the screen.

GtkWidget::mnemonic-activate

The default handler for this signal activates widget if group_cycling is FALSE, or just makes widget grab focus if group_cycling is TRUE.

GtkWidget::motion-notify-event

The ::motion-notify-event signal is emitted when the pointer moves over the widget’s GdkWindow.

GtkWidget::move-focus
No description available.

GtkWidget::parent-set

The ::parent-set signal is emitted when a new parent has been set on a widget.

GtkWidget::popup-menu

This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the GtkEntry widget creates a menu with clipboard commands. See the [Popup Menu Migration Checklist][checklist-popup-menu] for an example of how to use this signal.

GtkWidget::property-notify-event

The ::property-notify-event signal will be emitted when a property on the widgets window has been changed or deleted.

GtkWidget::proximity-in-event

To receive this signal the GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_IN_MASK mask.

GtkWidget::proximity-out-event

To receive this signal the GdkWindow associated to the widget needs to enable the #GDK_PROXIMITY_OUT_MASK mask.

GtkWidget::query-tooltip

Emitted when GtkWidget:has-tooltip is TRUE and the hover timeout has expired with the cursor hovering “above” widget; or emitted when widget got focus in keyboard mode.

since: 2.12

GtkWidget::realize

The ::realize signal is emitted when widget is associated with a GdkWindow, which means that gtk_widget_realize() has been called or the widget has been mapped (that is, it is going to be drawn).

GtkWidget::screen-changed

The ::screen-changed signal gets emitted when the screen of a widget has changed.

GtkWidget::scroll-event

The ::scroll-event signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.

GtkWidget::selection-clear-event

The ::selection-clear-event signal will be emitted when the the widgets window has lost ownership of a selection.

GtkWidget::selection-get
No description available.

GtkWidget::selection-notify-event
No description available.

GtkWidget::selection-received
No description available.

GtkWidget::selection-request-event

The ::selection-request-event signal will be emitted when another client requests ownership of the selection owned by the widgets window.

GtkWidget::show

The ::show signal is emitted when widget is shown, for example with gtk_widget_show().

GtkWidget::show-help
No description available.

GtkWidget::size-allocate
No description available.

GtkWidget::state-changed

The ::state-changed signal is emitted when the widget state changes. See gtk_widget_get_state().

deprecated: 3.0 

GtkWidget::state-flags-changed

The ::state-flags-changed signal is emitted when the widget state changes, see gtk_widget_get_state_flags().

since: 3.0

GtkWidget::style-set

The ::style-set signal is emitted when a new style has been set on a widget. Note that style-modifying functions like gtk_widget_modify_base() also cause this signal to be emitted.

deprecated: 3.0 

GtkWidget::style-updated

The ::style-updated signal is a convenience signal that is emitted when the GtkStyleContext::changed signal is emitted on the widgets associated GtkStyleContext as returned by gtk_widget_get_style_context().

since: 3.0

GtkWidget::touch-event
No description available.

GtkWidget::unmap

The ::unmap signal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden.

GtkWidget::unmap-event

The ::unmap-event signal will be emitted when the widgets window is unmapped. A window is unmapped when it becomes invisible on the screen.

GtkWidget::unrealize

The ::unrealize signal is emitted when the GdkWindow associated with widget is destroyed, which means that gtk_widget_unrealize() has been called or the widget has been unmapped (that is, it is going to be hidden).

GtkWidget::visibility-notify-event

The ::visibility-notify-event will be emitted when the widgets window is obscured or unobscured.

deprecated: 3.12 

GtkWidget::window-state-event

The ::window-state-event will be emitted when the state of the toplevel window associated to the widget changes.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkWindowClass {
  GtkBinClass parent_class;
  void (* set_focus) (
    GtkWindow* window,
    GtkWidget* focus
  );
  void (* activate_focus) (
    GtkWindow* window
  );
  void (* activate_default) (
    GtkWindow* window
  );
  void (* keys_changed) (
    GtkWindow* window
  );
  gboolean (* enable_debugging) (
    GtkWindow* window,
    gboolean toggle
  );
  void (* _gtk_reserved1) (
void
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  
}

No description available.

Class members
parent_class: GtkBinClass

The parent class.

set_focus: void (* set_focus) ( GtkWindow* window, GtkWidget* focus )

No description available.

activate_focus: void (* activate_focus) ( GtkWindow* window )

No description available.

activate_default: void (* activate_default) ( GtkWindow* window )

No description available.

keys_changed: void (* keys_changed) ( GtkWindow* window )

No description available.

enable_debugging: gboolean (* enable_debugging) ( GtkWindow* window, gboolean toggle )

No description available.

_gtk_reserved1: void (* _gtk_reserved1) ( void )

No description available.

_gtk_reserved2: void (* _gtk_reserved2) ( void )

No description available.

_gtk_reserved3: void (* _gtk_reserved3) ( void )

No description available.

Virtual methods

Gtk.WindowClass.activate_default
No description available.

Gtk.WindowClass.activate_focus
No description available.

Gtk.WindowClass.enable_debugging
No description available.

Gtk.WindowClass.keys_changed
No description available.

Gtk.WindowClass.set_focus

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. 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 function.