Class WindowControls

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class WindowControls extends Widget implements Accessible, Buildable, ConstraintTarget

Shows window frame controls.

Typical window frame controls are minimize, maximize and close buttons, and the window icon.

An example GtkWindowControls

GtkWindowControls only displays start or end side of the controls (see Gtk.WindowControls:side), so it's intended to be always used in pair with another GtkWindowControls for the opposite side, for example:

<object class="GtkBox">
  <child>
    <object class="GtkWindowControls">
      <property name="side">start</property>
    </object>
  </child>

  ...

  <child>
    <object class="GtkWindowControls">
      <property name="side">end</property>
    </object>
  </child>
</object>

CSS nodes

windowcontrols
├── [image.icon]
├── [button.minimize]
├── [button.maximize]
╰── [button.close]

A GtkWindowControls' CSS node is called windowcontrols. It contains subnodes corresponding to each title button. Which of the title buttons exist and where they are placed exactly depends on the desktop environment and Gtk.WindowControls:decoration-layout value.

When Gtk.WindowControls:empty is true, it gets the .empty style class.

Accessibility

GtkWindowControls uses the Gtk.AccessibleRole.group role.

  • Constructor Details

    • WindowControls

      public WindowControls(MemorySegment address)
      Create a WindowControls instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • WindowControls

      public WindowControls(PackType side)
      Creates a new GtkWindowControls.
      Parameters:
      side - the side
    • WindowControls

      public WindowControls()
      Create a new WindowControls.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the WindowControls class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected WindowControls asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getDecorationLayout

      public @Nullable String getDecorationLayout()
      Gets the decoration layout of this window controls widget
      Returns:
      the decoration layout
    • getEmpty

      public boolean getEmpty()
      Gets whether the widget has any window buttons.
      Returns:
      true if the widget has window buttons
    • getSide

      public PackType getSide()
      Gets the side to which this window controls widget belongs.
      Returns:
      the side
    • getUseNativeControls

      public boolean getUseNativeControls()
      Returns whether platform native window controls are shown.
      Returns:
      true if native window controls are shown
      Since:
      4.18
    • setDecorationLayout

      public void setDecorationLayout(@Nullable String layout)

      Sets the decoration layout for the title buttons.

      This overrides the Gtk.Settings:gtk-decoration-layout setting.

      The format of the string is button names, separated by commas. A colon separates the buttons that should appear on the left from those on the right. Recognized button names are minimize, maximize, close and icon (the window icon).

      For example, “icon:minimize,maximize,close” specifies a icon on the left, and minimize, maximize and close buttons on the right.

      If Gtk.WindowControls:side value is Gtk.PackType.start, this WindowControls will display the part before the colon, otherwise after that.

      Parameters:
      layout - a decoration layout, or NULL to unset the layout
    • setSide

      public void setSide(PackType side)

      Determines which part of decoration layout the window controls widget uses.

      See Gtk.WindowControls:decoration-layout.

      Parameters:
      side - a side
    • setUseNativeControls

      public void setUseNativeControls(boolean setting)

      Sets whether platform native window controls are used.

      This option shows the "stoplight" buttons on macOS. For Linux, this option has no effect.

      See also Using GTK on Apple macOS.

      Parameters:
      setting - true to show native window controls
      Since:
      4.18
    • builder

      public static WindowControls.Builder<? extends WindowControls.Builder> builder()
      A WindowControls.Builder object constructs a WindowControls with the specified properties. Use the various set...() methods to set properties, and finish construction with WindowControls.Builder.build().
      Returns:
      the builder object