gi-gtk-3.0.26: 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.ActionGroup

Contents

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.

## {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.

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

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

Synopsis

Exported types

newtype ActionGroup Source #

Memory-managed wrapper type.

class GObject o => IsActionGroup o Source #

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

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, IsAccelGroup a) => a -> IO (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 => Text -> IO (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 => Bool -> IO (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 => Bool -> IO (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 ::connect-proxy 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

type C_ActionGroupConnectProxyCallback = Ptr () -> Ptr Action -> Ptr Widget -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

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

Connect a signal handler for the “connect-proxy” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #connectProxy callback

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

Connect a signal handler for the “connect-proxy” 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 ::disconnect-proxy 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

type C_ActionGroupDisconnectProxyCallback = Ptr () -> Ptr Action -> Ptr Widget -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

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

Connect a signal handler for the “disconnect-proxy” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #disconnectProxy callback

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

Connect a signal handler for the “disconnect-proxy” 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 ::post-activate 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

type C_ActionGroupPostActivateCallback = Ptr () -> Ptr Action -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

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

Connect a signal handler for the “post-activate” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #postActivate callback

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

Connect a signal handler for the “post-activate” 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 ::pre-activate 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

type C_ActionGroupPreActivateCallback = Ptr () -> Ptr Action -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

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

Connect a signal handler for the “pre-activate” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after actionGroup #preActivate callback

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

Connect a signal handler for the “pre-activate” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on actionGroup #preActivate callback