Libraries:Gtk:Gtk:Window
Types
T
Inherits from: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 AddAccelGroup.
Example 10. A UI definition fragment with accel groups
1 2 3 4 5 6 7 |
<object class="GtkWindow"> <accel-groups> <group name="accelgroup1"/> </accel-groups> </object> ... <object class="GtkAccelGroup" id="accelgroup1"/> |
Constants
Nil : T
Functions
GetDefaultIconList() : Std.Object.T
Gets the value set by SetDefaultIconList. 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.
Returns | copy of default icon list. [element-type GdkPixbuf][transfer container] |
GetDefaultIconName() : Std.String.T
Returns the fallback icon name for windows that has been set with SetDefaultIconName. The returned string is owned by GTK+ and should not be modified. It is only valid until the next call to SetDefaultIconName.
Returns | the fallback icon name for windows |
GetType() : Gtk.GObject.Type.T
ListToplevels() : Std.Object.T
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.
Returns | list of toplevel widgets. [element-type GtkWidget][transfer container] |
New(type @ Gtk.Gtk.WindowType.T) : Gtk.Gtk.Window.T
Creates a new T, which is a toplevel window that can contain other widgets. Nearly always, the type of the window should be Gtk.Gtk.WindowType.Toplevel. If you're implementing something like a popup menu from scratch (which is a bad idea, just use Gtk.Gtk.Menu.T), you might use Gtk.Gtk.WindowType.Popup. Gtk.Gtk.WindowType.Popup is not for dialogs, though in some other toolkits dialogs are called "popups". In GTK+, Gtk.Gtk.WindowType.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 SetDecorated, don't use Gtk.Gtk.WindowType.Popup.
type | type of window |
Returns | a new T. |
SetAutoStartupNotification(setting @ Std.Symbol.T) : Std.Object.T
By default, after showing the first T, GTK+ calls Gtk.Gdk.Notify.StartupComplete. 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.
setting | TRUE to automatically do startup notification |
SetDefaultIcon(icon @ Gtk.Gdk.Pixbuf.T) : Std.Object.T
Sets an icon to be used as fallback for windows that haven't had SetIcon called on them from a pixbuf.
icon | the icon |
SetDefaultIconFromFile(filename @ Std.String.T, err @ Std.Object.T) : Std.Symbol.T
SetDefaultIconList(list @ Std.Object.T) : Std.Object.T
Sets an icon list to be used as fallback for windows that haven't had SetIconList 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.
See SetIconList for more details.
list | a list of Gtk.Gdk.Pixbuf.T. [element-type GdkPixbuf][transfer container] |
SetDefaultIconName(name @ Std.String.T) : Std.Object.T
Sets an icon to be used as fallback for windows that haven't had SetIconList called on them from a named themed icon, see SetIconName.
name | the name of the themed icon |
Methods
:ActivateDefault(self @ T) : Std.Symbol.T
Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see Gtk.Gtk.Widget.SetReceivesDefault), in which case the focused widget is activated.
window | a T |
Returns | TRUE if a widget got activated. |
:ActivateFocus(self @ T) : Std.Symbol.T
Activates the current focused widget within the window.
window | a T |
Returns | TRUE if a widget got activated. |
:ActivateKey(self @ T, event @ Gtk.Gdk.EventKey.T) : Std.Symbol.T
Activates mnemonics and accelerators for this T. 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.
window | a T |
event | a Gtk.Gdk.EventKey.T |
Returns | TRUE if a mnemonic or accelerator was found and activated. |
:AddAccelGroup(self @ T, accel_group @ Gtk.Gtk.AccelGroup.T) : Std.Object.T
Associate accel_group with window, such that calling Gtk.Gtk.Accel.GroupsActivate on window will activate accelerators in accel_group.
window | window to attach accelerator group to |
accel_group | a Gtk.Gtk.AccelGroup.T |
:AddEmbeddedXid(self @ T, xid @ Std.Integer.SmallT) : Std.Object.T
:AddMnemonic(self @ T, keyval @ Std.Integer.SmallT, target @ Gtk.Gtk.Widget.T) : Std.Object.T
Adds a mnemonic to this window.
window | a T |
keyval | the mnemonic |
target | the widget that gets activated by the mnemonic |
:BeginMoveDrag(self @ T, button @ Std.Integer.SmallT, root_x @ Std.Integer.SmallT, root_y @ Std.Integer.SmallT, timestamp @ Std.Integer.SmallT) : Std.Object.T
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 or windowing system. Otherwise, GDK will try to emulate window movement, potentially not all that well, depending on the windowing system.
window | a T |
button | mouse button that initiated the drag |
root_x | X position where the user clicked to initiate the drag, in root window coordinates |
root_y | Y position where the user clicked to initiate the drag |
timestamp | timestamp from the click event that initiated the drag |
:BeginResizeDrag(self @ T, edge @ Gtk.Gdk.WindowEdge.T, button @ Std.Integer.SmallT, root_x @ Std.Integer.SmallT, root_y @ Std.Integer.SmallT, timestamp @ Std.Integer.SmallT) : Std.Object.T
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 or windowing system. Otherwise, GDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.
window | a T |
edge | position of the resize control |
button | mouse button that initiated the drag |
root_x | X position where the user clicked to initiate the drag, in root window coordinates |
root_y | Y position where the user clicked to initiate the drag |
timestamp | timestamp from the click event that initiated the drag |
:Deiconify(self @ T) : Std.Object.T
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) could iconify it again before your code which assumes deiconification gets to run.
You can track iconification via the "window-state-event" signal on Gtk.Gtk.Widget.T.
window | a T |
:Fullscreen(self @ T) : Std.Object.T
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) 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 "window-state-event" signal on Gtk.Gtk.Widget.T.
window | a T |
:GetAcceptFocus(self @ T) : Std.Symbol.T
Gets the value set by SetAcceptFocus.
window | a T |
Returns | TRUE if window should receive the input focus |
:GetDecorated(self @ T) : Std.Symbol.T
Returns whether the window has been set to have decorations such as a title bar via SetDecorated.
window | a T |
Returns | TRUE if the window has been set to have decorations |
:GetDefaultSize(self @ T, width @ Std.Object.T, height @ Std.Object.T) : Std.Object.T
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.
window | a T |
width | location to store the default width, or NULL. [allow-none] |
height | location to store the default height, or NULL. [allow-none] |
:GetDefaultWidget(self @ T) : Gtk.Gtk.Widget.T
:GetDeletable(self @ T) : Std.Symbol.T
Returns whether the window has been set to have a close button via SetDeletable.
window | a T |
Returns | TRUE if the window has been set to have a close button |
:GetDestroyWithParent(self @ T) : Std.Symbol.T
Returns whether the window will be destroyed with its transient parent. See SetDestroyWithParent.
window | a T |
Returns | TRUE if the window will be destroyed with its transient parent. |
:GetFocus(self @ T) : Gtk.Gtk.Widget.T
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.
:GetFocusOnMap(self @ T) : Std.Symbol.T
Gets the value set by SetFocusOnMap.
window | a T |
Returns | TRUE if window should receive the input focus when mapped. |
:GetFrameDimensions(self @ T, left @ Std.Object.T, top @ Std.Object.T, right @ Std.Object.T, bottom @ Std.Object.T) : Std.Object.T
Warning
GetFrameDimensions has been deprecated since version 2.24 and should not be used in newly-written code. This function will be removed in GTK+ 3
:GetGravity(self @ T) : Gtk.Gdk.Gravity.T
:GetGroup(self @ T) : Gtk.Gtk.WindowGroup.T
Returns the group for window or the default group, if window is NULL or if window does not have an explicit window group.
window | a T, or NULL. [allow-none] |
Returns | the Gtk.Gtk.WindowGroup.T for a window or the default group. [transfer none] |
:GetHasFrame(self @ T) : Std.Symbol.T
Warning
GetHasFrame has been deprecated since version 2.24 and should not be used in newly-written code. This function will be removed in GTK+ 3
:GetIcon(self @ T) : Gtk.Gdk.Pixbuf.T
Gets the value set by SetIcon (or if you've called SetIconList, gets the first icon in the icon list).
window | a T |
Returns | icon for window. [transfer none] |
:GetIconList(self @ T) : Std.Object.T
Retrieves the list of icons set by SetIconList. The list is copied, but the reference count on each member won't be incremented.
window | a T |
Returns | copy of window's icon list. [element-type GdkPixbuf][transfer container] |
:GetIconName(self @ T) : Std.String.T
:GetMnemonicModifier(self @ T) : Std.Integer.SmallT
Returns the mnemonic modifier for this window. See SetMnemonicModifier.
window | a T |
Returns | the modifier mask used to activate mnemonics on this window. |
:GetMnemonicsVisible(self @ T) : Std.Symbol.T
:GetModal(self @ T) : Std.Symbol.T
Returns whether the window is modal. See SetModal.
window | a T |
Returns | TRUE if the window is set to be modal and establishes a grab when shown |
:GetOpacity(self @ T) : Std.Real.T
Fetches the requested opacity for this window. See SetOpacity.
window | a T |
Returns | the requested opacity for this window. |
:GetPosition(self @ T, root_x @ Std.Object.T, root_y @ Std.Object.T) : Std.Object.T
This function returns the position you need to pass to Move to keep window in its current position. This means that the meaning of the returned value varies with window gravity. See Move for more details.
If you haven't changed the window gravity, its gravity will be Gtk.Gdk.Gravity.NorthWest. This means that GetPosition 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.
GetPosition 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 GetPosition tends to result in moving the window slightly. Window managers are slowly getting better over time.
If a window has gravity Gtk.Gdk.Gravity.Static the window manager frame is not relevant, and thus GetPosition 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.
window | a T |
root_x | return location for X coordinate of gravity-determined reference point. [out][allow-none] |
root_y | return location for Y coordinate of gravity-determined reference point. [out][allow-none] |
:GetResizable(self @ T) : Std.Symbol.T
:GetRole(self @ T) : Std.String.T
Returns the role of the window. See SetRole for further explanation.
window | a T |
Returns | the role of the window if set, or NULL. The returned is owned by the widget and must not be modified or freed. |
:GetScreen(self @ T) : Gtk.Gdk.Screen.T
Returns the Gtk.Gdk.Screen.T associated with window.
window | a T. |
Returns | a Gtk.Gdk.Screen.T. [transfer none] |
:GetSize(self @ T, width @ Std.Object.T, height @ Std.Object.T) : Std.Object.T
Obtains the current size of window. If 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 GetSize is the last size received in a Gtk.Gdk.EventConfigure.T, 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 GetSize, 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 Gtk.Gdk.EventConfigure.T.
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 SetTypeHint, which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with SetTransientFor 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 apps will behave consistently and according to user prefs 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 - SetPosition will frequently handle the details for you.
window | a T |
width | return location for width, or NULL. [out][allow-none] |
height | return location for height, or NULL. [out][allow-none] |
:GetSkipPagerHint(self @ T) : Std.Symbol.T
:GetSkipTaskbarHint(self @ T) : Std.Symbol.T
:GetTitle(self @ T) : Std.String.T
Retrieves the title of the window. See SetTitle.
window | a T |
Returns | the title of the window, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. |
:GetTransientFor(self @ T) : Gtk.Gtk.Window.T
Fetches the transient parent for this window. See SetTransientFor.
window | a T |
Returns | the transient parent for this window, or NULL if no transient parent has been set. [transfer none] |
:GetTypeHint(self @ T) : Gtk.Gdk.WindowTypeHint.T
:GetUrgencyHint(self @ T) : Std.Symbol.T
:GetWindowType(self @ T) : Gtk.Gtk.WindowType.T
:HasGroup(self @ T) : Std.Symbol.T
Returns whether window has an explicit window group.
window | a T |
Returns | TRUE if window has an explicit window group. Since 2.22 |
:HasToplevelFocus(self @ T) : Std.Symbol.T
Returns whether the input focus is within this GtkWindow. For real toplevel windows, this is identical to IsActive, but for embedded windows, like Gtk.Gtk.Plug.T, the results will differ.
window | a T |
Returns | TRUE if the input focus is within this GtkWindow |
:Iconify(self @ T) : Std.Object.T
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) 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 function 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 Gtk.Gtk.Widget.T.
window | a T |
:IsActive(self @ T) : Std.Symbol.T
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 Gtk.Gtk.Plug.T 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 HasToplevelFocus
window | a T |
Returns | TRUE if the window part of the current active window. |
:Maximize(self @ T) : Std.Object.T
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 function 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 Gtk.Gtk.Widget.T.
window | a T |
:MnemonicActivate(self @ T, keyval @ Std.Integer.SmallT, modifier @ Std.Integer.SmallT) : Std.Symbol.T
Activates the targets associated with the mnemonic.
window | a T |
keyval | the mnemonic |
modifier | the modifiers |
Returns | TRUE if the activation is done. |
:Move(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT) : Std.Object.T
Asks the window manager 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.
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 Gtk.Gdk.Gravity.NorthWest, 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 Gtk.Gdk.Gravity.NorthWest) and move the window to 0,0.
To position a window at the bottom right corner of the screen, you would set Gtk.Gdk.Gravity.SouthEast, 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: gtk_window_move (window, gdk_screen_width() - window_width, gdk_screen_height() - window_height) (note that this example does not take multi-head scenarios into account).
The Extended Window Manager Hints specification at http://www.freedesktop.org/Standards/wm-spec has a nice table of gravities in the "implementation notes" section.
The GetPosition documentation may also be relevant.
window | a T |
x | X coordinate to move window to |
y | Y coordinate to move window to |
:ParseGeometry(self @ T, geometry @ Std.String.T) : Std.Symbol.T
Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this. ParseGeometry 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, ParseGeometry returns TRUE and calls SetDefaultSize and/or Move to resize/move the window.
If ParseGeometry returns TRUE, it will also set the Gtk.Gdk.WindowHints.UserPos and/or Gtk.Gdk.WindowHints.UserSize 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.
Note that for ParseGeometry to work as expected, it has to be called when the window has its "final" size, i.e. after calling Gtk.Gtk.Widget.ShowAll on the contents and SetGeometryHints on the window.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#include <gtk/gtk.h> static void fill_with_content (GtkWidget *vbox) { /* fill with content... */ } int main (int argc, char *argv[]) { GtkWidget *window, *vbox; GdkGeometry size_hints = { 100, 50, 0, 0, 100, 50, 10, 10, 0.0, 0.0, GDK_GRAVITY_NORTH_WEST }; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); fill_with_content (vbox); gtk_widget_show_all (vbox); gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &size_hints, GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC); if (argc > 1) { if (!gtk_window_parse_geometry (GTK_WINDOW (window), argv[1])) fprintf (stderr, "Failed to parse '%s'\n", argv[1]); } gtk_widget_show_all (window); gtk_main (); return 0; } |
:Present(self @ T) : Std.Object.T
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 window is hidden, this function calls Gtk.Gtk.Widget.Show as well.
This function 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.
If you are calling this function in response to a user interaction, it is preferable to use PresentWithTime.
window | a T |
:PresentWithTime(self @ T, timestamp @ Std.Integer.SmallT) : Std.Object.T
Presents a window to the user in response to a user interaction. If you need to present a window without a timestamp, use Present. See Present for details.
window | a T |
timestamp | the timestamp of the user interaction (typically a button or key press event) which triggered this call |
:PropagateKeyEvent(self @ T, event @ Gtk.Gdk.EventKey.T) : Std.Symbol.T
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.
window | a T |
event | a Gtk.Gdk.EventKey.T |
Returns | TRUE if a widget in the focus chain handled the event. |
:RemoveAccelGroup(self @ T, accel_group @ Gtk.Gtk.AccelGroup.T) : Std.Object.T
:RemoveEmbeddedXid(self @ T, xid @ Std.Integer.SmallT) : Std.Object.T
:RemoveMnemonic(self @ T, keyval @ Std.Integer.SmallT, target @ Gtk.Gtk.Widget.T) : Std.Object.T
Removes a mnemonic from this window.
window | a T |
keyval | the mnemonic |
target | the widget that gets activated by the mnemonic |
:ReshowWithInitialSize(self @ T) : Std.Object.T
Hides window, then reshows it, resetting the default size and position of the window. Used by GUI builders only.
window | a T |
:Resize(self @ T, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T
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.Gtk.Widget.SetSizeRequest 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 SetDefaultSize.
Windows may not be resized smaller than 1 by 1 pixels.
window | a T |
width | width in pixels to resize the window to |
height | height in pixels to resize the window to |
:SetAcceptFocus(self @ T, setting @ Std.Symbol.T) : Std.Object.T
Windows may set a hint asking the desktop environment not to receive the input focus. This function sets this hint.
window | a T |
setting | TRUE to let this window receive input focus |
:SetDecorated(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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_window_show().
On Windows, this function always works, since there's no window manager policy involved.
window | a T |
setting | TRUE to decorate the window |
:SetDefault(self @ T, default_widget @ Gtk.Gtk.Widget.T) : Std.Object.T
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 T about. When setting (rather than unsetting) the default widget it's generally easier to call Gtk.Gtk.Widget.GrabFocus on the widget. Before making a widget the default widget, you must set the Gtk.Gtk.WidgetFlags.CanDefault flag on the widget you'd like to make the default using GTK_WIDGET_SET_FLAGS().
window | a T |
default_widget | widget to be the default, or NULL to unset the default widget for the toplevel. [allow-none] |
:SetDefaultSize(self @ T, width @ Std.Integer.SmallT, height @ Std.Integer.SmallT) : Std.Object.T
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 (SetGeometryHints can be used to set these explicitly), the default size will be clamped to the nearest permitted size.
Unlike Gtk.Gtk.Widget.SetSizeRequest, which sets a size request for a widget and thus would keep users from shrinking the window, this function 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 SetGeometryHints.
For some uses, Resize is a more appropriate function. 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.
window | a T |
width | width in pixels, or -1 to unset the default width |
height | height in pixels, or -1 to unset the default height |
:SetDeletable(self @ T, setting @ Std.Symbol.T) : Std.Object.T
By default, windows have a close button in the window frame. Some window managers 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_window_show().
On Windows, this function always works, since there's no window manager policy involved.
window | a T |
setting | TRUE to decorate the window as deletable |
:SetDestroyWithParent(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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.
window | a T |
setting | whether to destroy window with its transient parent |
:SetFocus(self @ T, focus @ Gtk.Gtk.Widget.T) : Std.Object.T
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.Gtk.Widget.GrabFocus instead of this function.
window | a T |
focus | widget to be the new focus widget, or NULL to unset any focus widget for the toplevel window. [allow-none] |
:SetFocusOnMap(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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.
window | a T |
setting | TRUE to let this window receive input focus on map |
:SetFrameDimensions(self @ T, left @ Std.Integer.SmallT, top @ Std.Integer.SmallT, right @ Std.Integer.SmallT, bottom @ Std.Integer.SmallT) : Std.Object.T
Warning
SetFrameDimensions has been deprecated since version 2.24 and should not be used in newly-written code. This function will be removed in GTK+ 3
:SetGeometryHints(self @ T, geometry_widget @ Gtk.Gtk.Widget.T, geometry @ Gtk.Gdk.Geometry.T, geom_mask @ Std.Integer.SmallT) : Std.Object.T
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 Gtk.Gdk.Geometry.T struct.
window | a T |
geometry_widget | widget the geometry hints will be applied to |
geometry | struct containing geometry information |
geom_mask | mask indicating which struct fields should be paid attention to |
:SetGravity(self @ T, gravity @ Gtk.Gdk.Gravity.T) : Std.Object.T
Window gravity defines the meaning of coordinates passed to Move. See Move and Gtk.Gdk.Gravity.T for more details.
The default window gravity is Gtk.Gdk.Gravity.NorthWest which will typically "do what you mean."
window | a T |
gravity | window gravity |
:SetHasFrame(self @ T, setting @ Std.Symbol.T) : Std.Object.T
Warning
SetHasFrame has been deprecated since version 2.24 and should not be used in newly-written code. This function will be removed in GTK+ 3
:SetIcon(self @ T, icon @ Gtk.Gdk.Pixbuf.T) : Std.Object.T
Sets up the icon representing a T. 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 SetIconList. Then the best size will be used.
This function is equivalent to calling SetIconList with a 1-element list.
See also SetDefaultIconList to set the icon for all windows in your application in one go.
:SetIconFromFile(self @ T, filename @ Std.String.T, err @ Std.Object.T) : Std.Symbol.T
:SetIconList(self @ T, list @ Std.Object.T) : Std.Object.T
Sets up the icon representing a T. 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.
SetIconList 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 SetDefaultIconList 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 SetTransientFor) will inherit their icon from their transient parent. So there's no need to explicitly set the icon on transient windows.
window | a T |
list | list of Gtk.Gdk.Pixbuf.T |
:SetIconName(self @ T, name @ Std.String.T) : Std.Object.T
Sets the icon for the window from a named themed icon. See the docs for Gtk.Gtk.IconTheme.T for more details.
Note that this has nothing to do with the WM_ICON_NAME property which is mentioned in the ICCCM.
window | a T |
name | the name of the themed icon. [allow-none] |
:SetKeepAbove(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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) 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.
It's permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially.
You can track the above state via the "window-state-event" signal on Gtk.Gtk.Widget.T.
Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
window | a T |
setting | whether to keep window above other windows |
:SetKeepBelow(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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) 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.
It's permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially.
You can track the below state via the "window-state-event" signal on Gtk.Gtk.Widget.T.
Note that, according to the Extended Window Manager Hints specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.
window | a T |
setting | whether to keep window below other windows |
:SetMnemonicModifier(self @ T, modifier @ Std.Integer.SmallT) : Std.Object.T
Sets the mnemonic modifier for this window.
window | a T |
modifier | the modifier mask used to activate mnemonics on this window. |
:SetMnemonicsVisible(self @ T, setting @ Std.Symbol.T) : Std.Object.T
:SetModal(self @ T, modal @ Std.Symbol.T) : Std.Object.T
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 SetTransientFor to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.
window | a T |
modal | whether the window is modal |
:SetOpacity(self @ T, opacity @ Std.Real.T) : Std.Object.T
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.Gtk.Widget.IsComposited. On Windows it should work always.
Note that setting a window's opacity after the window has been shown causes it to flicker once on Windows.
window | a T |
opacity | desired opacity, between 0 and 1 |
:SetPolicy(self @ T, allow_shrink @ Std.Integer.SmallT, allow_grow @ Std.Integer.SmallT, auto_shrink @ Std.Integer.SmallT) : Std.Object.T
Warning
SetPolicy is deprecated and should not be used in newly-written code. Use SetResizable instead.
:SetPosition(self @ T, position @ Gtk.Gtk.WindowPosition.T) : Std.Object.T
Sets a position constraint for this window. If the old or new constraint is Gtk.Gtk.WindowPosition.CenterAlways, this will also cause the window to be repositioned to satisfy the new constraint.
window | a T. |
position | a position constraint. |
:SetResizable(self @ T, resizable @ Std.Symbol.T) : Std.Object.T
Sets whether the user can resize a window. Windows are user resizable by default.
window | a T |
resizable | TRUE if the user can resize this window |
:SetRole(self @ T, role @ Std.String.T) : Std.Object.T
This function is only useful on X11, not with other GTK+ targets.
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 WM can use the title to identify the window when restoring the session.
window | a T |
role | unique identifier for the window to be used when restoring a session |
:SetScreen(self @ T, screen @ Gtk.Gdk.Screen.T) : Std.Object.T
Sets the Gtk.Gdk.Screen.T where the window is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.
window | a T. |
screen | a Gtk.Gdk.Screen.T. |
:SetSkipPagerHint(self @ T, setting @ Std.Symbol.T) : Std.Object.T
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.)
window | a T |
setting | TRUE to keep this window from appearing in the pager |
:SetSkipTaskbarHint(self @ T, setting @ Std.Symbol.T) : Std.Object.T
Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint.
window | a T |
setting | TRUE to keep this window from appearing in the task bar |
:SetStartupId(self @ T, startup_id @ Std.String.T) : Std.Object.T
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 Present or any equivalent function generating a window map event.
This function is only useful on X11, not with other GTK+ targets.
window | a T |
startup_id | a string with startup-notification identifier |
:SetTitle(self @ T, title @ Std.String.T) : Std.Object.T
Sets the title of the T. 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.
window | a T |
title | title of the window |
:SetTransientFor(self @ T, parent @ Gtk.Gtk.Window.T) : Std.Object.T
Dialog windows should be set transient for the main application window they were spawned from. This allows window managers 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 SetTransientFor on your behalf.
Passing NULL for parent unsets the current transient window.
On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X.
:SetTypeHint(self @ T, hint @ Gtk.Gdk.WindowTypeHint.T) : Std.Object.T
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.
This function should be called before the window becomes visible.
gtk_dialog_new_with_buttons() and other convenience functions in GTK+ will sometimes call SetTypeHint on your behalf.
window | a T |
hint | the window type |
:SetUrgencyHint(self @ T, setting @ Std.Symbol.T) : Std.Object.T
Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint.
window | a T |
setting | TRUE to mark this window as urgent |
:SetWmclass(self @ T, wmclass_name @ Std.String.T, wmclass_class @ Std.String.T) : Std.Object.T
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 SetRole 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.
window | a T |
wmclass_name | window name hint |
wmclass_class | window class hint |
:Stick(self @ T) : Std.Object.T
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) 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 function before showing a window.
You can track stickiness via the "window-state-event" signal on Gtk.Gtk.Widget.T.
window | a T |
:Unfullscreen(self @ T) : Std.Object.T
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) 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 "window-state-event" signal on Gtk.Gtk.Widget.T.
window | a T |
:Unmaximize(self @ T) : Std.Object.T
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 Gtk.Gtk.Widget.T.
window | a T |
:Unstick(self @ T) : Std.Object.T
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) 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 Gtk.Gtk.Widget.T.
window | a T |