Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkHeaderBar
is a widget for creating custom title bars for windows.
GtkHeaderBar
is similar to a horizontal GtkCenterBox
. 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 GtkWindow
(see windowSetTitlebar
),
as it gives features typical of titlebars while allowing the addition of
child widgets.
GtkHeaderBar as GtkBuildable
The GtkHeaderBar
implementation of the GtkBuildable
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 GtkLabel
displaying the title of the
window it is contained in as the title widget, equivalent to the following
UI definition:
xml code
<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
headerbar ╰── windowhandle ╰── box ├── box.start │ ├── windowcontrols.start │ ╰── [other children] ├── [Title Widget] ╰── box.end ├── [other children] ╰── windowcontrols.end
A GtkHeaderBar
'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 header bar, 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.
Accessibility
GtkHeaderBar
uses the AccessibleRoleGroup
role.
Synopsis
- newtype HeaderBar = HeaderBar (ManagedPtr HeaderBar)
- class (GObject o, IsDescendantOf HeaderBar o) => IsHeaderBar o
- toHeaderBar :: (MonadIO m, IsHeaderBar o) => o -> m HeaderBar
- headerBarGetDecorationLayout :: (HasCallStack, MonadIO m, IsHeaderBar a) => a -> m (Maybe Text)
- headerBarGetShowTitleButtons :: (HasCallStack, MonadIO m, IsHeaderBar a) => a -> m Bool
- headerBarGetTitleWidget :: (HasCallStack, MonadIO m, IsHeaderBar a) => a -> m (Maybe Widget)
- headerBarNew :: (HasCallStack, MonadIO m) => m HeaderBar
- headerBarPackEnd :: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) => a -> b -> m ()
- headerBarPackStart :: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) => a -> b -> m ()
- headerBarRemove :: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) => a -> b -> m ()
- headerBarSetDecorationLayout :: (HasCallStack, MonadIO m, IsHeaderBar a) => a -> Maybe Text -> m ()
- headerBarSetShowTitleButtons :: (HasCallStack, MonadIO m, IsHeaderBar a) => a -> Bool -> m ()
- headerBarSetTitleWidget :: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) => a -> Maybe b -> m ()
- clearHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> m ()
- constructHeaderBarDecorationLayout :: (IsHeaderBar o, MonadIO m) => Text -> m (GValueConstruct o)
- getHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> m (Maybe Text)
- setHeaderBarDecorationLayout :: (MonadIO m, IsHeaderBar o) => o -> Text -> m ()
- constructHeaderBarShowTitleButtons :: (IsHeaderBar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getHeaderBarShowTitleButtons :: (MonadIO m, IsHeaderBar o) => o -> m Bool
- setHeaderBarShowTitleButtons :: (MonadIO m, IsHeaderBar o) => o -> Bool -> m ()
- clearHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o) => o -> m ()
- constructHeaderBarTitleWidget :: (IsHeaderBar o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o) => o -> m (Maybe Widget)
- setHeaderBarTitleWidget :: (MonadIO m, IsHeaderBar o, IsWidget a) => o -> a -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq HeaderBar Source # | |
GObject HeaderBar Source # | |
Defined in GI.Gtk.Objects.HeaderBar | |
ManagedPtrNewtype HeaderBar Source # | |
Defined in GI.Gtk.Objects.HeaderBar toManagedPtr :: HeaderBar -> ManagedPtr HeaderBar | |
TypedObject HeaderBar Source # | |
Defined in GI.Gtk.Objects.HeaderBar | |
HasParentTypes HeaderBar Source # | |
Defined in GI.Gtk.Objects.HeaderBar | |
IsGValue (Maybe HeaderBar) Source # | Convert |
Defined in GI.Gtk.Objects.HeaderBar gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe HeaderBar -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe HeaderBar) | |
type ParentTypes HeaderBar Source # | |
Defined in GI.Gtk.Objects.HeaderBar |
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
(GObject o, IsDescendantOf HeaderBar o) => IsHeaderBar o Source # | |
Defined in GI.Gtk.Objects.HeaderBar |
toHeaderBar :: (MonadIO m, IsHeaderBar o) => o -> m HeaderBar Source #
Methods
Click to display all available methods, including inherited ones
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, packEnd, packStart, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, remove, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDecorationLayout, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, 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, getShowTitleButtons, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTitleWidget, getTooltipMarkup, getTooltipText, 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, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setShowTitleButtons, setSizeRequest, setStateFlags, setTitleWidget, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.
getDecorationLayout
headerBarGetDecorationLayout Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a) | |
=> a |
|
-> m (Maybe Text) | Returns: the decoration layout |
Gets the decoration layout of the GtkHeaderBar
.
getShowTitleButtons
headerBarGetShowTitleButtons Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether this header bar shows the standard window title buttons.
getTitleWidget
headerBarGetTitleWidget Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the title widget of the header |
Retrieves the title widget of the header.
new
:: (HasCallStack, MonadIO m) | |
=> m HeaderBar | Returns: a new |
Creates a new GtkHeaderBar
widget.
packEnd
:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Adds child
to bar
, packed with reference to the
end of the bar
.
packStart
:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Adds child
to bar
, packed with reference to the
start of the bar
.
remove
:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Removes a child from the GtkHeaderBar
.
The child must have been added with
headerBarPackStart
,
headerBarPackEnd
or
headerBarSetTitleWidget
.
setDecorationLayout
headerBarSetDecorationLayout Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the decoration layout for this header bar.
This property overrides the Settings:gtkDecorationLayout 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 an icon on the left, and minimize, maximize and close buttons on the right.
setShowTitleButtons
headerBarSetShowTitleButtons Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether this header bar shows the standard window title buttons.
setTitleWidget
headerBarSetTitleWidget Source #
:: (HasCallStack, MonadIO m, IsHeaderBar a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the title for the GtkHeaderBar
.
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:gtkDecorationLayout setting is used.
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 (Maybe 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:decorationLayout 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 ]