Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ApplicationWindowMeta

[412:14] static extends: object

Generated metadata helpers for ApplicationWindow class surfaces.

Methods

  • properties ()

    Returns property metadata for ApplicationWindow.

    • @r A list.
  • signals ()

    Returns signal metadata for ApplicationWindow.

    • @r A list.

class: ApplicationWindow

[47:7] extends: object

A GtkWindow subclass that integrates with GtkApplication. Notably, GtkApplicationWindow can handle an application menubar. This class implements the [iface@Gio.ActionGroup] and [iface@Gio.ActionMap] interfaces, to let you add window-specific actions that will be exported by the associated [class@Gtk.Application], together with its application-wide actions. Window-specific actions are prefixed with the “win.” prefix and application-wide actions are prefixed with the “app.” prefix. Actions must be addressed with the prefixed name when referring to them from a menu model. Note that widgets that are placed inside a GtkApplicationWindow can also activate these actions, if they implement the [iface@Gtk.Actionable] interface. The settings [property@Gtk.Settings:gtk-shell-shows-app-menu] and [property@Gtk.Settings:gtk-shell-shows-menubar] tell GTK whether the desktop environment is showing the application menu and menubar models outside the application as part of the desktop shell. For instance, on OS X, both menus will be displayed remotely; on Windows neither will be. If the desktop environment does not display the menubar, it can be shown in the GtkApplicationWindow by setting the [property@Gtk.ApplicationWindow:show-menubar] property to true. If the desktop environment does not display the application menu, then it will automatically be included in the menubar or in the window’s client-side decorations. See [class@Gtk.PopoverMenu] for information about the XML language used by GtkBuilder for menu models. See also: [method@Gtk.Application.set_menubar]. ## A GtkApplicationWindow with a menubar The code sample below shows how to set up a GtkApplicationWindow with a menu bar defined on the [class@Gtk.Application]: c GtkApplication *app = gtk_application_new ("org.gtk.test", 0); GtkBuilder *builder = gtk_builder_new_from_string ( "<interface>" " <menu id='menubar'>" " <submenu>" " <attribute name='label' translatable='yes'>_Edit</attribute>" " <item>" " <attribute name='label' translatable='yes'>_Copy</attribute>" " <attribute name='action'>win.copy</attribute>" " </item>" " <item>" " <attribute name='label' translatable='yes'>_Paste</attribute>" " <attribute name='action'>win.paste</attribute>" " </item>" " </submenu>" " </menu>" "</interface>", -1); GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")); gtk_application_set_menubar (GTK_APPLICATION (app), menubar); g_object_unref (builder); // ... GtkWidget *window = gtk_application_window_new (app);

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • ApplicationWindow (application = null)

    Creates a new GtkApplicationWindow.

    • @p application is an application.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWindow ()

    Wraps this handle as Window.

    • @r A Window object.
  • asActionGroup ()

    Wraps this handle as ActionGroup.

    • @r A ActionGroup object.
  • asActionMap ()

    Wraps this handle as ActionMap.

    • @r A ActionMap object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • asNative ()

    Wraps this handle as Native.

    • @r A Native object.
  • asRoot ()

    Wraps this handle as Root.

    • @r A Root object.
  • asShortcutManager ()

    Wraps this handle as ShortcutManager.

    • @r A ShortcutManager object.
  • connectSignal (string Name, CallbackObj)

    Connects one generated callback wrapper to a named signal.

    • @p Name is the signal name.
    • @p CallbackObj is the generated callback wrapper to connect.
    • @r The connected handler id.
  • disconnectSignalHandler (int HandlerId)

    Disconnects one retained signal handler id.

    • @p HandlerId is the signal handler id to disconnect.
    • @r None.
  • setOnSavestate (callback Fn, UserData = null)

    The handler for this signal should persist any application-specific state of @window into @dict. Note that window management state such as maximized, fullscreen, or window size should not be saved as part of this, they are handled by GTK. You must be careful to be robust in the face of app upgrades and downgrades: the @state might have been created by a previous or occasionally even a future version of your app. Do not assume that a given key exists in the state. Apps must try to restore state saved by a previous version, but are free to discard state if it was written by a future version. See [signal@Gtk.Application::restore-window].

    • @p Fn is the Aussom callback.
    • @p Fn is called with (ApplicationWindow Self, VariantDict Dict).
    • @p UserData is retained and passed through to the generated callback wrapper when provided.
    • @r The connected handler id.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setShowmenubar (bool Value)

    If this property is true, the window will display a menubar unless it is shown by the desktop shell. See [method@Gtk.Application.set_menubar]. If false, the window will not display a menubar, regardless of whether the desktop shell is showing it or not.

    • @p Value is the new property value.
    • @r None.
  • get_help_overlay ()

    Gets the GtkShortcutsWindow that is associated with @window. See [method@Gtk.ApplicationWindow.set_help_overlay].

  • get_id ()

    Returns the unique ID of the window. If the window has not yet been added to a GtkApplication, returns 0.

  • get_show_menubar ()

    Returns whether the window will display a menubar for the app menu and menubar as needed.

  • set_help_overlay (object help_overlay)

    Associates a shortcuts window with the application window. Additionally, sets up an action with the name win.show-help-overlay to present it. The window takes responsibility for destroying the help overlay.

    • @p help_overlay is a shortcuts window.
    • @r None.
  • set_show_menubar (bool show_menubar)

    Sets whether the window will display a menubar for the app menu and menubar as needed.

    • @p show_menubar is whether to show a menubar when needed.
    • @r None.

class: ApplicationWindowSavestateCallback

[341:7] extends: object

Generated low-level callback wrapper for GIR callback save-state.

Members

  • callbackObj
  • userFn
  • userData
  • hasUserData

Methods

  • ApplicationWindowSavestateCallback (callback Fn, UserData = null)

    Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.

    • @p Fn is the Aussom callback implementation.
    • @p UserData is retained and passed through to Fn on each invocation when provided.
  • trampoline (nativeSelf, dict, nativeUserData)

    Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.

  • callback ()

    Returns the wrapped NativeCallback.

  • handle ()

    Returns the callback as a NativeHandle.

  • close ()

    Closes the underlying NativeCallback.

  • isClosed ()

    Returns true when the callback has been closed.