gi-gtk-3.0.41: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

newtype ModelButton Source #

Memory-managed wrapper type.

Constructors

ModelButton (ManagedPtr ModelButton) 

Instances

Instances details
Eq ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

GObject ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

ManagedPtrNewtype ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

Methods

toManagedPtr :: ModelButton -> ManagedPtr ModelButton

TypedObject ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

Methods

glibType :: IO GType

HasParentTypes ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

IsGValue (Maybe ModelButton) Source #

Convert ModelButton to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.ModelButton

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe ModelButton -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe ModelButton)

type ParentTypes ModelButton Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

type ParentTypes ModelButton = '[Button, Bin, Container, Widget, Object, ImplementorIface, Actionable, Activatable, Buildable]

class (GObject o, IsDescendantOf ModelButton o) => IsModelButton o Source #

Type class for types which can be safely cast to ModelButton, for instance with toModelButton.

Instances

Instances details
(GObject o, IsDescendantOf ModelButton o) => IsModelButton o Source # 
Instance details

Defined in GI.Gtk.Objects.ModelButton

toModelButton :: (MonadIO m, IsModelButton o) => o -> m ModelButton Source #

Cast to ModelButton, for types for which this is known to be safe. For general casts, use castTo.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, clicked, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, doSetRelatedAction, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, enter, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, leave, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, pressed, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, released, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, syncActionProperties, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.

Getters

getAccessible, getActionGroup, getActionName, getActionTargetValue, getAlignment, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAlwaysShowImage, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEventWindow, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getImage, getImagePosition, getInternalChild, getLabel, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRelatedAction, getRelief, getRequestMode, getRequisition, getResizeMode, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getUseActionAppearance, getUseStock, getUseUnderline, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.

Setters

setAccelPath, setActionName, setActionTargetValue, setAlignment, setAllocation, setAlwaysShowImage, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDetailedActionName, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setImage, setImagePosition, setLabel, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setRelatedAction, setRelief, setResizeMode, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setUseActionAppearance, setUseStock, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.

new

modelButtonNew Source #

Arguments

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

Returns: the newly created ModelButton widget

Creates a new GtkModelButton.

Since: 3.16

Properties

active

The state of the button. This is reflecting the state of the associated Action.

Since: 3.16

constructModelButtonActive :: (IsModelButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “active” property. This is rarely needed directly, but it is used by new.

getModelButtonActive :: (MonadIO m, IsModelButton o) => o -> m Bool Source #

Get the value of the “active” property. When overloading is enabled, this is equivalent to

get modelButton #active

setModelButtonActive :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #

Set the value of the “active” property. When overloading is enabled, this is equivalent to

set modelButton [ #active := value ]

centered

Whether to render the button contents centered instead of left-aligned. This property should be set for title-like items.

Since: 3.16

constructModelButtonCentered :: (IsModelButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “centered” property. This is rarely needed directly, but it is used by new.

getModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> m Bool Source #

Get the value of the “centered” property. When overloading is enabled, this is equivalent to

get modelButton #centered

setModelButtonCentered :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #

Set the value of the “centered” property. When overloading is enabled, this is equivalent to

set modelButton [ #centered := value ]

icon

A Icon that will be used if iconic appearance for the button is desired.

Since: 3.16

clearModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m () Source #

Set the value of the “icon” property to Nothing. When overloading is enabled, this is equivalent to

clear #icon

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

Construct a GValueConstruct with valid value for the “icon” property. This is rarely needed directly, but it is used by new.

getModelButtonIcon :: (MonadIO m, IsModelButton o) => o -> m (Maybe Icon) Source #

Get the value of the “icon” property. When overloading is enabled, this is equivalent to

get modelButton #icon

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

Set the value of the “icon” property. When overloading is enabled, this is equivalent to

set modelButton [ #icon := value ]

iconic

If this property is set, the button will show an icon if one is set. If no icon is set, the text will be used. This is typically used for horizontal sections of linked buttons.

Since: 3.16

constructModelButtonIconic :: (IsModelButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “iconic” property. This is rarely needed directly, but it is used by new.

getModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> m Bool Source #

Get the value of the “iconic” property. When overloading is enabled, this is equivalent to

get modelButton #iconic

setModelButtonIconic :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #

Set the value of the “iconic” property. When overloading is enabled, this is equivalent to

set modelButton [ #iconic := value ]

inverted

Whether to show the submenu indicator at the opposite side than normal. This property should be set for model buttons that 'go back' to a parent menu.

Since: 3.16

constructModelButtonInverted :: (IsModelButton o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “inverted” property. This is rarely needed directly, but it is used by new.

getModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> m Bool Source #

Get the value of the “inverted” property. When overloading is enabled, this is equivalent to

get modelButton #inverted

setModelButtonInverted :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #

Set the value of the “inverted” property. When overloading is enabled, this is equivalent to

set modelButton [ #inverted := value ]

menuName

The name of a submenu to open when the button is activated. If this is set, the button should not have an action associated with it.

Since: 3.16

clearModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m () Source #

Set the value of the “menu-name” property to Nothing. When overloading is enabled, this is equivalent to

clear #menuName

constructModelButtonMenuName :: (IsModelButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “menu-name” property. This is rarely needed directly, but it is used by new.

getModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text) Source #

Get the value of the “menu-name” property. When overloading is enabled, this is equivalent to

get modelButton #menuName

setModelButtonMenuName :: (MonadIO m, IsModelButton o) => o -> Text -> m () Source #

Set the value of the “menu-name” property. When overloading is enabled, this is equivalent to

set modelButton [ #menuName := value ]

role

Specifies whether the button is a plain, check or radio button. When Actionable:action-name is set, the role will be determined from the action and does not have to be set explicitly.

Since: 3.16

constructModelButtonRole :: (IsModelButton o, MonadIO m) => ButtonRole -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “role” property. This is rarely needed directly, but it is used by new.

getModelButtonRole :: (MonadIO m, IsModelButton o) => o -> m ButtonRole Source #

Get the value of the “role” property. When overloading is enabled, this is equivalent to

get modelButton #role

setModelButtonRole :: (MonadIO m, IsModelButton o) => o -> ButtonRole -> m () Source #

Set the value of the “role” property. When overloading is enabled, this is equivalent to

set modelButton [ #role := value ]

text

The label for the button.

Since: 3.16

clearModelButtonText :: (MonadIO m, IsModelButton o) => o -> m () Source #

Set the value of the “text” property to Nothing. When overloading is enabled, this is equivalent to

clear #text

constructModelButtonText :: (IsModelButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “text” property. This is rarely needed directly, but it is used by new.

getModelButtonText :: (MonadIO m, IsModelButton o) => o -> m (Maybe Text) Source #

Get the value of the “text” property. When overloading is enabled, this is equivalent to

get modelButton #text

setModelButtonText :: (MonadIO m, IsModelButton o) => o -> Text -> m () Source #

Set the value of the “text” property. When overloading is enabled, this is equivalent to

set modelButton [ #text := value ]

useMarkup

If True, XML tags in the text of the button are interpreted as by parseMarkup to format the enclosed spans of text. If False, the text will be displayed verbatim.

Since: 3.24

constructModelButtonUseMarkup :: (IsModelButton 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.

getModelButtonUseMarkup :: (MonadIO m, IsModelButton o) => o -> m Bool Source #

Get the value of the “use-markup” property. When overloading is enabled, this is equivalent to

get modelButton #useMarkup

setModelButtonUseMarkup :: (MonadIO m, IsModelButton o) => o -> Bool -> m () Source #

Set the value of the “use-markup” property. When overloading is enabled, this is equivalent to

set modelButton [ #useMarkup := value ]