Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup

gtk3-0.14.5: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes
- Signals

Description

A group of actions

- Module available since Gtk+ version 2.4

Synopsis

- data ActionGroup
- class GObjectClass o => ActionGroupClass o
- castToActionGroup :: GObjectClass obj => obj -> ActionGroup
- gTypeActionGroup :: GType
- toActionGroup :: ActionGroupClass o => o -> ActionGroup
- data ActionEntry = ActionEntry {
  - actionEntryName :: DefaultGlibString
  - actionEntryLabel :: DefaultGlibString
  - actionEntryStockId :: Maybe DefaultGlibString
  - actionEntryAccelerator :: Maybe DefaultGlibString
  - actionEntryTooltip :: Maybe DefaultGlibString
  - actionEntryCallback :: IO ()
  }
- data ToggleActionEntry = ToggleActionEntry {
  - toggleActionName :: DefaultGlibString
  - toggleActionLabel :: DefaultGlibString
  - toggleActionStockId :: Maybe DefaultGlibString
  - toggleActionAccelerator :: Maybe DefaultGlibString
  - toggleActionTooltip :: Maybe DefaultGlibString
  - toggleActionCallback :: IO ()
  - toggleActionIsActive :: Bool
  }
- data RadioActionEntry = RadioActionEntry {
  - radioActionName :: DefaultGlibString
  - radioActionLabel :: DefaultGlibString
  - radioActionStockId :: Maybe DefaultGlibString
  - radioActionAccelerator :: Maybe DefaultGlibString
  - radioActionTooltip :: Maybe DefaultGlibString
  - radioActionValue :: Int
  }
- actionGroupNew :: GlibString string => string -> IO ActionGroup
- actionGroupGetName :: GlibString string => ActionGroup -> IO string
- actionGroupGetSensitive :: ActionGroup -> IO Bool
- actionGroupSetSensitive :: ActionGroup -> Bool -> IO ()
- actionGroupGetVisible :: ActionGroup -> IO Bool
- actionGroupSetVisible :: ActionGroup -> Bool -> IO ()
- actionGroupGetAction :: GlibString string => ActionGroup -> string -> IO (Maybe Action)
- actionGroupListActions :: ActionGroup -> IO [Action]
- actionGroupAddAction :: ActionClass action => ActionGroup -> action -> IO ()
- actionGroupAddActionWithAccel :: (ActionClass action, GlibString string) => ActionGroup -> action -> Maybe string -> IO ()
- actionGroupRemoveAction :: ActionClass action => ActionGroup -> action -> IO ()
- actionGroupAddActions :: ActionGroup -> [ActionEntry] -> IO ()
- actionGroupAddToggleActions :: ActionGroup -> [ToggleActionEntry] -> IO ()
- actionGroupAddRadioActions :: ActionGroup -> [RadioActionEntry] -> Int -> (RadioAction -> IO ()) -> IO ()
- actionGroupSetTranslateFunc :: GlibString string => ActionGroup -> (string -> IO string) -> IO ()
- actionGroupSetTranslationDomain :: GlibString string => ActionGroup -> string -> IO ()
- actionGroupTranslateString :: GlibString string => ActionGroup -> string -> IO string
- actionGroupName :: GlibString string => Attr ActionGroup string
- actionGroupSensitive :: Attr ActionGroup Bool
- actionGroupVisible :: Attr ActionGroup Bool

# Detail

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

# Class Hierarchy

    | GObject
    | +----ActionGroup

# Types

data ActionGroup #

Instances

Eq ActionGroup # |
Methods (==) :: ActionGroup -> ActionGroup -> Bool # (/=) :: ActionGroup -> ActionGroup -> Bool #
Ord ActionGroup # |
Methods compare :: ActionGroup -> ActionGroup -> Ordering # (<) :: ActionGroup -> ActionGroup -> Bool # (<=) :: ActionGroup -> ActionGroup -> Bool # (>) :: ActionGroup -> ActionGroup -> Bool # (>=) :: ActionGroup -> ActionGroup -> Bool # max :: ActionGroup -> ActionGroup -> ActionGroup # min :: ActionGroup -> ActionGroup -> ActionGroup #
GObjectClass ActionGroup # |
Methods toGObject :: ActionGroup -> GObject # unsafeCastGObject :: GObject -> ActionGroup #
ActionGroupClass ActionGroup # |

class GObjectClass o => ActionGroupClass o #

Instances

ActionGroupClass ActionGroup # |

castToActionGroup :: GObjectClass obj => obj -> ActionGroup #

gTypeActionGroup :: GType #

toActionGroup :: ActionGroupClass o => o -> ActionGroup #

data ActionEntry #

A description of an action.

Constructors

ActionEntry |
Fields actionEntryName :: DefaultGlibString actionEntryLabel :: DefaultGlibString actionEntryStockId :: Maybe DefaultGlibString actionEntryAccelerator :: Maybe DefaultGlibString actionEntryTooltip :: Maybe DefaultGlibString actionEntryCallback :: IO ()

data ToggleActionEntry #

A description of an action for an entry that can be toggled.

Constructors

ToggleActionEntry |
Fields toggleActionName :: DefaultGlibString toggleActionLabel :: DefaultGlibString toggleActionStockId :: Maybe DefaultGlibString toggleActionAccelerator :: Maybe DefaultGlibString toggleActionTooltip :: Maybe DefaultGlibString toggleActionCallback :: IO () toggleActionIsActive :: Bool

data RadioActionEntry #

A description of an action for an entry that provides a multiple choice.

Constructors

RadioActionEntry |
Fields radioActionName :: DefaultGlibString radioActionLabel :: DefaultGlibString radioActionStockId :: Maybe DefaultGlibString radioActionAccelerator :: Maybe DefaultGlibString radioActionTooltip :: Maybe DefaultGlibString radioActionValue :: Int

# Constructors

actionGroupNew #

Arguments

:: GlibString string |
=> string | `name` - the name of the action group.
-> IO ActionGroup |

Creates a new `ActionGroup` object. The name of the action group is used when associating keybindings with the actions.

# Methods

actionGroupGetName #

Arguments

:: GlibString string |
=> ActionGroup |
-> IO string | returns the name of the action group.

Gets the name of the action group.

actionGroupGetSensitive :: ActionGroup -> IO Bool #

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.

actionGroupSetSensitive :: ActionGroup -> Bool -> IO () #

Changes the sensitivity of `actionGroup`

actionGroupGetVisible :: ActionGroup -> IO Bool #

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.

actionGroupSetVisible :: ActionGroup -> Bool -> IO () #

Changes the visible of `actionGroup`.

actionGroupGetAction #

Arguments

:: GlibString string |
=> ActionGroup |
-> string | `actionName` - the name of the action
-> IO (Maybe Action) | returns the action, or `Nothing` if no action by that name exists

Looks up an action in the action group by name.

actionGroupListActions #

Arguments

:: ActionGroup |
-> IO [Action] | returns a list of the action objects in the action group

Lists the actions in the action group.

actionGroupAddAction :: ActionClass action => ActionGroup -> action -> IO () #

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 ``actionGroupAddActionWithAccel` ... Nothing`.

actionGroupAddActionWithAccel #

Arguments

:: (ActionClass action, GlibString string) |
=> ActionGroup |
-> action | `action` - the action to add
-> Maybe string | `accelerator` - the accelerator for the action, in the format understood by `acceleratorParse`, or "" for no accelerator, or `Nothing` to use the stock accelerator
-> IO () |

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

actionGroupRemoveAction :: ActionClass action => ActionGroup -> action -> IO () #

Removes an action object from the action group.

actionGroupAddActions #

Arguments

:: ActionGroup |
-> [ActionEntry] | `entries` - a list of action descriptions
-> IO () |

This is a convenience function to create a number of actions and add them to the action group.

The `actionActivated` signals of the actions are connected to the callbacks and their accel paths are set to `<Actions>/group-name/action-name`.

actionGroupAddToggleActions #

Arguments

:: ActionGroup |
-> [ToggleActionEntry] | `entries` - a list of toggle action descriptions
-> IO () |

This is a convenience function to create a number of toggle actions and add them to the action group.

The `actionActivated` signals of the actions are connected to the callbacks and their accel paths are set to `<Actions>/group-name/action-name`.

actionGroupAddRadioActions #

Arguments

:: ActionGroup |
-> [RadioActionEntry] | `entries` - a list of radio action descriptions
-> Int | `value` - the value of the action to activate initially, or -1 if no action should be activated
-> (RadioAction -> IO ()) | `onChange` - the callback for the changed signal
-> IO () |

This is a convenience routine to create a group of radio actions and add them to the action group.

The `radioActionChanged` signal of the first radio action is connected to the `onChange` callback and the accel paths of the actions are set to `<Actions>/group-name/action-name`.

actionGroupSetTranslateFunc #

Arguments

:: GlibString string |
=> ActionGroup |
-> (string -> IO string) | `(label -> ...)` - a translation function
-> IO () |

Sets a function to be used for translating the `label` and `tooltip` of `ActionEntry`s added by `actionGroupAddActions`.

If you're using 'gettext', it is enough to set the translation domain with `actionGroupSetTranslationDomain`.

actionGroupSetTranslationDomain #

Arguments

:: GlibString string |
=> ActionGroup |
-> string | `domain` - the translation domain to use for 'dgettext' calls
-> IO () |

Sets the translation domain and uses 'dgettext' for translating the `label` and `tooltip` of `ActionEntry`s added by `actionGroupAddActions`.

If you're not using 'gettext' for localization, see `actionGroupSetTranslateFunc`.

actionGroupTranslateString #

Arguments

:: GlibString string |
=> ActionGroup |
-> string | `string` - a string
-> IO string | returns the translation of `string`

Translates a string.

- Available since Gtk+ version 2.6

# Attributes

actionGroupName :: GlibString string => Attr ActionGroup string #

A name for the action group.

Default value: ""

actionGroupSensitive :: Attr ActionGroup Bool #

Whether the action group is enabled.

Default value: `True`

actionGroupVisible :: Attr ActionGroup Bool #

Whether the action group is visible.

Default value: `True`

# Signals