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 |
- Exported types
- Methods
- addChild
- addNamed
- addTitled
- getChildByName
- getHhomogeneous
- getInterpolateSize
- getPage
- getPages
- getTransitionDuration
- getTransitionRunning
- getTransitionType
- getVhomogeneous
- getVisibleChild
- getVisibleChildName
- new
- remove
- setHhomogeneous
- setInterpolateSize
- setTransitionDuration
- setTransitionType
- setVhomogeneous
- setVisibleChild
- setVisibleChildFull
- setVisibleChildName
- Properties
GtkStack
is a container which only shows one of its children
at a time.
In contrast to GtkNotebook
, GtkStack
does not provide a means
for users to change the visible child. Instead, a separate widget
such as StackSwitcher
or StackSidebar
can
be used with GtkStack
to provide this functionality.
Transitions between pages can be animated as slides or fades. This
can be controlled with stackSetTransitionType
.
These animations respect the Settings:gtkEnableAnimations
setting.
GtkStack
maintains a StackPage
object for each added
child, which holds additional per-child properties. You
obtain the GtkStackPage
for a child with stackGetPage
and you can obtain a GtkSelectionModel
containing all the pages
with stackGetPages
.
GtkStack as GtkBuildable
To set child-specific properties in a .ui file, create GtkStackPage
objects explicitly, and set the child widget as a property on it:
xml code
<object class="GtkStack" id="stack"> <child> <object class="GtkStackPage"> <property name="name">page1</property> <property name="title">In the beginning…</property> <property name="child"> <object class="GtkLabel"> <property name="label">It was dark</property> </object> </property> </object> </child>
CSS nodes
GtkStack
has a single CSS node named stack.
Accessibility
GtkStack
uses the AccessibleRoleTabPanel
for the stack
pages, which are the accessible parent objects of the child widgets.
Synopsis
- newtype Stack = Stack (ManagedPtr Stack)
- class (GObject o, IsDescendantOf Stack o) => IsStack o
- toStack :: (MonadIO m, IsStack o) => o -> m Stack
- stackAddChild :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> m StackPage
- stackAddNamed :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> Maybe Text -> m StackPage
- stackAddTitled :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> Maybe Text -> Text -> m StackPage
- stackGetChildByName :: (HasCallStack, MonadIO m, IsStack a) => a -> Text -> m (Maybe Widget)
- stackGetHhomogeneous :: (HasCallStack, MonadIO m, IsStack a) => a -> m Bool
- stackGetInterpolateSize :: (HasCallStack, MonadIO m, IsStack a) => a -> m Bool
- stackGetPage :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> m StackPage
- stackGetPages :: (HasCallStack, MonadIO m, IsStack a) => a -> m SelectionModel
- stackGetTransitionDuration :: (HasCallStack, MonadIO m, IsStack a) => a -> m Word32
- stackGetTransitionRunning :: (HasCallStack, MonadIO m, IsStack a) => a -> m Bool
- stackGetTransitionType :: (HasCallStack, MonadIO m, IsStack a) => a -> m StackTransitionType
- stackGetVhomogeneous :: (HasCallStack, MonadIO m, IsStack a) => a -> m Bool
- stackGetVisibleChild :: (HasCallStack, MonadIO m, IsStack a) => a -> m (Maybe Widget)
- stackGetVisibleChildName :: (HasCallStack, MonadIO m, IsStack a) => a -> m (Maybe Text)
- stackNew :: (HasCallStack, MonadIO m) => m Stack
- stackRemove :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> m ()
- stackSetHhomogeneous :: (HasCallStack, MonadIO m, IsStack a) => a -> Bool -> m ()
- stackSetInterpolateSize :: (HasCallStack, MonadIO m, IsStack a) => a -> Bool -> m ()
- stackSetTransitionDuration :: (HasCallStack, MonadIO m, IsStack a) => a -> Word32 -> m ()
- stackSetTransitionType :: (HasCallStack, MonadIO m, IsStack a) => a -> StackTransitionType -> m ()
- stackSetVhomogeneous :: (HasCallStack, MonadIO m, IsStack a) => a -> Bool -> m ()
- stackSetVisibleChild :: (HasCallStack, MonadIO m, IsStack a, IsWidget b) => a -> b -> m ()
- stackSetVisibleChildFull :: (HasCallStack, MonadIO m, IsStack a) => a -> Text -> StackTransitionType -> m ()
- stackSetVisibleChildName :: (HasCallStack, MonadIO m, IsStack a) => a -> Text -> m ()
- constructStackHhomogeneous :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o)
- getStackHhomogeneous :: (MonadIO m, IsStack o) => o -> m Bool
- setStackHhomogeneous :: (MonadIO m, IsStack o) => o -> Bool -> m ()
- constructStackInterpolateSize :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o)
- getStackInterpolateSize :: (MonadIO m, IsStack o) => o -> m Bool
- setStackInterpolateSize :: (MonadIO m, IsStack o) => o -> Bool -> m ()
- getStackPages :: (MonadIO m, IsStack o) => o -> m (Maybe SelectionModel)
- constructStackTransitionDuration :: (IsStack o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getStackTransitionDuration :: (MonadIO m, IsStack o) => o -> m Word32
- setStackTransitionDuration :: (MonadIO m, IsStack o) => o -> Word32 -> m ()
- getStackTransitionRunning :: (MonadIO m, IsStack o) => o -> m Bool
- constructStackTransitionType :: (IsStack o, MonadIO m) => StackTransitionType -> m (GValueConstruct o)
- getStackTransitionType :: (MonadIO m, IsStack o) => o -> m StackTransitionType
- setStackTransitionType :: (MonadIO m, IsStack o) => o -> StackTransitionType -> m ()
- constructStackVhomogeneous :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o)
- getStackVhomogeneous :: (MonadIO m, IsStack o) => o -> m Bool
- setStackVhomogeneous :: (MonadIO m, IsStack o) => o -> Bool -> m ()
- constructStackVisibleChild :: (IsStack o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getStackVisibleChild :: (MonadIO m, IsStack o) => o -> m (Maybe Widget)
- setStackVisibleChild :: (MonadIO m, IsStack o, IsWidget a) => o -> a -> m ()
- constructStackVisibleChildName :: (IsStack o, MonadIO m) => Text -> m (GValueConstruct o)
- getStackVisibleChildName :: (MonadIO m, IsStack o) => o -> m (Maybe Text)
- setStackVisibleChildName :: (MonadIO m, IsStack o) => o -> Text -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Stack Source # | |
GObject Stack Source # | |
Defined in GI.Gtk.Objects.Stack | |
ManagedPtrNewtype Stack Source # | |
Defined in GI.Gtk.Objects.Stack toManagedPtr :: Stack -> ManagedPtr Stack | |
TypedObject Stack Source # | |
Defined in GI.Gtk.Objects.Stack | |
HasParentTypes Stack Source # | |
Defined in GI.Gtk.Objects.Stack | |
IsGValue (Maybe Stack) Source # | Convert |
Defined in GI.Gtk.Objects.Stack gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Stack -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Stack) | |
type ParentTypes Stack Source # | |
Defined in GI.Gtk.Objects.Stack |
class (GObject o, IsDescendantOf Stack o) => IsStack o Source #
Instances
(GObject o, IsDescendantOf Stack o) => IsStack o Source # | |
Defined in GI.Gtk.Objects.Stack |
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addChild, addController, addCssClass, addMnemonicLabel, addNamed, addTickCallback, addTitled, 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, 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, getChildByName, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getHhomogeneous, getInterpolateSize, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPage, getPages, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getTransitionDuration, getTransitionRunning, getTransitionType, getValign, getVexpand, getVexpandSet, getVhomogeneous, getVisible, getVisibleChild, getVisibleChildName, getWidth.
Setters
setAccessibleParent, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setHhomogeneous, setInterpolateSize, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setTransitionDuration, setTransitionType, setValign, setVexpand, setVexpandSet, setVhomogeneous, setVisible, setVisibleChild, setVisibleChildFull, setVisibleChildName.
addChild
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> m StackPage | Returns: the |
Adds a child to stack
.
addNamed
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> Maybe Text |
|
-> m StackPage | Returns: the |
Adds a child to stack
.
The child is identified by the name
.
addTitled
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> Maybe Text |
|
-> Text |
|
-> m StackPage | Returns: the |
Adds a child to stack
.
The child is identified by the name
. The title
will be used by GtkStackSwitcher
to represent
child
in a tab bar, so it should be short.
getChildByName
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Text |
|
-> m (Maybe Widget) | Returns: the requested child
of the |
Finds the child with the name given as the argument.
Returns Nothing
if there is no child with this name.
getHhomogeneous
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m Bool | Returns: whether |
Gets whether stack
is horizontally homogeneous.
getInterpolateSize
stackGetInterpolateSize Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the GtkStack
is set up to interpolate between
the sizes of children on page switch.
getPage
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> m StackPage | Returns: the |
Returns the GtkStackPage
object for child
.
getPages
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m SelectionModel | Returns: a |
Returns a GListModel
that contains the pages of the stack.
This can be used to keep an up-to-date view. The model also
implements SelectionModel
and can be used to track
and modify the visible page.
getTransitionDuration
stackGetTransitionDuration Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m Word32 | Returns: the transition duration |
Returns the amount of time (in milliseconds) that
transitions between pages in stack
will take.
getTransitionRunning
stackGetTransitionRunning Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the stack
is currently in a transition from one page to
another.
getTransitionType
stackGetTransitionType Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m StackTransitionType | Returns: the current transition type of |
Gets the type of animation that will be used
for transitions between pages in stack
.
getVhomogeneous
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m Bool | Returns: whether |
Gets whether stack
is vertically homogeneous.
getVisibleChild
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the visible child of the |
Gets the currently visible child of stack
.
Returns Nothing
if there are no visible children.
getVisibleChildName
stackGetVisibleChildName Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> m (Maybe Text) | Returns: the name of the visible child
of the |
Returns the name of the currently visible child of stack
.
Returns Nothing
if there is no visible child.
new
:: (HasCallStack, MonadIO m) | |
=> m Stack | Returns: a new |
Creates a new GtkStack
.
remove
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Removes a child widget from stack
.
setHhomogeneous
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets the GtkStack
to be horizontally homogeneous or not.
If it is homogeneous, the GtkStack
will request the same
width for all its children. If it isn't, the stack
may change width when a different child becomes visible.
setInterpolateSize
stackSetInterpolateSize Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether or not stack
will interpolate its size when
changing the visible child.
If the Stack:interpolateSize property is set
to True
, stack
will interpolate its size between the current
one and the one it'll take after changing the visible child,
according to the set transition duration.
setTransitionDuration
stackSetTransitionDuration Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Word32 |
|
-> m () |
Sets the duration that transitions between pages in stack
will take.
setTransitionType
stackSetTransitionType Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> StackTransitionType |
|
-> m () |
Sets the type of animation that will be used for
transitions between pages in stack
.
Available types include various kinds of fades and slides.
The transition type can be changed without problems at runtime, so it is possible to change the animation based on the page that is about to become current.
setVhomogeneous
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets the GtkStack
to be vertically homogeneous or not.
If it is homogeneous, the GtkStack
will request the same
height for all its children. If it isn't, the stack
may change height when a different child becomes visible.
setVisibleChild
:: (HasCallStack, MonadIO m, IsStack a, IsWidget b) | |
=> a |
|
-> b |
|
-> m () |
Makes child
the visible child of stack
.
If child
is different from the currently visible child,
the transition between the two will be animated with the
current transition type of stack
.
Note that the child
widget has to be visible itself
(see widgetShow
) in order to become the visible
child of stack
.
setVisibleChildFull
stackSetVisibleChildFull Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Text |
|
-> StackTransitionType |
|
-> m () |
Makes the child with the given name visible.
Note that the child widget has to be visible itself
(see widgetShow
) in order to become the visible
child of stack
.
setVisibleChildName
stackSetVisibleChildName Source #
:: (HasCallStack, MonadIO m, IsStack a) | |
=> a |
|
-> Text |
|
-> m () |
Makes the child with the given name visible.
If child
is different from the currently visible child,
the transition between the two will be animated with the
current transition type of stack
.
Note that the child widget has to be visible itself
(see widgetShow
) in order to become the visible
child of stack
.
Properties
hhomogeneous
True
if the stack allocates the same width for all children.
constructStackHhomogeneous :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “hhomogeneous
” property. This is rarely needed directly, but it is used by new
.
getStackHhomogeneous :: (MonadIO m, IsStack o) => o -> m Bool Source #
Get the value of the “hhomogeneous
” property.
When overloading is enabled, this is equivalent to
get
stack #hhomogeneous
setStackHhomogeneous :: (MonadIO m, IsStack o) => o -> Bool -> m () Source #
Set the value of the “hhomogeneous
” property.
When overloading is enabled, this is equivalent to
set
stack [ #hhomogeneous:=
value ]
interpolateSize
Whether or not the size should smoothly change during the transition.
constructStackInterpolateSize :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “interpolate-size
” property. This is rarely needed directly, but it is used by new
.
getStackInterpolateSize :: (MonadIO m, IsStack o) => o -> m Bool Source #
Get the value of the “interpolate-size
” property.
When overloading is enabled, this is equivalent to
get
stack #interpolateSize
setStackInterpolateSize :: (MonadIO m, IsStack o) => o -> Bool -> m () Source #
Set the value of the “interpolate-size
” property.
When overloading is enabled, this is equivalent to
set
stack [ #interpolateSize:=
value ]
pages
A selection model with the stack pages.
getStackPages :: (MonadIO m, IsStack o) => o -> m (Maybe SelectionModel) Source #
Get the value of the “pages
” property.
When overloading is enabled, this is equivalent to
get
stack #pages
transitionDuration
The animation duration, in milliseconds.
constructStackTransitionDuration :: (IsStack o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “transition-duration
” property. This is rarely needed directly, but it is used by new
.
getStackTransitionDuration :: (MonadIO m, IsStack o) => o -> m Word32 Source #
Get the value of the “transition-duration
” property.
When overloading is enabled, this is equivalent to
get
stack #transitionDuration
setStackTransitionDuration :: (MonadIO m, IsStack o) => o -> Word32 -> m () Source #
Set the value of the “transition-duration
” property.
When overloading is enabled, this is equivalent to
set
stack [ #transitionDuration:=
value ]
transitionRunning
Whether or not the transition is currently running.
getStackTransitionRunning :: (MonadIO m, IsStack o) => o -> m Bool Source #
Get the value of the “transition-running
” property.
When overloading is enabled, this is equivalent to
get
stack #transitionRunning
transitionType
The type of animation used to transition.
constructStackTransitionType :: (IsStack o, MonadIO m) => StackTransitionType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “transition-type
” property. This is rarely needed directly, but it is used by new
.
getStackTransitionType :: (MonadIO m, IsStack o) => o -> m StackTransitionType Source #
Get the value of the “transition-type
” property.
When overloading is enabled, this is equivalent to
get
stack #transitionType
setStackTransitionType :: (MonadIO m, IsStack o) => o -> StackTransitionType -> m () Source #
Set the value of the “transition-type
” property.
When overloading is enabled, this is equivalent to
set
stack [ #transitionType:=
value ]
vhomogeneous
True
if the stack allocates the same height for all children.
constructStackVhomogeneous :: (IsStack o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “vhomogeneous
” property. This is rarely needed directly, but it is used by new
.
getStackVhomogeneous :: (MonadIO m, IsStack o) => o -> m Bool Source #
Get the value of the “vhomogeneous
” property.
When overloading is enabled, this is equivalent to
get
stack #vhomogeneous
setStackVhomogeneous :: (MonadIO m, IsStack o) => o -> Bool -> m () Source #
Set the value of the “vhomogeneous
” property.
When overloading is enabled, this is equivalent to
set
stack [ #vhomogeneous:=
value ]
visibleChild
The widget currently visible in the stack.
constructStackVisibleChild :: (IsStack o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “visible-child
” property. This is rarely needed directly, but it is used by new
.
getStackVisibleChild :: (MonadIO m, IsStack o) => o -> m (Maybe Widget) Source #
Get the value of the “visible-child
” property.
When overloading is enabled, this is equivalent to
get
stack #visibleChild
setStackVisibleChild :: (MonadIO m, IsStack o, IsWidget a) => o -> a -> m () Source #
Set the value of the “visible-child
” property.
When overloading is enabled, this is equivalent to
set
stack [ #visibleChild:=
value ]
visibleChildName
The name of the widget currently visible in the stack.
constructStackVisibleChildName :: (IsStack o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “visible-child-name
” property. This is rarely needed directly, but it is used by new
.
getStackVisibleChildName :: (MonadIO m, IsStack o) => o -> m (Maybe Text) Source #
Get the value of the “visible-child-name
” property.
When overloading is enabled, this is equivalent to
get
stack #visibleChildName
setStackVisibleChildName :: (MonadIO m, IsStack o) => o -> Text -> m () Source #
Set the value of the “visible-child-name
” property.
When overloading is enabled, this is equivalent to
set
stack [ #visibleChildName:=
value ]