gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.Expander

Contents

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 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.

Synopsis

Exported types

Methods

getExpanded

expanderGetExpanded Source #

Arguments

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

expander: a Expander

-> 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

expanderGetLabel Source #

Arguments

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

expander: a Expander

-> 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

expanderGetLabelFill Source #

Arguments

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

expander: a Expander

-> m Bool

Returns: True if the label widget will fill all available horizontal space

Returns whether the label widget will fill all available horizontal space allocated to expander.

Since: 2.22

getLabelWidget

expanderGetLabelWidget Source #

Arguments

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

expander: a Expander

-> m (Maybe Widget)

Returns: the label widget, or Nothing if there is none

Retrieves the label widget for the frame. See expanderSetLabelWidget.

Since: 2.4

getResizeToplevel

expanderGetResizeToplevel Source #

Arguments

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

expander: a Expander

-> 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

expanderGetSpacing Source #

Arguments

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

expander: a Expander

-> 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

expanderGetUseMarkup Source #

Arguments

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

expander: a Expander

-> m Bool

Returns: True if the label’s text will be parsed for markup

Returns whether the label’s text is interpreted as marked up with the [Pango text markup language][PangoMarkupFormat]. See expanderSetUseMarkup.

Since: 2.4

getUseUnderline

expanderGetUseUnderline Source #

Arguments

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

expander: a Expander

-> m Bool

Returns: True if an embedded underline in the expander label indicates the mnemonic accelerator keys

Returns whether an embedded underline in the expander label indicates a mnemonic. See expanderSetUseUnderline.

Since: 2.4

new

expanderNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

label: the text of the label

-> m Expander

Returns: a new Expander widget.

Creates a new expander using label as the text of the label.

Since: 2.4

newWithMnemonic

expanderNewWithMnemonic Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

label: the text of the label with an underscore in front of the mnemonic character

-> m Expander

Returns: a new Expander widget.

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

expanderSetExpanded Source #

Arguments

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

expander: a Expander

-> Bool

expanded: whether the child widget is revealed

-> m () 

Sets the state of the expander. Set to True, if you want the child widget to be revealed, and False if you want the child widget to be hidden.

Since: 2.4

setLabel

data ExpanderSetLabelMethodInfo Source #

Instances

((~) * signature (Maybe Text -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetLabelMethodInfo a signature Source # 

expanderSetLabel Source #

Arguments

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

expander: a Expander

-> Maybe Text

label: a string

-> m () 

Sets the text of the label of the expander to label.

This will also clear any previously set labels.

Since: 2.4

setLabelFill

expanderSetLabelFill Source #

Arguments

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

expander: a Expander

-> Bool

labelFill: True if the label should should fill all available horizontal space

-> m () 

Sets whether the label widget should fill all available horizontal space allocated to expander.

Since: 2.22

setLabelWidget

expanderSetLabelWidget Source #

Arguments

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

expander: a Expander

-> Maybe b

labelWidget: the new label widget

-> m () 

Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.

Since: 2.4

setResizeToplevel

expanderSetResizeToplevel Source #

Arguments

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

expander: a Expander

-> Bool

resizeToplevel: whether to resize the toplevel

-> m () 

Sets whether the expander will resize the toplevel widget containing the expander upon resizing and collpasing.

Since: 3.2

setSpacing

data ExpanderSetSpacingMethodInfo Source #

Instances

((~) * signature (Int32 -> m ()), MonadIO m, IsExpander a) => MethodInfo * ExpanderSetSpacingMethodInfo a signature Source # 

expanderSetSpacing Source #

Arguments

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

expander: a Expander

-> Int32

spacing: distance between the expander and child in pixels

-> 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

expanderSetUseMarkup Source #

Arguments

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

expander: a Expander

-> Bool

useMarkup: True if the label’s text should be parsed for markup

-> m () 

Sets whether the text of the label contains markup in [Pango’s text markup language][PangoMarkupFormat]. See labelSetMarkup.

Since: 2.4

setUseUnderline

expanderSetUseUnderline Source #

Arguments

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

expander: a Expander

-> Bool

useUnderline: True if underlines in the text indicate mnemonics

-> 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 #

Instances

AttrInfo ExpanderExpandedPropertyInfo Source # 
type AttrOrigin ExpanderExpandedPropertyInfo Source # 
type AttrLabel ExpanderExpandedPropertyInfo Source # 
type AttrGetType ExpanderExpandedPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderExpandedPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderExpandedPropertyInfo Source # 
type AttrAllowedOps ExpanderExpandedPropertyInfo Source # 

label

data ExpanderLabelPropertyInfo Source #

Instances

AttrInfo ExpanderLabelPropertyInfo Source # 
type AttrOrigin ExpanderLabelPropertyInfo Source # 
type AttrLabel ExpanderLabelPropertyInfo Source # 
type AttrGetType ExpanderLabelPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderLabelPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderLabelPropertyInfo Source # 
type AttrAllowedOps ExpanderLabelPropertyInfo Source # 

setExpanderLabel :: (MonadIO m, IsExpander o) => o -> Text -> m () Source #

labelFill

data ExpanderLabelFillPropertyInfo Source #

Instances

AttrInfo ExpanderLabelFillPropertyInfo Source # 
type AttrOrigin ExpanderLabelFillPropertyInfo Source # 
type AttrLabel ExpanderLabelFillPropertyInfo Source # 
type AttrGetType ExpanderLabelFillPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderLabelFillPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderLabelFillPropertyInfo Source # 
type AttrAllowedOps ExpanderLabelFillPropertyInfo Source # 

labelWidget

data ExpanderLabelWidgetPropertyInfo Source #

Instances

AttrInfo ExpanderLabelWidgetPropertyInfo Source # 
type AttrOrigin ExpanderLabelWidgetPropertyInfo Source # 
type AttrLabel ExpanderLabelWidgetPropertyInfo Source # 
type AttrGetType ExpanderLabelWidgetPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderLabelWidgetPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderLabelWidgetPropertyInfo Source # 
type AttrAllowedOps ExpanderLabelWidgetPropertyInfo Source # 

setExpanderLabelWidget :: (MonadIO m, IsExpander o, IsWidget a) => o -> a -> m () Source #

resizeToplevel

data ExpanderResizeToplevelPropertyInfo Source #

Instances

AttrInfo ExpanderResizeToplevelPropertyInfo Source # 
type AttrOrigin ExpanderResizeToplevelPropertyInfo Source # 
type AttrLabel ExpanderResizeToplevelPropertyInfo Source # 
type AttrGetType ExpanderResizeToplevelPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderResizeToplevelPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderResizeToplevelPropertyInfo Source # 
type AttrAllowedOps ExpanderResizeToplevelPropertyInfo Source # 

spacing

data ExpanderSpacingPropertyInfo Source #

Instances

AttrInfo ExpanderSpacingPropertyInfo Source # 
type AttrOrigin ExpanderSpacingPropertyInfo Source # 
type AttrLabel ExpanderSpacingPropertyInfo Source # 
type AttrGetType ExpanderSpacingPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderSpacingPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderSpacingPropertyInfo Source # 
type AttrAllowedOps ExpanderSpacingPropertyInfo Source # 

useMarkup

data ExpanderUseMarkupPropertyInfo Source #

Instances

AttrInfo ExpanderUseMarkupPropertyInfo Source # 
type AttrOrigin ExpanderUseMarkupPropertyInfo Source # 
type AttrLabel ExpanderUseMarkupPropertyInfo Source # 
type AttrGetType ExpanderUseMarkupPropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderUseMarkupPropertyInfo Source # 
type AttrSetTypeConstraint ExpanderUseMarkupPropertyInfo Source # 
type AttrAllowedOps ExpanderUseMarkupPropertyInfo Source # 

useUnderline

data ExpanderUseUnderlinePropertyInfo Source #

Instances

AttrInfo ExpanderUseUnderlinePropertyInfo Source # 
type AttrOrigin ExpanderUseUnderlinePropertyInfo Source # 
type AttrLabel ExpanderUseUnderlinePropertyInfo Source # 
type AttrGetType ExpanderUseUnderlinePropertyInfo Source # 
type AttrBaseTypeConstraint ExpanderUseUnderlinePropertyInfo Source # 
type AttrSetTypeConstraint ExpanderUseUnderlinePropertyInfo Source # 
type AttrAllowedOps ExpanderUseUnderlinePropertyInfo Source # 

Signals

activate