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

Description

Actions are organised into groups. An action group is essentially a map from names to Action objects.

All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window’s menus would be constructed from a combination of two action groups.

## Accelerators ## {Action-Accel}

Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form <Actions>/group-name/action-name) and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item.

# GtkActionGroup as GtkBuildable # {tActionGroup-BUILDER-UI}

The ActionGroup implementation of the Buildable interface accepts Action objects as <child> elements in UI definitions.

Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do.

The GtkActionGroup implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named “key“ and “modifiers“ and allows to specify accelerators. This is similar to the <accelerator> element of Widget, the main difference is that it doesn’t allow you to specify a signal.

## A Dialog UI definition fragment. ##

xml code

<object class="GtkActionGroup" id="actiongroup">
  <child>
      <object class="GtkAction" id="About">
          <property name="name">About</property>
          <property name="stock_id">gtk-about</property>
          <signal handler="about_activate" name="activate"/>
      </object>
      <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
  </child>
</object>
Synopsis

Exported types

newtype ActionGroup Source #

Memory-managed wrapper type.

Constructors

ActionGroup (ManagedPtr ActionGroup) 

Instances

Instances details
Eq ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

GObject ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

ManagedPtrNewtype ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

Methods

toManagedPtr :: ActionGroup -> ManagedPtr ActionGroup

TypedObject ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

Methods

glibType :: IO GType

HasParentTypes ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

IsGValue (Maybe ActionGroup) Source #

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

Instance details

Defined in GI.Gtk.Objects.ActionGroup

Methods

gvalueGType_ :: IO GType

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

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

type ParentTypes ActionGroup Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

type ParentTypes ActionGroup = '[Object, Buildable]

class (GObject o, IsDescendantOf ActionGroup o) => IsActionGroup o Source #

Type class for types which can be safely cast to ActionGroup, for instance with toActionGroup.

Instances

Instances details
(GObject o, IsDescendantOf ActionGroup o) => IsActionGroup o Source # 
Instance details

Defined in GI.Gtk.Objects.ActionGroup

toActionGroup :: (MonadIO m, IsActionGroup o) => o -> m ActionGroup Source #

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

Methods

addAction

actionGroupAddAction Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionGroup a, IsAction b) 
=> a

actionGroup: the action group

-> b

action: an action

-> m () 

Deprecated: (Since version 3.10)

Adds an action object to the action group. Note that this function does not set up the accel path of the action, which can lead to problems if a user tries to modify the accelerator of a menuitem associated with the action. Therefore you must either set the accel path yourself with actionSetAccelPath, or use gtk_action_group_add_action_with_accel (..., NULL).

Since: 2.4

addActionWithAccel

actionGroupAddActionWithAccel Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionGroup a, IsAction b) 
=> a

actionGroup: the action group

-> b

action: the action to add

-> Maybe Text

accelerator: the accelerator for the action, in the format understood by acceleratorParse, or "" for no accelerator, or Nothing to use the stock accelerator

-> m () 

Deprecated: (Since version 3.10)

Adds an action object to the action group and sets up the accelerator.

If accelerator is Nothing, attempts to use the accelerator associated with the stock_id of the action.

Accel paths are set to <Actions>/group-name/action-name.

Since: 2.4

getAccelGroup

actionGroupGetAccelGroup Source #

Arguments

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

actionGroup: a ActionGroup

-> m AccelGroup

Returns: the accelerator group associated with this action group or Nothing if there is none.

Deprecated: (Since version 3.10)

Gets the accelerator group.

Since: 3.6

getAction

actionGroupGetAction Source #

Arguments

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

actionGroup: the action group

-> Text

actionName: the name of the action

-> m (Maybe Action)

Returns: the action, or Nothing if no action by that name exists

Deprecated: (Since version 3.10)

Looks up an action in the action group by name.

Since: 2.4

getName

actionGroupGetName Source #

Arguments

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

actionGroup: the action group

-> m Text

Returns: the name of the action group.

Deprecated: (Since version 3.10)

Gets the name of the action group.

Since: 2.4

getSensitive

actionGroupGetSensitive Source #

Arguments

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

actionGroup: the action group

-> m Bool

Returns: True if the group is sensitive.

Deprecated: (Since version 3.10)

Returns True if the group is sensitive. The constituent actions can only be logically sensitive (see actionIsSensitive) if they are sensitive (see actionGetSensitive) and their group is sensitive.

Since: 2.4

getVisible

actionGroupGetVisible Source #

Arguments

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

actionGroup: the action group

-> m Bool

Returns: True if the group is visible.

Deprecated: (Since version 3.10)

Returns True if the group is visible. The constituent actions can only be logically visible (see actionIsVisible) if they are visible (see actionGetVisible) and their group is visible.

Since: 2.4

listActions

actionGroupListActions Source #

Arguments

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

actionGroup: the action group

-> m [Action]

Returns: an allocated list of the action objects in the action group

Deprecated: (Since version 3.10)

Lists the actions in the action group.

Since: 2.4

new

actionGroupNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: the name of the action group.

-> m ActionGroup

Returns: the new ActionGroup

Deprecated: (Since version 3.10)

Creates a new ActionGroup object. The name of the action group is used when associating [keybindings][Action-Accel] with the actions.

Since: 2.4

removeAction

actionGroupRemoveAction Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionGroup a, IsAction b) 
=> a

actionGroup: the action group

-> b

action: an action

-> m () 

Deprecated: (Since version 3.10)

Removes an action object from the action group.

Since: 2.4

setAccelGroup

actionGroupSetAccelGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsActionGroup a, IsAccelGroup b) 
=> a

actionGroup: a ActionGroup

-> Maybe b

accelGroup: a AccelGroup to set or Nothing

-> m () 

Deprecated: (Since version 3.10)

Sets the accelerator group to be used by every action in this group.

Since: 3.6

setSensitive

actionGroupSetSensitive Source #

Arguments

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

actionGroup: the action group

-> Bool

sensitive: new sensitivity

-> m () 

Deprecated: (Since version 3.10)

Changes the sensitivity of actionGroup

Since: 2.4

setTranslateFunc

actionGroupSetTranslateFunc Source #

Arguments

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

actionGroup: a ActionGroup

-> TranslateFunc

func: a TranslateFunc

-> m () 

Deprecated: (Since version 3.10)

Sets a function to be used for translating the label and tooltip of GtkActionEntrys added by gtk_action_group_add_actions().

If you’re using gettext(), it is enough to set the translation domain with actionGroupSetTranslationDomain.

Since: 2.4

setTranslationDomain

actionGroupSetTranslationDomain Source #

Arguments

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

actionGroup: a ActionGroup

-> Maybe Text

domain: the translation domain to use for dgettext calls, or Nothing to use the domain set with textdomain()

-> m () 

Deprecated: (Since version 3.10)

Sets the translation domain and uses dgettext for translating the label and tooltip of GtkActionEntrys added by gtk_action_group_add_actions().

If you’re not using gettext() for localization, see actionGroupSetTranslateFunc.

Since: 2.4

setVisible

actionGroupSetVisible Source #

Arguments

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

actionGroup: the action group

-> Bool

visible: new visiblity

-> m () 

Deprecated: (Since version 3.10)

Changes the visible of actionGroup.

Since: 2.4

translateString

actionGroupTranslateString Source #

Arguments

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

actionGroup: a ActionGroup

-> Text

string: a string

-> m Text

Returns: the translation of string

Deprecated: (Since version 3.10)

Translates a string using the function set with actionGroupSetTranslateFunc. This is mainly intended for language bindings.

Since: 2.6

Properties

accelGroup

The accelerator group the actions of this group should use.

clearActionGroupAccelGroup :: (MonadIO m, IsActionGroup o) => o -> m () Source #

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

clear #accelGroup

constructActionGroupAccelGroup :: (IsActionGroup o, MonadIO m, IsAccelGroup a) => a -> m (GValueConstruct o) Source #

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

getActionGroupAccelGroup :: (MonadIO m, IsActionGroup o) => o -> m AccelGroup Source #

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

get actionGroup #accelGroup

setActionGroupAccelGroup :: (MonadIO m, IsActionGroup o, IsAccelGroup a) => o -> a -> m () Source #

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

set actionGroup [ #accelGroup := value ]

name

A name for the action.

constructActionGroupName :: (IsActionGroup o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getActionGroupName :: (MonadIO m, IsActionGroup o) => o -> m Text Source #

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

get actionGroup #name

sensitive

Whether the action group is enabled.

constructActionGroupSensitive :: (IsActionGroup o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getActionGroupSensitive :: (MonadIO m, IsActionGroup o) => o -> m Bool Source #

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

get actionGroup #sensitive

setActionGroupSensitive :: (MonadIO m, IsActionGroup o) => o -> Bool -> m () Source #

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

set actionGroup [ #sensitive := value ]

visible

Whether the action group is visible.

constructActionGroupVisible :: (IsActionGroup o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getActionGroupVisible :: (MonadIO m, IsActionGroup o) => o -> m Bool Source #

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

get actionGroup #visible

setActionGroupVisible :: (MonadIO m, IsActionGroup o) => o -> Bool -> m () Source #

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

set actionGroup [ #visible := value ]

Signals

connectProxy

type ActionGroupConnectProxyCallback Source #

Arguments

 = Action

action: the action

-> Widget

proxy: the proxy

-> IO () 

Deprecated: (Since version 3.10)

The connectProxy signal is emitted after connecting a proxy to an action in the group. Note that the proxy may have been connected to a different action before.

This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar.

UIManager proxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.

Since: 2.4

afterActionGroupConnectProxy :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupConnectProxyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the connectProxy signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #connectProxy callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onActionGroupConnectProxy :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupConnectProxyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the connectProxy signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on actionGroup #connectProxy callback

disconnectProxy

type ActionGroupDisconnectProxyCallback Source #

Arguments

 = Action

action: the action

-> Widget

proxy: the proxy

-> IO () 

Deprecated: (Since version 3.10)

The disconnectProxy signal is emitted after disconnecting a proxy from an action in the group.

UIManager proxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.

Since: 2.4

afterActionGroupDisconnectProxy :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupDisconnectProxyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the disconnectProxy signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #disconnectProxy callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onActionGroupDisconnectProxy :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupDisconnectProxyCallback) -> m SignalHandlerId Source #

Connect a signal handler for the disconnectProxy signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on actionGroup #disconnectProxy callback

postActivate

type ActionGroupPostActivateCallback Source #

Arguments

 = Action

action: the action

-> IO () 

Deprecated: (Since version 3.10)

The postActivate signal is emitted just after the action in the actionGroup is activated

This is intended for UIManager to proxy the signal and provide global notification just after any action is activated.

Since: 2.4

afterActionGroupPostActivate :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupPostActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the postActivate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #postActivate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onActionGroupPostActivate :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupPostActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the postActivate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on actionGroup #postActivate callback

preActivate

type ActionGroupPreActivateCallback Source #

Arguments

 = Action

action: the action

-> IO () 

Deprecated: (Since version 3.10)

The preActivate signal is emitted just before the action in the actionGroup is activated

This is intended for UIManager to proxy the signal and provide global notification just before any action is activated.

Since: 2.4

afterActionGroupPreActivate :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupPreActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the preActivate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #preActivate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onActionGroupPreActivate :: (IsActionGroup a, MonadIO m) => a -> ((?self :: a) => ActionGroupPreActivateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the preActivate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on actionGroup #preActivate callback