Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A Expander
allows the user to hide or show its child by clicking
on an expander triangle similar to the triangles used in a TreeView
.
Normally you use an expander as you would use any other descendant
of Bin
; you create the child widget and use containerAdd
to add it to the expander. When the expander is toggled, it will take
care of showing and hiding the child automatically.
Special Usage
There are situations in which you may prefer to show and hide the
expanded widget yourself, such as when you want to actually create
the widget at expansion time. In this case, create a Expander
but do not add a child to it. The expander widget has an
Expander
:expanded
property which can be used to monitor
its expansion state. You should watch this property with a signal
connection as follows:
C code
expander = gtk_expander_new_with_mnemonic ("_More Options"); g_signal_connect (expander, "notify::expanded", G_CALLBACK (expander_callback), NULL); ... static void expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) { GtkExpander *expander; expander = GTK_EXPANDER (object); if (gtk_expander_get_expanded (expander)) { // Show or create widgets } else { // Hide or destroy widgets } }
GtkExpander as GtkBuildable
The GtkExpander implementation of the GtkBuildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkExpander: > >class="GtkExpander" > type="label" > class="GtkLabel" id="expander-label"/ > /child > child > class="GtkEntry" id="expander-content"/ > /child >/object
CSS nodes
plain code
expander ├── title │ ├── arrow │ ╰── <label widget> ╰── <child>
GtkExpander has three CSS nodes, the main node with the name expander, a subnode with name title and node below it with name arrow. Neither of them is using any style classes.
- newtype Expander = Expander (ManagedPtr Expander)
- class GObject o => IsExpander o
- toExpander :: IsExpander o => o -> IO Expander
- noExpander :: Maybe Expander
- data ExpanderGetExpandedMethodInfo
- expanderGetExpanded :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- data ExpanderGetLabelMethodInfo
- expanderGetLabel :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Text
- data ExpanderGetLabelFillMethodInfo
- expanderGetLabelFill :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- data ExpanderGetLabelWidgetMethodInfo
- expanderGetLabelWidget :: (HasCallStack, MonadIO m, IsExpander a) => a -> m (Maybe Widget)
- data ExpanderGetResizeToplevelMethodInfo
- expanderGetResizeToplevel :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- data ExpanderGetSpacingMethodInfo
- expanderGetSpacing :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Int32
- data ExpanderGetUseMarkupMethodInfo
- expanderGetUseMarkup :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- data ExpanderGetUseUnderlineMethodInfo
- expanderGetUseUnderline :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- expanderNew :: (HasCallStack, MonadIO m) => Text -> m Expander
- expanderNewWithMnemonic :: (HasCallStack, MonadIO m) => Maybe Text -> m Expander
- data ExpanderSetExpandedMethodInfo
- expanderSetExpanded :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- data ExpanderSetLabelMethodInfo
- expanderSetLabel :: (HasCallStack, MonadIO m, IsExpander a) => a -> Maybe Text -> m ()
- data ExpanderSetLabelFillMethodInfo
- expanderSetLabelFill :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- data ExpanderSetLabelWidgetMethodInfo
- expanderSetLabelWidget :: (HasCallStack, MonadIO m, IsExpander a, IsWidget b) => a -> Maybe b -> m ()
- data ExpanderSetResizeToplevelMethodInfo
- expanderSetResizeToplevel :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- data ExpanderSetSpacingMethodInfo
- expanderSetSpacing :: (HasCallStack, MonadIO m, IsExpander a) => a -> Int32 -> m ()
- data ExpanderSetUseMarkupMethodInfo
- expanderSetUseMarkup :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- data ExpanderSetUseUnderlineMethodInfo
- expanderSetUseUnderline :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- data ExpanderExpandedPropertyInfo
- constructExpanderExpanded :: IsExpander o => Bool -> IO (GValueConstruct o)
- expanderExpanded :: AttrLabelProxy "expanded"
- getExpanderExpanded :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderExpanded :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- data ExpanderLabelPropertyInfo
- clearExpanderLabel :: (MonadIO m, IsExpander o) => o -> m ()
- constructExpanderLabel :: IsExpander o => Text -> IO (GValueConstruct o)
- expanderLabel :: AttrLabelProxy "label"
- getExpanderLabel :: (MonadIO m, IsExpander o) => o -> m Text
- setExpanderLabel :: (MonadIO m, IsExpander o) => o -> Text -> m ()
- data ExpanderLabelFillPropertyInfo
- constructExpanderLabelFill :: IsExpander o => Bool -> IO (GValueConstruct o)
- expanderLabelFill :: AttrLabelProxy "labelFill"
- getExpanderLabelFill :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderLabelFill :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- data ExpanderLabelWidgetPropertyInfo
- clearExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m ()
- constructExpanderLabelWidget :: (IsExpander o, IsWidget a) => a -> IO (GValueConstruct o)
- expanderLabelWidget :: AttrLabelProxy "labelWidget"
- getExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget)
- setExpanderLabelWidget :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m ()
- data ExpanderResizeToplevelPropertyInfo
- constructExpanderResizeToplevel :: IsExpander o => Bool -> IO (GValueConstruct o)
- expanderResizeToplevel :: AttrLabelProxy "resizeToplevel"
- getExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- data ExpanderSpacingPropertyInfo
- constructExpanderSpacing :: IsExpander o => Int32 -> IO (GValueConstruct o)
- expanderSpacing :: AttrLabelProxy "spacing"
- getExpanderSpacing :: (MonadIO m, IsExpander o) => o -> m Int32
- setExpanderSpacing :: (MonadIO m, IsExpander o) => o -> Int32 -> m ()
- data ExpanderUseMarkupPropertyInfo
- constructExpanderUseMarkup :: IsExpander o => Bool -> IO (GValueConstruct o)
- expanderUseMarkup :: AttrLabelProxy "useMarkup"
- getExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- data ExpanderUseUnderlinePropertyInfo
- constructExpanderUseUnderline :: IsExpander o => Bool -> IO (GValueConstruct o)
- expanderUseUnderline :: AttrLabelProxy "useUnderline"
- getExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- type C_ExpanderActivateCallback = Ptr () -> Ptr () -> IO ()
- type ExpanderActivateCallback = IO ()
- data ExpanderActivateSignalInfo
- afterExpanderActivate :: (GObject a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId
- genClosure_ExpanderActivate :: ExpanderActivateCallback -> IO Closure
- mk_ExpanderActivateCallback :: C_ExpanderActivateCallback -> IO (FunPtr C_ExpanderActivateCallback)
- noExpanderActivateCallback :: Maybe ExpanderActivateCallback
- onExpanderActivate :: (GObject a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId
- wrap_ExpanderActivateCallback :: ExpanderActivateCallback -> Ptr () -> Ptr () -> IO ()
Exported types
GObject Expander Source # | |
IsImplementorIface Expander Source # | |
IsObject Expander Source # | |
IsWidget Expander Source # | |
IsContainer Expander Source # | |
IsBin Expander Source # | |
IsBuildable Expander Source # | |
IsExpander Expander Source # | |
((~) * info (ResolveExpanderMethod t Expander), MethodInfo * info Expander p) => IsLabel t (Expander -> p) Source # | |
((~) * info (ResolveExpanderMethod t Expander), MethodInfo * info Expander p) => IsLabelProxy t (Expander -> p) Source # | |
HasAttributeList * Expander Source # | |
type AttributeList Expander Source # | |
type SignalList Expander Source # | |
class GObject o => IsExpander o Source #
(GObject a, UnknownAncestorError Constraint Expander a) => IsExpander a Source # | |
IsExpander Expander Source # | |
toExpander :: IsExpander o => o -> IO Expander Source #
Methods
getExpanded
data ExpanderGetExpandedMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetExpandedMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Bool | Returns: the current state of the expander |
Queries a Expander
and returns its current state. Returns True
if the child widget is revealed.
See expanderSetExpanded
.
Since: 2.4
getLabel
data ExpanderGetLabelMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetLabelMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Text | Returns: The text of the label widget. This string is owned by the widget and must not be modified or freed. |
Fetches the text from a label widget including any embedded
underlines indicating mnemonics and Pango markup, as set by
expanderSetLabel
. If the label text has not been set the
return value will be Nothing
. This will be the case if you create an
empty button with buttonNew
to use as a container.
Note that this function behaved differently in versions prior to 2.14 and used to return the label text stripped of embedded underlines indicating mnemonics and Pango markup. This problem can be avoided by fetching the label text directly from the label widget.
Since: 2.4
getLabelFill
data ExpanderGetLabelFillMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetLabelFillMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the label widget will fill all available
horizontal space allocated to expander
.
Since: 2.22
getLabelWidget
data ExpanderGetLabelWidgetMethodInfo Source #
((~) * signature (m (Maybe Widget)), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetLabelWidgetMethodInfo a signature Source # | |
expanderGetLabelWidget Source #
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the label widget,
or |
Retrieves the label widget for the frame. See
expanderSetLabelWidget
.
Since: 2.4
getResizeToplevel
data ExpanderGetResizeToplevelMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetResizeToplevelMethodInfo a signature Source # | |
expanderGetResizeToplevel Source #
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Bool | Returns: the “resize toplevel” setting. |
Returns whether the expander will resize the toplevel widget containing the expander upon resizing and collpasing.
Since: 3.2
getSpacing
data ExpanderGetSpacingMethodInfo Source #
((~) * signature (m Int32), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetSpacingMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Int32 | Returns: spacing between the expander and child |
Deprecated: (Since version 3.20)Use margins on the child instead.
Gets the value set by expanderSetSpacing
.
Since: 2.4
getUseMarkup
data ExpanderGetUseMarkupMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetUseMarkupMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the label’s text is interpreted as marked up with
the [Pango text markup language][PangoMarkupFormat].
See expanderSetUseMarkup
.
Since: 2.4
getUseUnderline
data ExpanderGetUseUnderlineMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsExpander a) => MethodInfo * ExpanderGetUseUnderlineMethodInfo a signature Source # | |
expanderGetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether an embedded underline in the expander label
indicates a mnemonic. See expanderSetUseUnderline
.
Since: 2.4
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Expander | Returns: a new |
Creates a new expander using label
as the text of the label.
Since: 2.4
newWithMnemonic
expanderNewWithMnemonic Source #
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m Expander | Returns: a new |
Creates a new expander using label
as the text of the label.
If characters in label
are preceded by an underscore, they are underlined.
If you need a literal underscore character in a label, use “__” (two
underscores). The first underlined character represents a keyboard
accelerator called a mnemonic.
Pressing Alt and that key activates the button.
Since: 2.4
setExpanded
data ExpanderSetExpandedMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetExpandedMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Bool |
|
-> m () |
setLabel
data ExpanderSetLabelMethodInfo Source #
((~) * signature (Maybe Text -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetLabelMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the text of the label of the expander to label
.
This will also clear any previously set labels.
Since: 2.4
setLabelFill
data ExpanderSetLabelFillMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetLabelFillMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the label widget should fill all available
horizontal space allocated to expander
.
Since: 2.22
setLabelWidget
data ExpanderSetLabelWidgetMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsExpander a, IsWidget b) => MethodInfo * ExpanderSetLabelWidgetMethodInfo a signature Source # | |
expanderSetLabelWidget Source #
:: (HasCallStack, MonadIO m, IsExpander a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.
Since: 2.4
setResizeToplevel
data ExpanderSetResizeToplevelMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetResizeToplevelMethodInfo a signature Source # | |
expanderSetResizeToplevel Source #
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collpasing.
Since: 3.2
setSpacing
data ExpanderSetSpacingMethodInfo Source #
((~) * signature (Int32 -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetSpacingMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Int32 |
|
-> m () |
Deprecated: (Since version 3.20)Use margins on the child instead.
Sets the spacing field of expander
, which is the number of
pixels to place between expander and the child.
Since: 2.4
setUseMarkup
data ExpanderSetUseMarkupMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetUseMarkupMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the text of the label contains markup in
[Pango’s text markup language][PangoMarkupFormat].
See labelSetMarkup
.
Since: 2.4
setUseUnderline
data ExpanderSetUseUnderlineMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetUseUnderlineMethodInfo a signature Source # | |
expanderSetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsExpander a) | |
=> a |
|
-> Bool |
|
-> m () |
If true, an underline in the text of the expander label indicates the next character should be used for the mnemonic accelerator key.
Since: 2.4
Properties
expanded
data ExpanderExpandedPropertyInfo Source #
constructExpanderExpanded :: IsExpander o => Bool -> IO (GValueConstruct o) Source #
expanderExpanded :: AttrLabelProxy "expanded" Source #
getExpanderExpanded :: (MonadIO m, IsExpander o) => o -> m Bool Source #
setExpanderExpanded :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
label
data ExpanderLabelPropertyInfo Source #
clearExpanderLabel :: (MonadIO m, IsExpander o) => o -> m () Source #
constructExpanderLabel :: IsExpander o => Text -> IO (GValueConstruct o) Source #
expanderLabel :: AttrLabelProxy "label" Source #
getExpanderLabel :: (MonadIO m, IsExpander o) => o -> m Text Source #
setExpanderLabel :: (MonadIO m, IsExpander o) => o -> Text -> m () Source #
labelFill
data ExpanderLabelFillPropertyInfo Source #
constructExpanderLabelFill :: IsExpander o => Bool -> IO (GValueConstruct o) Source #
expanderLabelFill :: AttrLabelProxy "labelFill" Source #
getExpanderLabelFill :: (MonadIO m, IsExpander o) => o -> m Bool Source #
setExpanderLabelFill :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
labelWidget
data ExpanderLabelWidgetPropertyInfo Source #
clearExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m () Source #
constructExpanderLabelWidget :: (IsExpander o, IsWidget a) => a -> IO (GValueConstruct o) Source #
expanderLabelWidget :: AttrLabelProxy "labelWidget" Source #
getExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget) Source #
setExpanderLabelWidget :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m () Source #
resizeToplevel
data ExpanderResizeToplevelPropertyInfo Source #
constructExpanderResizeToplevel :: IsExpander o => Bool -> IO (GValueConstruct o) Source #
expanderResizeToplevel :: AttrLabelProxy "resizeToplevel" Source #
getExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> m Bool Source #
setExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
spacing
data ExpanderSpacingPropertyInfo Source #
constructExpanderSpacing :: IsExpander o => Int32 -> IO (GValueConstruct o) Source #
expanderSpacing :: AttrLabelProxy "spacing" Source #
getExpanderSpacing :: (MonadIO m, IsExpander o) => o -> m Int32 Source #
setExpanderSpacing :: (MonadIO m, IsExpander o) => o -> Int32 -> m () Source #
useMarkup
data ExpanderUseMarkupPropertyInfo Source #
constructExpanderUseMarkup :: IsExpander o => Bool -> IO (GValueConstruct o) Source #
expanderUseMarkup :: AttrLabelProxy "useMarkup" Source #
getExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> m Bool Source #
setExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
useUnderline
data ExpanderUseUnderlinePropertyInfo Source #
constructExpanderUseUnderline :: IsExpander o => Bool -> IO (GValueConstruct o) Source #
expanderUseUnderline :: AttrLabelProxy "useUnderline" Source #
getExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> m Bool Source #
setExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
Signals
activate
type ExpanderActivateCallback = IO () Source #
afterExpanderActivate :: (GObject a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId Source #
mk_ExpanderActivateCallback :: C_ExpanderActivateCallback -> IO (FunPtr C_ExpanderActivateCallback) Source #
onExpanderActivate :: (GObject a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId Source #
wrap_ExpanderActivateCallback :: ExpanderActivateCallback -> Ptr () -> Ptr () -> IO () Source #