gi-gtk-4.0.2: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.HeaderBar

Description

GtkHeaderBar is similar to a horizontal Box. It allows children to be placed at the start or the end. In addition, it allows the window title to be displayed. The title will be centered with respect to the width of the box, even if the children at either side take up different amounts of space.

GtkHeaderBar can add typical window frame controls, such as minimize, maximize and close buttons, or the window icon.

For these reasons, GtkHeaderBar is the natural choice for use as the custom titlebar widget of a Window (see windowSetTitlebar), as it gives features typical of titlebars while allowing the addition of child widgets.

The GtkHeaderBar implementation of the Buildable interface supports adding children at the start or end sides by specifying “start” or “end” as the “type” attribute of a <child> element, or setting the title widget by specifying “title” value.

By default the GtkHeaderBar uses a Label displaying the title of the window it is contained in as the title widget, equivalent to the following UI definition:

<object class="GtkHeaderBar">
  <property name="title-widget">
    <object class="GtkLabel">
      <property name="label" translatable="yes">Label</property>
      <property name="single-line-mode">True</property>
      <property name="ellipsize">end</property>
      <property name="width-chars">5</property>
      <style>
        <class name="title"/>
      </style>
    </object>
  </property>
</object>

CSS nodes

plain code

headerbar
╰── windowhandle
    ╰── box
        ├── box.start
        │   ├── windowcontrols.start
        │   ╰── [other children]
        ├── [Title Widget]
        ╰── box.end
            ├── [other children]
            ╰── windowcontrols.end

A HeaderBar's CSS node is called headerbar. It contains a windowhandle subnode, which contains a box subnode, which contains two box subnodes at the start and end of the headerbar, as well as a center node that represents the title.

Each of the boxes contains a windowcontrols subnode, see WindowControls for details, as well as other children.

Synopsis

Exported types

newtype HeaderBar Source #

Memory-managed wrapper type.

Instances

Instances details
Eq HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

IsGValue HeaderBar Source #

Convert HeaderBar to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.HeaderBar

ManagedPtrNewtype HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

TypedObject HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

Methods

glibType :: IO GType #

GObject HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

HasParentTypes HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

type ParentTypes HeaderBar Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

type ParentTypes HeaderBar = '[Widget, Object, ImplementorIface, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf HeaderBar o) => IsHeaderBar o Source #

Type class for types which can be safely cast to HeaderBar, for instance with toHeaderBar.

Instances

Instances details
(GObject o, IsDescendantOf HeaderBar o) => IsHeaderBar o Source # 
Instance details

Defined in GI.Gtk.Objects.HeaderBar

toHeaderBar :: (MonadIO m, IsHeaderBar o) => o -> m HeaderBar Source #

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

Methods

Overloaded methods

getDecorationLayout

headerBarGetDecorationLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a) 
=> a

bar: a HeaderBar

-> m Text

Returns: the decoration layout

Gets the decoration layout set with headerBarSetDecorationLayout.

getShowTitleButtons

headerBarGetShowTitleButtons Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a) 
=> a

bar: a HeaderBar

-> m Bool

Returns: True if title buttons are shown

Returns whether this header bar shows the standard window title buttons.

getTitleWidget

headerBarGetTitleWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a) 
=> a

bar: a HeaderBar

-> m (Maybe Widget)

Returns: the title widget of the header, or Nothing if none has been set explicitly.

Retrieves the title widget of the header. See headerBarSetTitleWidget.

new

headerBarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m HeaderBar

Returns: a new HeaderBar

Creates a new HeaderBar widget.

packEnd

headerBarPackEnd Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) 
=> a

bar: A HeaderBar

-> b

child: the Widget to be added to bar

-> m () 

Adds child to bar, packed with reference to the end of the bar.

packStart

headerBarPackStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) 
=> a

bar: A HeaderBar

-> b

child: the Widget to be added to bar

-> m () 

Adds child to bar, packed with reference to the start of the bar.

remove

headerBarRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) 
=> a

bar: a HeaderBar

-> b

child: the child to remove

-> m () 

Removes a child from bar, after it has been added with headerBarPackStart, headerBarPackEnd or headerBarSetTitleWidget.

setDecorationLayout

headerBarSetDecorationLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a) 
=> a

bar: a HeaderBar

-> Maybe Text

layout: a decoration layout, or Nothing to unset the layout

-> m () 

Sets the decoration layout for this header bar, overriding the Settings:gtk-decoration-layout setting.

There can be valid reasons for overriding the setting, such as a header bar design that does not allow for buttons to take room on the right, or only offers room for a single close button. Split header bars are another example for overriding the 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.

setShowTitleButtons

headerBarSetShowTitleButtons Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a) 
=> a

bar: a HeaderBar

-> Bool

setting: True to show standard title buttons

-> m () 

Sets whether this header bar shows the standard window title buttons including close, maximize, and minimize.

setTitleWidget

headerBarSetTitleWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) 
=> a

bar: a HeaderBar

-> Maybe b

titleWidget: a widget to use for a title

-> m () 

Sets the title for the HeaderBar.

When set to Nothing, the headerbar will display the title of the window it is contained in.

The title should help a user identify the current view. To achieve the same style as the builtin title, use the “title” style class.

You should set the title widget to Nothing, for the window title label to be visible again.

Properties

decorationLayout

The decoration layout for buttons. If this property is not set, the Settings:gtk-decoration-layout setting is used.

See headerBarSetDecorationLayout for information about the format of this string.

clearHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> m () Source #

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

clear #decorationLayout

constructHeaderBarDecorationLayout :: (IsHeaderBar 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.

getHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> m Text Source #

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

get headerBar #decorationLayout

setHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> Text -> m () Source #

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

set headerBar [ #decorationLayout := value ]

showTitleButtons

Whether to show title buttons like close, minimize, maximize.

Which buttons are actually shown and where is determined by the HeaderBar:decoration-layout property, and by the state of the window (e.g. a close button will not be shown if the window can't be closed).

constructHeaderBarShowTitleButtons :: (IsHeaderBar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getHeaderBarShowTitleButtons :: (MonadIO m, IsHeaderBar o) => o -> m Bool Source #

Get the value of the “show-title-buttons” property. When overloading is enabled, this is equivalent to

get headerBar #showTitleButtons

setHeaderBarShowTitleButtons :: (MonadIO m, IsHeaderBar o) => o -> Bool -> m () Source #

Set the value of the “show-title-buttons” property. When overloading is enabled, this is equivalent to

set headerBar [ #showTitleButtons := value ]

titleWidget

No description available in the introspection data.

clearHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o) => o -> m () Source #

Set the value of the “title-widget” property to Nothing. When overloading is enabled, this is equivalent to

clear #titleWidget

constructHeaderBarTitleWidget :: (IsHeaderBar o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

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

getHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o) => o -> m (Maybe Widget) Source #

Get the value of the “title-widget” property. When overloading is enabled, this is equivalent to

get headerBar #titleWidget

setHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o, IsWidget a) => o -> a -> m () Source #

Set the value of the “title-widget” property. When overloading is enabled, this is equivalent to

set headerBar [ #titleWidget := value ]