| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
GI.Gtk.Objects.Expander
Description
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 a frame; you create
 the child widget and use expanderSetChild 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
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
    }
}
static void
create_expander (void)
{
  GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options");
  g_signal_connect (expander, "notify::expanded",
                    G_CALLBACK (expander_callback), NULL);
  // ...
}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
╰── box
    ├── 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. The arrow of an expander that is showing its child gets the :checked pseudoclass added to it.
Accessibility
GtkExpander uses the GTK_ACCESSIBLE_ROLE_BUTTON role.
Synopsis
- newtype Expander = Expander (ManagedPtr Expander)
- class (GObject o, IsDescendantOf Expander o) => IsExpander o
- toExpander :: (MonadIO m, IsExpander o) => o -> m Expander
- expanderGetChild :: (HasCallStack, MonadIO m, IsExpander a) => a -> m (Maybe Widget)
- expanderGetExpanded :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- expanderGetLabel :: (HasCallStack, MonadIO m, IsExpander a) => a -> m (Maybe Text)
- expanderGetLabelWidget :: (HasCallStack, MonadIO m, IsExpander a) => a -> m (Maybe Widget)
- expanderGetResizeToplevel :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- expanderGetUseMarkup :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- expanderGetUseUnderline :: (HasCallStack, MonadIO m, IsExpander a) => a -> m Bool
- expanderNew :: (HasCallStack, MonadIO m) => Maybe Text -> m Expander
- expanderNewWithMnemonic :: (HasCallStack, MonadIO m) => Maybe Text -> m Expander
- expanderSetChild :: (HasCallStack, MonadIO m, IsExpander a, IsWidget b) => a -> Maybe b -> m ()
- expanderSetExpanded :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- expanderSetLabel :: (HasCallStack, MonadIO m, IsExpander a) => a -> Maybe Text -> m ()
- expanderSetLabelWidget :: (HasCallStack, MonadIO m, IsExpander a, IsWidget b) => a -> Maybe b -> m ()
- expanderSetResizeToplevel :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- expanderSetUseMarkup :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- expanderSetUseUnderline :: (HasCallStack, MonadIO m, IsExpander a) => a -> Bool -> m ()
- clearExpanderChild :: (MonadIO m, IsExpander o) => o -> m ()
- constructExpanderChild :: (IsExpander o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getExpanderChild :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget)
- setExpanderChild :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m ()
- constructExpanderExpanded :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o)
- getExpanderExpanded :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderExpanded :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- clearExpanderLabel :: (MonadIO m, IsExpander o) => o -> m ()
- constructExpanderLabel :: (IsExpander o, MonadIO m) => Text -> m (GValueConstruct o)
- getExpanderLabel :: (MonadIO m, IsExpander o) => o -> m (Maybe Text)
- setExpanderLabel :: (MonadIO m, IsExpander o) => o -> Text -> m ()
- clearExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m ()
- constructExpanderLabelWidget :: (IsExpander o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget)
- setExpanderLabelWidget :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m ()
- constructExpanderResizeToplevel :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o)
- getExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- constructExpanderUseMarkup :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o)
- getExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> m Bool
- setExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> Bool -> m ()
- constructExpanderUseUnderline :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o)
- 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 ()
- afterExpanderActivate :: (IsExpander a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId
- genClosure_ExpanderActivate :: MonadIO m => ExpanderActivateCallback -> m (GClosure C_ExpanderActivateCallback)
- mk_ExpanderActivateCallback :: C_ExpanderActivateCallback -> IO (FunPtr C_ExpanderActivateCallback)
- noExpanderActivateCallback :: Maybe ExpanderActivateCallback
- onExpanderActivate :: (IsExpander a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId
- wrap_ExpanderActivateCallback :: ExpanderActivateCallback -> C_ExpanderActivateCallback
Exported types
Memory-managed wrapper type.
Instances
| Eq Expander Source # | |
| GObject Expander Source # | |
| Defined in GI.Gtk.Objects.Expander | |
| ManagedPtrNewtype Expander Source # | |
| Defined in GI.Gtk.Objects.Expander Methods toManagedPtr :: Expander -> ManagedPtr Expander | |
| TypedObject Expander Source # | |
| Defined in GI.Gtk.Objects.Expander | |
| HasParentTypes Expander Source # | |
| Defined in GI.Gtk.Objects.Expander | |
| IsGValue (Maybe Expander) Source # | Convert  | 
| Defined in GI.Gtk.Objects.Expander Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Expander -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Expander) | |
| type ParentTypes Expander Source # | |
| Defined in GI.Gtk.Objects.Expander | |
class (GObject o, IsDescendantOf Expander o) => IsExpander o Source #
Type class for types which can be safely cast to Expander, for instance with toExpander.
Instances
| (GObject o, IsDescendantOf Expander o) => IsExpander o Source # | |
| Defined in GI.Gtk.Objects.Expander | |
toExpander :: (MonadIO m, IsExpander o) => o -> m Expander Source #
Methods
Click to display all available methods, including inherited ones
Methods
actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, 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, updateProperty, updateRelation, updateState, watchClosure.
Getters
getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getExpanded, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLabel, getLabelWidget, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getResizeToplevel, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getUseMarkup, getUseUnderline, getValign, getVexpand, getVexpandSet, getVisible, getWidth.
Setters
setCanFocus, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setExpanded, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLabel, setLabelWidget, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setResizeToplevel, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseMarkup, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible.
getChild
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> m (Maybe Widget) | Returns: the child widget of  | 
Gets the child widget of expander.
getExpanded
Arguments
| :: (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.
getLabel
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> m (Maybe 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.
getLabelWidget
expanderGetLabelWidget Source #
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> m (Maybe Widget) | Returns: the label widget,
     or  | 
Retrieves the label widget for the frame. See
 expanderSetLabelWidget.
getResizeToplevel
expanderGetResizeToplevel Source #
Arguments
| :: (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.
getUseMarkup
Arguments
| :: (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.
getUseUnderline
expanderGetUseUnderline Source #
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> m Bool | Returns:  | 
Returns whether an embedded underline in the expander label
 indicates a mnemonic. See expanderSetUseUnderline.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Text | 
 | 
| -> m Expander | Returns: a new  | 
Creates a new expander using label as the text of the label.
newWithMnemonic
expanderNewWithMnemonic Source #
Arguments
| :: (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.
setChild
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a, IsWidget b) | |
| => a | 
 | 
| -> Maybe b | 
 | 
| -> m () | 
Sets the child widget of expander.
setExpanded
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> Bool | 
 | 
| -> m () | 
setLabel
Arguments
| :: (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.
setLabelWidget
expanderSetLabelWidget Source #
Arguments
| :: (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.
setResizeToplevel
expanderSetResizeToplevel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsExpander a) | |
| => a | 
 | 
| -> Bool | 
 | 
| -> m () | 
Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collpasing.
setUseMarkup
Arguments
| :: (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.
setUseUnderline
expanderSetUseUnderline Source #
Arguments
| :: (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.
Properties
child
No description available in the introspection data.
clearExpanderChild :: (MonadIO m, IsExpander o) => o -> m () Source #
Set the value of the “child” property to Nothing.
 When overloading is enabled, this is equivalent to
clear #child
constructExpanderChild :: (IsExpander o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “child” property. This is rarely needed directly, but it is used by new.
getExpanderChild :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget) Source #
Get the value of the “child” property.
 When overloading is enabled, this is equivalent to
get expander #child
setExpanderChild :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m () Source #
Set the value of the “child” property.
 When overloading is enabled, this is equivalent to
setexpander [ #child:=value ]
expanded
No description available in the introspection data.
constructExpanderExpanded :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “expanded” property. This is rarely needed directly, but it is used by new.
getExpanderExpanded :: (MonadIO m, IsExpander o) => o -> m Bool Source #
Get the value of the “expanded” property.
 When overloading is enabled, this is equivalent to
get expander #expanded
setExpanderExpanded :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
Set the value of the “expanded” property.
 When overloading is enabled, this is equivalent to
setexpander [ #expanded:=value ]
label
No description available in the introspection data.
clearExpanderLabel :: (MonadIO m, IsExpander o) => o -> m () Source #
Set the value of the “label” property to Nothing.
 When overloading is enabled, this is equivalent to
clear #label
constructExpanderLabel :: (IsExpander o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “label” property. This is rarely needed directly, but it is used by new.
getExpanderLabel :: (MonadIO m, IsExpander o) => o -> m (Maybe Text) Source #
Get the value of the “label” property.
 When overloading is enabled, this is equivalent to
get expander #label
setExpanderLabel :: (MonadIO m, IsExpander o) => o -> Text -> m () Source #
Set the value of the “label” property.
 When overloading is enabled, this is equivalent to
setexpander [ #label:=value ]
labelWidget
No description available in the introspection data.
clearExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m () Source #
Set the value of the “label-widget” property to Nothing.
 When overloading is enabled, this is equivalent to
clear #labelWidget
constructExpanderLabelWidget :: (IsExpander o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “label-widget” property. This is rarely needed directly, but it is used by new.
getExpanderLabelWidget :: (MonadIO m, IsExpander o) => o -> m (Maybe Widget) Source #
Get the value of the “label-widget” property.
 When overloading is enabled, this is equivalent to
get expander #labelWidget
setExpanderLabelWidget :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m () Source #
Set the value of the “label-widget” property.
 When overloading is enabled, this is equivalent to
setexpander [ #labelWidget:=value ]
resizeToplevel
When this property is True, the expander will resize the toplevel
 widget containing the expander upon expanding and collapsing.
constructExpanderResizeToplevel :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “resize-toplevel” property. This is rarely needed directly, but it is used by new.
getExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> m Bool Source #
Get the value of the “resize-toplevel” property.
 When overloading is enabled, this is equivalent to
get expander #resizeToplevel
setExpanderResizeToplevel :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
Set the value of the “resize-toplevel” property.
 When overloading is enabled, this is equivalent to
setexpander [ #resizeToplevel:=value ]
useMarkup
No description available in the introspection data.
constructExpanderUseMarkup :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “use-markup” property. This is rarely needed directly, but it is used by new.
getExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> m Bool Source #
Get the value of the “use-markup” property.
 When overloading is enabled, this is equivalent to
get expander #useMarkup
setExpanderUseMarkup :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
Set the value of the “use-markup” property.
 When overloading is enabled, this is equivalent to
setexpander [ #useMarkup:=value ]
useUnderline
No description available in the introspection data.
constructExpanderUseUnderline :: (IsExpander o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “use-underline” property. This is rarely needed directly, but it is used by new.
getExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> m Bool Source #
Get the value of the “use-underline” property.
 When overloading is enabled, this is equivalent to
get expander #useUnderline
setExpanderUseUnderline :: (MonadIO m, IsExpander o) => o -> Bool -> m () Source #
Set the value of the “use-underline” property.
 When overloading is enabled, this is equivalent to
setexpander [ #useUnderline:=value ]
Signals
activate
type C_ExpanderActivateCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type ExpanderActivateCallback = IO () Source #
Activates the Expander.
afterExpanderActivate :: (IsExpander a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after expander #activate callback
genClosure_ExpanderActivate :: MonadIO m => ExpanderActivateCallback -> m (GClosure C_ExpanderActivateCallback) Source #
Wrap the callback into a GClosure.
mk_ExpanderActivateCallback :: C_ExpanderActivateCallback -> IO (FunPtr C_ExpanderActivateCallback) Source #
Generate a function pointer callable from C code, from a C_ExpanderActivateCallback.
noExpanderActivateCallback :: Maybe ExpanderActivateCallback Source #
A convenience synonym for Nothing :: Maybe ExpanderActivateCallback
onExpanderActivate :: (IsExpander a, MonadIO m) => a -> ExpanderActivateCallback -> m SignalHandlerId Source #
Connect a signal handler for the activate signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on expander #activate callback