gtk.action
Module for [Action] class
Types 3
In GTK+ 3.10, GtkAction has been deprecated. Use #GActionActions represent operations that the user can be perform, along with some information how it should be presented in the interface. Each action provides methods to create icons, menu items and toolbar items representing itself.instead, and associate actions with #GtkActionable widgets. Use #GMenuModel for creating menus with gtk.menu.Menu.newFromModel.
As well as the callback that is called when the action gets activated, the following also gets associated with the action:
- a name (not translated, for path lookup)
- a label (translated, for display)
- an accelerator
- whether label indicates a stock id
- a tooltip (optional, translated)
- a toolbar label (optional, shorter than label)
The action will also have some state information:
- visible (shown/hidden)
- sensitive (enabled/disabled)
Apart from regular actions, there are toggle actions, which can be toggled between two states and radio actions, of which only one in a group can be in the “active” state. Other actions can be implemented as #GtkAction subclasses.
Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement #GtkActivatable interface. Proxies mirror the state of the action and should change when the action’s state changes. Properties that are always mirrored by proxies are #GtkAction:sensitive and #GtkAction:visible. #GtkAction:gicon, #GtkAction:icon-name, #GtkAction:label, #GtkAction:short-label and #GtkAction:stock-id properties are only mirorred if proxy widget has #GtkActivatable:use-action-appearance property set to true.
When the proxy is activated, it should activate its action.
ActionGidBuilder builder() static nothrowGet builder for [gtk.action.Action] Returns: New builder objectgtk.action_group.ActionGroup actionGroup() @property nothrowGet `actionGroup` property. Returns: The GtkActionGroup this GtkAction is associated with, or NULL (for internal use).void actionGroup(gtk.action_group.ActionGroup propval) @property nothrowSet `actionGroup` property. Params: propval = The GtkActionGroup this GtkAction is associated with, or NULL (for internal use).bool alwaysShowImage() @property nothrowGet `alwaysShowImage` property. Returns: If true, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images setting and always show their image, if available.void alwaysShowImage(bool propval) @property nothrowSet `alwaysShowImage` property. Params: propval = If true, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images setting and always show their image, if available.gio.icon.Icon gicon() @property nothrowGet `gicon` property. Returns: The #GIcon displayed in the #GtkAction.void gicon(gio.icon.Icon propval) @property nothrowSet `gicon` property. Params: propval = The #GIcon displayed in the #GtkAction.bool hideIfEmpty() @property nothrowGet `hideIfEmpty` property. Returns: When TRUE, empty menu proxies for this action are hidden.void hideIfEmpty(bool propval) @property nothrowSet `hideIfEmpty` property. Params: propval = When TRUE, empty menu proxies for this action are hidden.string iconName() @property nothrowGet `iconName` property. Returns: The name of the icon from the icon theme.void iconName(string propval) @property nothrowSet `iconName` property. Params: propval = The name of the icon from the icon theme.bool isImportant() @property nothrowGet `isImportant` property. Returns: Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode.void isImportant(bool propval) @property nothrowSet `isImportant` property. Params: propval = Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode.string label() @property nothrowGet `label` property. Returns: The label used for menu items and buttons that activate this action. If the label is null, GTK+ uses the stock label specified via the stock-id property.void label(string propval) @property nothrowSet `label` property. Params: propval = The label used for menu items and buttons that activate this action. If the label is null, GTK+ uses the stock label specified via the stock-id property.void sensitive(bool propval) @property nothrowSet `sensitive` property. Params: propval = Whether the action is enabled.string shortLabel() @property nothrowGet `shortLabel` property. Returns: A shorter label that may be used on toolbar buttons.void shortLabel(string propval) @property nothrowSet `shortLabel` property. Params: propval = A shorter label that may be used on toolbar buttons.string stockId() @property nothrowGet `stockId` property. Returns: The stock icon displayed in widgets representing this action.void stockId(string propval) @property nothrowSet `stockId` property. Params: propval = The stock icon displayed in widgets representing this action.void tooltip(string propval) @property nothrowSet `tooltip` property. Params: propval = A tooltip for this action.void visible(bool propval) @property nothrowSet `visible` property. Params: propval = Whether the action is visible.bool visibleHorizontal() @property nothrowGet `visibleHorizontal` property. Returns: Whether the toolbar item is visible when the toolbar is in a horizontal orientation.void visibleHorizontal(bool propval) @property nothrowSet `visibleHorizontal` property. Params: propval = Whether the toolbar item is visible when the toolbar is in a horizontal orientation.bool visibleOverflown() @property nothrowGet `visibleOverflown` property. Returns: When true, toolitem proxies for this action are represented in the toolbar overflow menu.void visibleOverflown(bool propval) @property nothrowSet `visibleOverflown` property. Params: propval = When true, toolitem proxies for this action are represented in the toolbar overflow menu.bool visibleVertical() @property nothrowGet `visibleVertical` property. Returns: Whether the toolbar item is visible when the toolbar is in a vertical orientation.void visibleVertical(bool propval) @property nothrowSet `visibleVertical` property. Params: propval = Whether the toolbar item is visible when the toolbar is in a vertical orientation.void activate() nothrowEmits the “activate” signal on the specified action, if it isn't insensitive. This gets called by the proxy widgets when they get activated.void connectAccelerator() nothrowInstalls the accelerator for action if action has an accel path and group. See [gtk.action.Action.setAccelPath] and [gtk.action.Action.setAccelGroup]gtk.widget.Widget createIcon(gtk.types.IconSize iconSize) nothrowThis function is intended for use by action implementations to create icons displayed in the proxy widgets.gtk.widget.Widget createMenu() nothrowIf action provides a #GtkMenu widget as a submenu for the menu item or the toolbar item it creates, this function returns an instance of that menu. Returns: the menu item provided by the action, or...gtk.widget.Widget createMenuItem() nothrowCreates a menu item widget that proxies for the given action. Returns: a menu item connected to the action.gtk.widget.Widget createToolItem() nothrowCreates a toolbar item widget that proxies for the given action. Returns: a toolbar item connected to the action.void disconnectAccelerator() nothrowUndoes the effect of one call to [gtk.action.Action.connectAccelerator].gobject.closure.Closure getAccelClosure() nothrowReturns the accel closure for this action. Returns: the accel closure for this action. The returned closure is owned by GTK+ and must not be unreffed or modified.string getAccelPath() nothrowReturns the accel path for this action. Returns: the accel path for this action, or null if none is set. The returned string is owned by GTK+ and must not be freed or modified.bool getAlwaysShowImage() nothrowReturns whether action's menu item proxies will always show their image, if available. Returns: true if the menu item proxies will always show their imagegio.icon.Icon getGicon() nothrowGets the gicon of action. Returns: The action’s #GIcon if one is set.bool getIsImportant() nothrowChecks whether action is important or not Returns: whether action is importantstring getName() nothrowReturns the name of the action. Returns: the name of the action. The string belongs to GTK+ and should not be freed.gtk.widget.Widget[] getProxies() nothrowReturns the proxy widgets for an action. See also [gtk.activatable.Activatable.getRelatedAction]. Returns: a #GSList of proxy widgets. The list is owned by GTK+ and must not be modified.bool getSensitive() nothrowReturns whether the action itself is sensitive. Note that this doesn’t necessarily mean effective sensitivity. See [gtk.action.Action.isSensitive] for that. Returns: true if the action itself is ...bool getVisible() nothrowReturns whether the action itself is visible. Note that this doesn’t necessarily mean effective visibility. See [gtk.action.Action.isSensitive] for that. Returns: true if the action itself is vis...bool getVisibleHorizontal() nothrowChecks whether action is visible when horizontal Returns: whether action is visible when horizontalbool getVisibleVertical() nothrowChecks whether action is visible when horizontal Returns: whether action is visible when horizontalbool isSensitive() nothrowReturns whether the action is effectively sensitive. Returns: true if the action and its associated action group are both sensitive.bool isVisible() nothrowReturns whether the action is effectively visible. Returns: true if the action and its associated action group are both visible.void setAccelGroup(gtk.accel_group.AccelGroup accelGroup = null) nothrowSets the #GtkAccelGroup in which the accelerator for this action will be installed.void setAccelPath(string accelPath) nothrowSets the accel path for this action. All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent.void setAlwaysShowImage(bool alwaysShow) nothrowSets whether action's menu item proxies will ignore the #GtkSettings:gtk-menu-images setting and always show their image, if available.void setIsImportant(bool isImportant) nothrowSets whether the action is important, this attribute is used primarily by toolbar items to decide whether to show a label or not.void setSensitive(bool sensitive) nothrowSets the :sensitive property of the action to sensitive. Note that this doesn’t necessarily mean effective sensitivity. See [gtk.action.Action.isSensitive] for that.void setVisible(bool visible) nothrowSets the :visible property of the action to visible. Note that this doesn’t necessarily mean effective visibility. See [gtk.action.Action.isVisible] for that.void setVisibleHorizontal(bool visibleHorizontal) nothrowSets whether action is visible when horizontalgulong connectActivate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.action.Action)))
&& Parameters!T.length < 2) nothrowConnect to `Activate` signal.this(string name, string label = null, string tooltip = null, string stockId = null)Creates a new #GtkAction object. To add the action to a #GtkActionGroup and set the accelerator for the action, call [gtk.action_group.ActionGroup.addActionWithAccel]. See the [UI Definition sectio...Fluent builder implementation template for gtk.action.Action
T actionGroup(gtk.action_group.ActionGroup propval) nothrowSet `actionGroup` property. Params: propval = The GtkActionGroup this GtkAction is associated with, or NULL (for internal use). Returns: Builder instance for fluent chainingT alwaysShowImage(bool propval) nothrowSet `alwaysShowImage` property. Params: propval = If true, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images setting and always show their image, if available.T gicon(gio.icon.Icon propval) nothrowSet `gicon` property. Params: propval = The #GIcon displayed in the #GtkAction.T hideIfEmpty(bool propval) nothrowSet `hideIfEmpty` property. Params: propval = When TRUE, empty menu proxies for this action are hidden. Returns: Builder instance for fluent chainingT iconName(string propval) nothrowSet `iconName` property. Params: propval = The name of the icon from the icon theme.T isImportant(bool propval) nothrowSet `isImportant` property. Params: propval = Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode. Returns: Builder inst...T label(string propval) nothrowSet `label` property. Params: propval = The label used for menu items and buttons that activate this action. If the label is null, GTK+ uses the stock label specified via the stock-id property.T name(string propval) nothrowSet `name` property. Params: propval = A unique name for the action. Returns: Builder instance for fluent chainingT sensitive(bool propval) nothrowSet `sensitive` property. Params: propval = Whether the action is enabled. Returns: Builder instance for fluent chainingT shortLabel(string propval) nothrowSet `shortLabel` property. Params: propval = A shorter label that may be used on toolbar buttons.T stockId(string propval) nothrowSet `stockId` property. Params: propval = The stock icon displayed in widgets representing this action.T tooltip(string propval) nothrowSet `tooltip` property. Params: propval = A tooltip for this action. Returns: Builder instance for fluent chainingT visible(bool propval) nothrowSet `visible` property. Params: propval = Whether the action is visible. Returns: Builder instance for fluent chainingT visibleHorizontal(bool propval) nothrowSet `visibleHorizontal` property. Params: propval = Whether the toolbar item is visible when the toolbar is in a horizontal orientation. Returns: Builder instance for fluent chainingT visibleOverflown(bool propval) nothrowSet `visibleOverflown` property. Params: propval = When true, toolitem proxies for this action are represented in the toolbar overflow menu. Returns: Builder instance for fluent chainingT visibleVertical(bool propval) nothrowSet `visibleVertical` property. Params: propval = Whether the toolbar item is visible when the toolbar is in a vertical orientation. Returns: Builder instance for fluent chainingFluent builder for gtk.action.Action