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

Contents

Description

GtkModelButton is a button class that can use a Action as its model. In contrast to ToggleButton or RadioButton, which can also be backed by a Action via the Actionable:action-name property, GtkModelButton will adapt its appearance according to the kind of action it is backed by, and appear either as a plain, check or radio button.

Model buttons are used when popovers from a menu model with popoverNewFromModel; they can also be used manually in a PopoverMenu.

When the action is specified via the Actionable:action-name and Actionable:action-target properties, the role of the button (i.e. whether it is a plain, check or radio button) is determined by the type of the action and doesn't have to be explicitly specified with the ModelButton:role property.

The content of the button is specified by the ModelButton:text and ModelButton:icon properties.

The appearance of model buttons can be influenced with the ModelButton:centered and ModelButton:iconic properties.

Model buttons have built-in support for submenus in PopoverMenu. To make a GtkModelButton that opens a submenu when activated, set the ModelButton:menu-name property. To make a button that goes back to the parent menu, you should set the ModelButton:inverted property to place the submenu indicator at the opposite side.

Example

<object class="GtkPopoverMenu">
  <child>
    <object class="GtkBox">
      <property name="visible">True</property>
      <property name="margin">10</property>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">view.cut</property>
          <property name="text" translatable="yes">Cut</property>
        </object>
      </child>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">view.copy</property>
          <property name="text" translatable="yes">Copy</property>
        </object>
      </child>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">view.paste</property>
          <property name="text" translatable="yes">Paste</property>
        </object>
      </child>
    </object>
  </child>
</object>

CSS nodes

plain code

modelbutton
├── <child>
╰── check

plain code

modelbutton
├── <child>
╰── radio

plain code

modelbutton
├── <child>
╰── arrow

GtkModelButton has a main CSS node with name modelbutton, and a subnode, which will have the name check, radio or arrow, depending on the role of the button and whether it has a menu name set.

The subnode is positioned before or after the content nodes and gets the .left or .right style class, depending on where it is located.

plain code

button.model
├── <child>
╰── check

Iconic model buttons (see ModelButton:iconic) change the name of their main node to button and add a .model style class to it. The indicator subnode is invisible in this case.

Synopsis

Exported types

Methods

new

modelButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ModelButton

Returns: the newly created ModelButton widget

Creates a new GtkModelButton.

Since: 3.16

Properties

active

data ModelButtonActivePropertyInfo Source #

Instances

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

centered

data ModelButtonCenteredPropertyInfo Source #

Instances

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

icon

data ModelButtonIconPropertyInfo Source #

Instances

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

setModelButtonIcon :: (MonadIO m, IsModelButton o, IsIcon a) => o -> a -> m () Source #

iconic

data ModelButtonIconicPropertyInfo Source #

Instances

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

inverted

data ModelButtonInvertedPropertyInfo Source #

Instances

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

menuName

data ModelButtonMenuNamePropertyInfo Source #

Instances

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

role

data ModelButtonRolePropertyInfo Source #

Instances

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

text

data ModelButtonTextPropertyInfo Source #

Instances

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