Libraries:Gtk:Gtk:Action
Types
T
Inherits from:Actions 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.
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 T subclasses.
Each action can have one or more proxy menu item, toolbar button or other proxy widgets. Proxies mirror the state of the action (text label, tooltip, icon, visible, sensitive, etc), and should change when the action's state changes. When the proxy is activated, it should activate its action.
Constants
Nil : T
Functions
GetType() : Gtk.GObject.Type.T
New(name @ Std.String.T, label @ Std.String.T, tooltip @ Std.String.T, stock_id @ Std.String.T) : Gtk.Gtk.Action.T
Creates a new T object. To add the action to a Gtk.Gtk.ActionGroup.T and set the accelerator for the action, call Gtk.Gtk.ActionGroup.AddActionWithAccel. See the section called "UI Definitions" for information on allowed action names.
name | A unique name for the action |
label | the label displayed in menu items and on buttons, or NULL. [allow-none] |
tooltip | a tooltip for the action, or NULL. [allow-none] |
stock_id | the stock icon to display in widgets representing the action, or NULL |
Returns | a new T |
Methods
:Activate(self @ T) : Std.Object.T
Emits the "activate" signal on the specified action, if it isn't insensitive. This gets called by the proxy widgets when they get activated.
It can also be used to manually activate an action.
action | the action object |
:BlockActivate(self @ T) : Std.Object.T
Disable activation signals from the action
This is needed when updating the state of your proxy Gtk.Gtk.Activatable.T widget could result in calling Activate, this is a convenience function to avoid recursing in those cases (updating toggle state for instance).
action | a T |
:BlockActivateFrom(self @ T, proxy @ Gtk.Gtk.Widget.T) : Std.Object.T
Warning
BlockActivateFrom has been deprecated since version 2.16 and should not be used in newly-written code. activatables are now responsible for activating the action directly so this doesnt apply anymore.
:ConnectAccelerator(self @ T) : Std.Object.T
Installs the accelerator for action if action has an accel path and group. See SetAccelPath and SetAccelGroup
Since multiple proxies may independently trigger the installation of the accelerator, the action counts the number of times this function has been called and doesn't remove the accelerator until DisconnectAccelerator has been called as many times.
action | a T |
:ConnectProxy(self @ T, proxy @ Gtk.Gtk.Widget.T) : Std.Object.T
Warning
ConnectProxy has been deprecated since version 2.16 and should not be used in newly-written code. Use Gtk.Gtk.Activatable.SetRelatedAction instead.
:CreateIcon(self @ T, icon_size @ Gtk.Gtk.IconSize.T) : Gtk.Gtk.Widget.T
This function is intended for use by action implementations to create icons displayed in the proxy widgets.
action | the action object |
icon_size | the size of the icon that should be created. [type int] |
Returns | a widget that displays the icon for this action. [transfer none] |
:CreateMenu(self @ T) : Gtk.Gtk.Widget.T
If action provides a Gtk.Gtk.Menu.T widget as a submenu for the menu item or the toolbar item it creates, this function returns an instance of that menu.
:CreateMenuItem(self @ T) : Gtk.Gtk.Widget.T
Creates a menu item widget that proxies for the given action.
action | the action object |
Returns | a menu item connected to the action. [transfer none] |
:CreateToolItem(self @ T) : Gtk.Gtk.Widget.T
Creates a toolbar item widget that proxies for the given action.
action | the action object |
Returns | a toolbar item connected to the action. [transfer none] |
:DisconnectAccelerator(self @ T) : Std.Object.T
:DisconnectProxy(self @ T, proxy @ Gtk.Gtk.Widget.T) : Std.Object.T
Warning
DisconnectProxy has been deprecated since version 2.16 and should not be used in newly-written code. Use Gtk.Gtk.Activatable.SetRelatedAction instead.
:GetAccelClosure(self @ T) : Gtk.GObject.Closure.T
Returns the accel closure for this action.
action | the action object |
Returns | the accel closure for this action. The returned closure is owned by GTK+ and must not be unreffed or modified. [transfer none] |
:GetAccelPath(self @ T) : Std.String.T
Returns the accel path for this action.
action | the action object |
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. |
:GetAlwaysShowImage(self @ T) : Std.Symbol.T
Returns whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.
action | a T |
Returns | TRUE if the menu item proxies will always show their image |
:GetGicon(self @ T) : Gtk.Gio.GIcon.T
:GetIconName(self @ T) : Std.String.T
:GetIsImportant(self @ T) : Std.Symbol.T
:GetLabel(self @ T) : Std.String.T
:GetName(self @ T) : Std.String.T
Returns the name of the action.
action | the action object |
Returns | the name of the action. The string belongs to GTK+ and should not be freed. |
:GetProxies(self @ T) : Std.Object.T
Returns the proxy widgets for an action. See also Gtk.Gtk.Widget.GetAction.
action | the action object |
Returns | a GSList of proxy widgets. The list is owned by GTK+ and must not be modified. [element-type GtkWidget][transfer none] |
:GetSensitive(self @ T) : Std.Symbol.T
Returns whether the action itself is sensitive. Note that this doesn't necessarily mean effective sensitivity. See IsSensitive for that.
action | the action object |
Returns | TRUE if the action itself is sensitive. |
:GetShortLabel(self @ T) : Std.String.T
:GetStockId(self @ T) : Std.String.T
:GetTooltip(self @ T) : Std.String.T
:GetVisible(self @ T) : Std.Symbol.T
Returns whether the action itself is visible. Note that this doesn't necessarily mean effective visibility. See IsSensitive for that.
action | the action object |
Returns | TRUE if the action itself is visible. |
:GetVisibleHorizontal(self @ T) : Std.Symbol.T
Checks whether action is visible when horizontal
action | a T |
Returns | whether action is visible when horizontal |
:GetVisibleVertical(self @ T) : Std.Symbol.T
Checks whether action is visible when horizontal
action | a T |
Returns | whether action is visible when horizontal |
:IsSensitive(self @ T) : Std.Symbol.T
Returns whether the action is effectively sensitive.
action | the action object |
Returns | TRUE if the action and its associated action group are both sensitive. |
:IsVisible(self @ T) : Std.Symbol.T
Returns whether the action is effectively visible.
action | the action object |
Returns | TRUE if the action and its associated action group are both visible. |
:SetAccelGroup(self @ T, accel_group @ Gtk.Gtk.AccelGroup.T) : Std.Object.T
Sets the Gtk.Gtk.AccelGroup.T in which the accelerator for this action will be installed.
action | the action object |
accel_group | a Gtk.Gtk.AccelGroup.T or NULL. [allow-none] |
:SetAccelPath(self @ T, accel_path @ Std.String.T) : Std.Object.T
Sets the accel path for this action. All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent.
Note that accel_path string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().
action | the action object |
accel_path | the accelerator path |
:SetAlwaysShowImage(self @ T, always_show @ Std.Symbol.T) : Std.Object.T
Sets whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.
Use this if the menu item would be useless or hard to use without their image.
action | a T |
always_show | TRUE if menuitem proxies should always show their image |
:SetGicon(self @ T, icon @ Gtk.Gio.GIcon.T) : Std.Object.T
:SetIconName(self @ T, icon_name @ Std.String.T) : Std.Object.T
:SetIsImportant(self @ T, is_important @ Std.Symbol.T) : Std.Object.T
Sets whether the action is important, this attribute is used primarily by toolbar items to decide whether to show a label or not.
action | the action object |
is_important | TRUE to make the action important |
:SetLabel(self @ T, label @ Std.String.T) : Std.Object.T
:SetSensitive(self @ T, sensitive @ Std.Symbol.T) : Std.Object.T
Sets the ::sensitive property of the action to sensitive. Note that this doesn't necessarily mean effective sensitivity. See IsSensitive for that.
action | the action object |
sensitive | TRUE to make the action sensitive |
:SetShortLabel(self @ T, short_label @ Std.String.T) : Std.Object.T
:SetStockId(self @ T, stock_id @ Std.String.T) : Std.Object.T
:SetTooltip(self @ T, tooltip @ Std.String.T) : Std.Object.T
:SetVisible(self @ T, visible @ Std.Symbol.T) : Std.Object.T
Sets the ::visible property of the action to visible. Note that this doesn't necessarily mean effective visibility. See IsVisible for that.
action | the action object |
visible | TRUE to make the action visible |
:SetVisibleHorizontal(self @ T, visible_horizontal @ Std.Symbol.T) : Std.Object.T
Sets whether action is visible when horizontal
action | a T |
visible_horizontal | whether the action is visible horizontally |
:SetVisibleVertical(self @ T, visible_vertical @ Std.Symbol.T) : Std.Object.T
Sets whether action is visible when vertical
action | a T |
visible_vertical | whether the action is visible vertically |
:UnblockActivate(self @ T) : Std.Object.T
:UnblockActivateFrom(self @ T, proxy @ Gtk.Gtk.Widget.T) : Std.Object.T
Warning
UnblockActivateFrom has been deprecated since version 2.16 and should not be used in newly-written code. activatables are now responsible for activating the action directly so this doesnt apply anymore.