| 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 |
GI.Gtk.Objects.ModelButton
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.
- newtype ModelButton = ModelButton (ManagedPtr ModelButton)
- class GObject o => IsModelButton o
- toModelButton :: IsModelButton o => o -> IO ModelButton
- noModelButton :: Maybe ModelButton
- modelButtonNew :: (HasCallStack, MonadIO m) => m ModelButton
- data ModelButtonActivePropertyInfo
- constructModelButtonActive :: IsModelButton o => Bool -> IO (GValueConstruct o)
- getModelButtonActive :: (MonadIO m, IsModelButton o) => o -> m Bool
- modelButtonActive :: AttrLabelProxy "active"
- setModelButtonActive :: (MonadIO m, IsModelButton o) => o -> Bool -> m ()
- data ModelButtonCenteredPropertyInfo
- constructModelButtonCentered :: IsModelButton o => Bool -> IO (GValueConstruct o)
- getModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> m Bool
- modelButtonCentered :: AttrLabelProxy "centered"
- setModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> Bool -> m ()
- data ModelButtonIconPropertyInfo
- clearModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m ()
- constructModelButtonIcon :: (IsModelButton o, IsIcon a) => a -> IO (GValueConstruct o)
- getModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m (Maybe Icon)
- modelButtonIcon :: AttrLabelProxy "icon"
- setModelButtonIcon :: (MonadIO m, IsModelButton o, IsIcon a) => o -> a -> m ()
- data ModelButtonIconicPropertyInfo
- constructModelButtonIconic :: IsModelButton o => Bool -> IO (GValueConstruct o)
- getModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> m Bool
- modelButtonIconic :: AttrLabelProxy "iconic"
- setModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> Bool -> m ()
- data ModelButtonInvertedPropertyInfo
- constructModelButtonInverted :: IsModelButton o => Bool -> IO (GValueConstruct o)
- getModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> m Bool
- modelButtonInverted :: AttrLabelProxy "inverted"
- setModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> Bool -> m ()
- data ModelButtonMenuNamePropertyInfo
- clearModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m ()
- constructModelButtonMenuName :: IsModelButton o => Text -> IO (GValueConstruct o)
- getModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text)
- modelButtonMenuName :: AttrLabelProxy "menuName"
- setModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> Text -> m ()
- data ModelButtonRolePropertyInfo
- constructModelButtonRole :: IsModelButton o => ButtonRole -> IO (GValueConstruct o)
- getModelButtonRole :: (MonadIO m, IsModelButton o) => o -> m ButtonRole
- modelButtonRole :: AttrLabelProxy "role"
- setModelButtonRole :: (MonadIO m, IsModelButton o) => o -> ButtonRole -> m ()
- data ModelButtonTextPropertyInfo
- clearModelButtonText :: (MonadIO m, IsModelButton o) => o -> m ()
- constructModelButtonText :: IsModelButton o => Text -> IO (GValueConstruct o)
- getModelButtonText :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text)
- modelButtonText :: AttrLabelProxy "text"
- setModelButtonText :: (MonadIO m, IsModelButton o) => o -> Text -> m ()
Exported types
newtype ModelButton Source #
Constructors
| ModelButton (ManagedPtr ModelButton) |
Instances
| GObject ModelButton Source # | |
| IsImplementorIface ModelButton Source # | |
| IsObject ModelButton Source # | |
| IsWidget ModelButton Source # | |
| IsContainer ModelButton Source # | |
| IsButton ModelButton Source # | |
| IsBin ModelButton Source # | |
| IsBuildable ModelButton Source # | |
| IsActivatable ModelButton Source # | |
| IsActionable ModelButton Source # | |
| IsModelButton ModelButton Source # | |
| ((~) * info (ResolveModelButtonMethod t ModelButton), MethodInfo * info ModelButton p) => IsLabel t (ModelButton -> p) Source # | |
| ((~) * info (ResolveModelButtonMethod t ModelButton), MethodInfo * info ModelButton p) => IsLabelProxy t (ModelButton -> p) Source # | |
| HasAttributeList * ModelButton Source # | |
| type AttributeList ModelButton Source # | |
| type SignalList ModelButton Source # | |
class GObject o => IsModelButton o Source #
Instances
toModelButton :: IsModelButton o => o -> IO ModelButton Source #
Methods
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m ModelButton | Returns: the newly created |
Creates a new GtkModelButton.
Since: 3.16
Properties
active
data ModelButtonActivePropertyInfo Source #
Instances
constructModelButtonActive :: IsModelButton o => Bool -> IO (GValueConstruct o) Source #
getModelButtonActive :: (MonadIO m, IsModelButton o) => o -> m Bool Source #
modelButtonActive :: AttrLabelProxy "active" Source #
setModelButtonActive :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #
centered
data ModelButtonCenteredPropertyInfo Source #
Instances
constructModelButtonCentered :: IsModelButton o => Bool -> IO (GValueConstruct o) Source #
getModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> m Bool Source #
modelButtonCentered :: AttrLabelProxy "centered" Source #
setModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #
icon
data ModelButtonIconPropertyInfo Source #
Instances
clearModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m () Source #
constructModelButtonIcon :: (IsModelButton o, IsIcon a) => a -> IO (GValueConstruct o) Source #
getModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m (Maybe Icon) Source #
modelButtonIcon :: AttrLabelProxy "icon" Source #
setModelButtonIcon :: (MonadIO m, IsModelButton o, IsIcon a) => o -> a -> m () Source #
iconic
data ModelButtonIconicPropertyInfo Source #
Instances
constructModelButtonIconic :: IsModelButton o => Bool -> IO (GValueConstruct o) Source #
getModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> m Bool Source #
modelButtonIconic :: AttrLabelProxy "iconic" Source #
setModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #
inverted
data ModelButtonInvertedPropertyInfo Source #
Instances
constructModelButtonInverted :: IsModelButton o => Bool -> IO (GValueConstruct o) Source #
getModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> m Bool Source #
modelButtonInverted :: AttrLabelProxy "inverted" Source #
setModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #
menuName
data ModelButtonMenuNamePropertyInfo Source #
Instances
clearModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m () Source #
constructModelButtonMenuName :: IsModelButton o => Text -> IO (GValueConstruct o) Source #
getModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text) Source #
modelButtonMenuName :: AttrLabelProxy "menuName" Source #
setModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> Text -> m () Source #
role
data ModelButtonRolePropertyInfo Source #
Instances
constructModelButtonRole :: IsModelButton o => ButtonRole -> IO (GValueConstruct o) Source #
getModelButtonRole :: (MonadIO m, IsModelButton o) => o -> m ButtonRole Source #
modelButtonRole :: AttrLabelProxy "role" Source #
setModelButtonRole :: (MonadIO m, IsModelButton o) => o -> ButtonRole -> m () Source #
text
data ModelButtonTextPropertyInfo Source #
Instances
clearModelButtonText :: (MonadIO m, IsModelButton o) => o -> m () Source #
constructModelButtonText :: IsModelButton o => Text -> IO (GValueConstruct o) Source #
getModelButtonText :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text) Source #
modelButtonText :: AttrLabelProxy "text" Source #
setModelButtonText :: (MonadIO m, IsModelButton o) => o -> Text -> m () Source #