gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Interfaces.Actionable

Contents

- Exported types
- Methods
  - getActionName
  - getActionTargetValue
  - setActionName
  - setActionTargetValue
  - setDetailedActionName
- Properties
  - actionName
  - actionTarget

Description

Provides a way to associate widgets with actions.

It primarily consists of two properties: Actionable:actionName and Actionable:actionTarget. There are also some convenience APIs for setting these properties.

The action will be looked up in action groups that are found among the widgets ancestors. Most commonly, these will be the actions with the “win.” or “app.” prefix that are associated with the `GtkApplicationWindow` or `GtkApplication`, but other action groups that are added with `widgetInsertActionGroup` will be consulted as well.

Synopsis

- newtype Actionable = Actionable (ManagedPtr Actionable)
- class (GObject o, IsDescendantOf Actionable o) => IsActionable o
- toActionable :: (MonadIO m, IsActionable o) => o -> m Actionable
- actionableGetActionName :: (HasCallStack, MonadIO m, IsActionable a) => a -> m (Maybe Text)
- actionableGetActionTargetValue :: (HasCallStack, MonadIO m, IsActionable a) => a -> m (Maybe GVariant)
- actionableSetActionName :: (HasCallStack, MonadIO m, IsActionable a) => a -> Maybe Text -> m ()
- actionableSetActionTargetValue :: (HasCallStack, MonadIO m, IsActionable a) => a -> Maybe GVariant -> m ()
- actionableSetDetailedActionName :: (HasCallStack, MonadIO m, IsActionable a) => a -> Text -> m ()
- clearActionableActionName :: (MonadIO m, IsActionable o) => o -> m ()
- constructActionableActionName :: (IsActionable o, MonadIO m) => Text -> m (GValueConstruct o)
- getActionableActionName :: (MonadIO m, IsActionable o) => o -> m (Maybe Text)
- setActionableActionName :: (MonadIO m, IsActionable o) => o -> Text -> m ()
- clearActionableActionTarget :: (MonadIO m, IsActionable o) => o -> m ()
- constructActionableActionTarget :: (IsActionable o, MonadIO m) => GVariant -> m (GValueConstruct o)
- getActionableActionTarget :: (MonadIO m, IsActionable o) => o -> m (Maybe GVariant)
- setActionableActionTarget :: (MonadIO m, IsActionable o) => o -> GVariant -> m ()

# Exported types

newtype Actionable Source #

Memory-managed wrapper type.

Constructors

Actionable (ManagedPtr Actionable) |

#### Instances

Instances details

Eq Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable Methods (==) :: Actionable -> Actionable -> Bool Source # (/=) :: Actionable -> Actionable -> Bool Source #
GObject Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable
ManagedPtrNewtype Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable Methods toManagedPtr :: Actionable -> ManagedPtr Actionable Source #
TypedObject Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable Methods glibType :: IO GType Source #
HasParentTypes Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable
IsGValue (Maybe Actionable) Source # | Convert `Actionable` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Interfaces.Actionable Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Actionable -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Actionable) Source #
type ParentTypes Actionable Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable type ParentTypes Actionable = '[Object, Widget]

class (GObject o, IsDescendantOf Actionable o) => IsActionable o Source #

Type class for types which can be safely cast to `Actionable`, for instance with `toActionable`.

#### Instances

Instances details

(GObject o, IsDescendantOf Actionable o) => IsActionable o Source # |
Instance details Defined in GI.Gtk.Interfaces.Actionable

toActionable :: (MonadIO m, IsActionable o) => o -> m Actionable Source #

Cast to `Actionable`, 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

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, 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, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getActionName, getActionTargetValue, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setActionName, setActionTargetValue, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDetailedActionName, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## getActionName

actionableGetActionName Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionable a) |
=> a | `actionable`: a `GtkActionable` widget
-> m (Maybe Text) | Returns: the action name

Gets the action name for `actionable`.

## getActionTargetValue

actionableGetActionTargetValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionable a) |
=> a | `actionable`: a `GtkActionable` widget
-> m (Maybe GVariant) | Returns: the current target value

Gets the current target value of `actionable`.

## setActionName

actionableSetActionName Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionable a) |
=> a | `actionable`: a `GtkActionable` widget
-> Maybe Text | `actionName`: an action name
-> m () |

Specifies the name of the action with which this widget should be associated.

If `actionName` is `Nothing` then the widget will be unassociated from any previous action.

Usually this function is used when the widget is located (or will be located) within the hierarchy of a `GtkApplicationWindow`.

Names are of the form “win.save” or “app.quit” for actions on the containing [class`applicationWindow`] or its associated [class`application`], respectively. This is the same form used for actions in the `Menu` associated with the window.

## setActionTargetValue

actionableSetActionTargetValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionable a) |
=> a | `actionable`: a `GtkActionable` widget
-> Maybe GVariant | `targetValue`: a `GVariant` to set as the target value
-> m () |

Sets the target value of an actionable widget.

If `targetValue` is `Nothing` then the target value is unset.

The target value has two purposes. First, it is used as the parameter to activation of the action associated with the `GtkActionable` widget. Second, it is used to determine if the widget should be rendered as “active” — the widget is active if the state is equal to the given target.

Consider the example of associating a set of buttons with a `Action` with string state in a typical “radio button” situation. Each button will be associated with the same action, but with a different target value for that action. Clicking on a particular button will activate the action with the target of that button, which will typically cause the action’s state to change to that value. Since the action’s state is now equal to the target value of the button, the button will now be rendered as active (and the other buttons, with different targets, rendered inactive).

## setDetailedActionName

actionableSetDetailedActionName Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionable a) |
=> a | `actionable`: a `GtkActionable` widget
-> Text | `detailedActionName`: the detailed action name
-> m () |

Sets the action-name and associated string target value of an actionable widget.

`detailedActionName` is a string in the format accepted by `actionParseDetailedName`.

# Properties

## actionName

The name of the action with which this widget should be associated.

clearActionableActionName :: (MonadIO m, IsActionable o) => o -> m () Source #

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

    clear #actionName

constructActionableActionName :: (IsActionable o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getActionableActionName :: (MonadIO m, IsActionable o) => o -> m (Maybe Text) Source #

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

    get actionable #actionName

setActionableActionName :: (MonadIO m, IsActionable o) => o -> Text -> m () Source #

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

    set actionable [ #actionName := value ]

## actionTarget

The target value of the actionable widget's action.

clearActionableActionTarget :: (MonadIO m, IsActionable o) => o -> m () Source #

Set the value of the “`action-target`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #actionTarget

constructActionableActionTarget :: (IsActionable o, MonadIO m) => GVariant -> m (GValueConstruct o) Source #

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

getActionableActionTarget :: (MonadIO m, IsActionable o) => o -> m (Maybe GVariant) Source #

Get the value of the “`action-target`” property. When overloading is enabled, this is equivalent to

    get actionable #actionTarget

setActionableActionTarget :: (MonadIO m, IsActionable o) => o -> GVariant -> m () Source #

Set the value of the “`action-target`” property. When overloading is enabled, this is equivalent to

    set actionable [ #actionTarget := value ]