GtkActionGroup: GtkActionGroup

Description Methods and Functions Hierarchy Interfaces Detailed Description GtkActionGroup as GtkBuildable Structures Convenient Construction Signals Properties Author(s) References

Description

A group of actions

Methods and Functions

gtkActionGroupNew(name = NULL)
gtkActionGroupGetName(object)
gtkActionGroupGetSensitive(object)
gtkActionGroupSetSensitive(object, sensitive)
gtkActionGroupGetVisible(object)
gtkActionGroupSetVisible(object, visible)
gtkActionGroupGetAction(object, action.name)
gtkActionGroupListActions(object)
gtkActionGroupAddAction(object, action)
gtkActionGroupAddActionWithAccel(object, action, accelerator = NULL)
gtkActionGroupRemoveAction(object, action)
gtkActionGroupAddActions(object, entries, user.data = NULL)
gtkActionGroupAddActionsFull(object, entries, user.data = NULL)
gtkActionGroupAddToggleActions(object, entries, user.data = NULL)
gtkActionGroupAddToggleActionsFull(object, entries, user.data = NULL)
gtkActionGroupAddRadioActions(object, entries, value, on.change = NULL, user.data = NULL)
gtkActionGroupAddRadioActionsFull(object, entries, value, on.change = NULL, user.data = NULL)
gtkActionGroupSetTranslateFunc(object, func, data = NULL)
gtkActionGroupSetTranslationDomain(object, domain)
gtkActionGroupTranslateString(object, string)
gtkActionGroup(name = NULL)

Hierarchy

1
2

Interfaces

GtkActionGroup implements GtkBuildable.

Detailed Description

Actions are organised into groups. An action group is essentially a map from names to GtkAction 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>/ \var{group-name} / \var{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

The GtkActionGroup implementation of the GtkBuildable interface accepts GtkAction 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 GtkWidget, the main difference is that it doesn't allow you to specify a signal.

A GtkDialog UI definition fragment.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<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>

Structures

GtkActionGroup

The GtkActionGroup struct contains only private members and should not be accessed directly.

GtkActionEntry

GtkActionEntry structs are used with gtkActionGroupAddActions to construct actions. GtkActionEntry is a transparent-type.

name

The name of the action.

stock_id

The stock id for the action, or the name of an icon from the icon theme.

label

The label for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain. If label is NULL, the label of the stock item with id stock.id is used.

accelerator

The accelerator for the action, in the format understood by gtkAcceleratorParse.

tooltip

The tooltip for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain.

callback

The function to call when the action is activated.

GtkToggleActionEntry

GtkToggleActionEntry structs are used with gtkActionGroupAddToggleActions to construct toggle actions. GtkToggleActionEntry is a transparent-type.

name

The name of the action.

stock_id

The stock id for the action, or the name of an icon from the icon theme.

label

The label for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain.

accelerator

The accelerator for the action, in the format understood by gtkAcceleratorParse.

tooltip

The tooltip for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain.

callback

The function to call when the action is activated.

is_active

The initial state of the toggle action.

GtkRadioActionEntry

GtkRadioActionEntry structs are used with gtkActionGroupAddRadioActions to construct groups of radio actions. GtkRadioActionEntry is a transparent-type.

name

The name of the action.

stock_id

The stock id for the action, or the name of an icon from the icon theme.

label

The label for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain.

accelerator

The accelerator for the action, in the format understood by gtkAcceleratorParse.

tooltip

The tooltip for the action. This field should typically be marked for translation, see gtkActionGroupSetTranslationDomain.

value

The value to set on the radio action. See gtkRadioActionGetCurrentValue.

Convenient Construction

gtkActionGroup is the equivalent of gtkActionGroupNew.

Signals

connect-proxy(action.group, action, proxy, user.data)

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

action.group

the group

action

the action

proxy

the proxy

user.data

user data set when the signal handler was connected.

disconnect-proxy(action.group, action, proxy, user.data)

The ::disconnect-proxy signal is emitted after disconnecting a proxy from an action in the group. GtkUIManager 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

action.group

the group

action

the action

proxy

the proxy

user.data

user data set when the signal handler was connected.

post-activate(action.group, action, user.data)

The ::post-activate signal is emitted just after the action in the action.group is activated

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

action.group

the group

action

the action

user.data

user data set when the signal handler was connected.

pre-activate(action.group, action, user.data)

The ::pre-activate signal is emitted just before the action in the action.group is activated

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

action.group

the group

action

the action

user.data

user data set when the signal handler was connected.

Properties

name [character : * : Read / Write / Construct Only]

A name for the action group. Default value: NULL

sensitive [logical : Read / Write]

Whether the action group is enabled. Default value: TRUE

visible [logical : Read / Write]

Whether the action group is visible. Default value: TRUE

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/gtk2/stable/GtkActionGroup.html


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.

Related to GtkActionGroup in RGtk2...