gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.WindowControls

Contents

- Exported types
- Methods
  - getDecorationLayout
  - getEmpty
  - getSide
  - getUseNativeControls
  - new
  - setDecorationLayout
  - setSide
  - setUseNativeControls
- Properties
  - decorationLayout
  - empty
  - side
  - useNativeControls

Description

Shows window frame controls.

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

<picture> <source srcset="windowcontrols-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkWindowControls" src="windowcontrols.png"> </picture>

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

### xml code

    <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 WindowControls:decorationLayout value.

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

# Accessibility

`GtkWindowControls` uses the `AccessibleRoleGroup` role.

Synopsis

- newtype WindowControls = WindowControls (ManagedPtr WindowControls)
- class (GObject o, IsDescendantOf WindowControls o) => IsWindowControls o
- toWindowControls :: (MonadIO m, IsWindowControls o) => o -> m WindowControls
- windowControlsGetDecorationLayout :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> m (Maybe Text)
- windowControlsGetEmpty :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> m Bool
- windowControlsGetSide :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> m PackType
- windowControlsGetUseNativeControls :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> m Bool
- windowControlsNew :: (HasCallStack, MonadIO m) => PackType -> m WindowControls
- windowControlsSetDecorationLayout :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> Maybe Text -> m ()
- windowControlsSetSide :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> PackType -> m ()
- windowControlsSetUseNativeControls :: (HasCallStack, MonadIO m, IsWindowControls a) => a -> Bool -> m ()
- clearWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> m ()
- constructWindowControlsDecorationLayout :: (IsWindowControls o, MonadIO m) => Text -> m (GValueConstruct o)
- getWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> m (Maybe Text)
- setWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> Text -> m ()
- getWindowControlsEmpty :: (MonadIO m, IsWindowControls o) => o -> m Bool
- constructWindowControlsSide :: (IsWindowControls o, MonadIO m) => PackType -> m (GValueConstruct o)
- getWindowControlsSide :: (MonadIO m, IsWindowControls o) => o -> m PackType
- setWindowControlsSide :: (MonadIO m, IsWindowControls o) => o -> PackType -> m ()
- constructWindowControlsUseNativeControls :: (IsWindowControls o, MonadIO m) => Bool -> m (GValueConstruct o)
- getWindowControlsUseNativeControls :: (MonadIO m, IsWindowControls o) => o -> m Bool
- setWindowControlsUseNativeControls :: (MonadIO m, IsWindowControls o) => o -> Bool -> m ()

# Exported types

newtype WindowControls Source #

Memory-managed wrapper type.

Constructors

WindowControls (ManagedPtr WindowControls) |

#### Instances

Instances details

Eq WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls Methods (==) :: WindowControls -> WindowControls -> Bool Source # (/=) :: WindowControls -> WindowControls -> Bool Source #
GObject WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls
ManagedPtrNewtype WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls Methods toManagedPtr :: WindowControls -> ManagedPtr WindowControls Source #
TypedObject WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls Methods glibType :: IO GType Source #
HasParentTypes WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls
IsGValue (Maybe WindowControls) Source # | Convert `WindowControls` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.WindowControls Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe WindowControls -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe WindowControls) Source #
type ParentTypes WindowControls Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls type ParentTypes WindowControls = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf WindowControls o) => IsWindowControls o Source #

Type class for types which can be safely cast to `WindowControls`, for instance with `toWindowControls`.

#### Instances

Instances details

(GObject o, IsDescendantOf WindowControls o) => IsWindowControls o Source # |
Instance details Defined in GI.Gtk.Objects.WindowControls

toWindowControls :: (MonadIO m, IsWindowControls o) => o -> m WindowControls Source #

Cast to `WindowControls`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDecorationLayout, getDirection, getDisplay, getEmpty, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSide, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getUseNativeControls, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDecorationLayout, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSide, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseNativeControls, setValign, setVexpand, setVexpandSet, setVisible.

## getDecorationLayout

windowControlsGetDecorationLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> m (Maybe Text) | Returns: the decoration layout

Gets the decoration layout of this window controls widget

## getEmpty

windowControlsGetEmpty Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> m Bool | Returns: true if the widget has window buttons

Gets whether the widget has any window buttons.

## getSide

windowControlsGetSide Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> m PackType | Returns: the side

Gets the side to which this window controls widget belongs.

## getUseNativeControls

windowControlsGetUseNativeControls Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> m Bool | Returns: true if native window controls are shown

Returns whether platform native window controls are shown.

Since: 4.18

## new

windowControlsNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PackType | `side`: the side
-> m WindowControls | Returns: a new `GtkWindowControls`

Creates a new `GtkWindowControls`.

## setDecorationLayout

windowControlsSetDecorationLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> Maybe Text | `layout`: a decoration layout, or `NULL` to unset the layout
-> m () |

Sets the decoration layout for the title buttons.

This overrides the Settings:gtkDecorationLayout 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 WindowControls:side value is `PackTypeStart`, `self` will display the part before the colon, otherwise after that.

## setSide

windowControlsSetSide Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window controls widget
-> PackType | `side`: a side
-> m () |

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

See WindowControls:decorationLayout.

## setUseNativeControls

windowControlsSetUseNativeControls Source #

Arguments

:: (HasCallStack, MonadIO m, IsWindowControls a) |
=> a | `self`: a window_controls widget
-> Bool | `setting`: true to show native window controls
-> m () |

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.

Since: 4.18

# Properties

## decorationLayout

The decoration layout for window buttons.

If this property is not set, the Settings:gtkDecorationLayout setting is used.

clearWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> m () Source #

Set the value of the “`decoration-layout`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #decorationLayout

constructWindowControlsDecorationLayout :: (IsWindowControls o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`decoration-layout`” property. This is rarely needed directly, but it is used by `new`.

getWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> m (Maybe Text) Source #

Get the value of the “`decoration-layout`” property. When overloading is enabled, this is equivalent to

    get windowControls #decorationLayout

setWindowControlsDecorationLayout :: (MonadIO m, IsWindowControls o) => o -> Text -> m () Source #

Set the value of the “`decoration-layout`” property. When overloading is enabled, this is equivalent to

    set windowControls [ #decorationLayout := value ]

## empty

Whether the widget has any window buttons.

getWindowControlsEmpty :: (MonadIO m, IsWindowControls o) => o -> m Bool Source #

Get the value of the “`empty`” property. When overloading is enabled, this is equivalent to

    get windowControls #empty

## side

Whether the widget shows start or end side of the decoration layout.

See [property`gtk`.WindowControls:decoration_layout].

constructWindowControlsSide :: (IsWindowControls o, MonadIO m) => PackType -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`side`” property. This is rarely needed directly, but it is used by `new`.

getWindowControlsSide :: (MonadIO m, IsWindowControls o) => o -> m PackType Source #

Get the value of the “`side`” property. When overloading is enabled, this is equivalent to

    get windowControls #side

setWindowControlsSide :: (MonadIO m, IsWindowControls o) => o -> PackType -> m () Source #

Set the value of the “`side`” property. When overloading is enabled, this is equivalent to

    set windowControls [ #side := value ]

## useNativeControls

Whether to show platform native close/minimize/maximize buttons.

For macOS, the HeaderBar:decorationLayout property controls the use of native window controls.

On other platforms, this option has no effect.

See also Using GTK on Apple macOS.

Since: 4.18

constructWindowControlsUseNativeControls :: (IsWindowControls o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`use-native-controls`” property. This is rarely needed directly, but it is used by `new`.

getWindowControlsUseNativeControls :: (MonadIO m, IsWindowControls o) => o -> m Bool Source #

Get the value of the “`use-native-controls`” property. When overloading is enabled, this is equivalent to

    get windowControls #useNativeControls

setWindowControlsUseNativeControls :: (MonadIO m, IsWindowControls o) => o -> Bool -> m () Source #

Set the value of the “`use-native-controls`” property. When overloading is enabled, this is equivalent to

    set windowControls [ #useNativeControls := value ]