> In GTK+ 3.10, GtkAction has been deprecated. Use Glib.Action.Gaction > instead, and associate actions with Gtk.Actionable.Gtk_Actionable widgets. Use > Glib.Menu_Model.Gmenu_Model for creating menus with Gtk.Menu.Gtk_New_From_Model.
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][GtkToggleAction], which can be toggled between two states and [radio actions][GtkRadioAction], of which only one in a group can be in the "active" state. Other actions can be implemented as Gtk.Action.Gtk_Action subclasses.
Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement Gtk.Activatable.Gtk_Activatable 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 Gtk.Action.Gtk_Action:sensitive and Gtk.Action.Gtk_Action:visible. Gtk.Action.Gtk_Action:gicon, Gtk.Action.Gtk_Action:icon-name, Gtk.Action.Gtk_Action:label, Gtk.Action.Gtk_Action:short-label and Gtk.Action.Gtk_Action:stock-id properties are only mirorred if proxy widget has Gtk.Activatable.Gtk_Activatable:use-action-appearance property set to True.
When the proxy is activated, it should activate its action.
function "+"
(Widget : access Gtk_Action_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Action
Action_Group_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Action_Group.Gtk_Action_Group The GtkActionGroup this GtkAction is associated with, or NULL (for internal use).
procedure Activate (Action : not null access Gtk_Action_Record)
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. Since: gtk+ 2.4 Deprecated since 3.10, 1
Always_Show_Image_Property : constant Glib.Properties.Property_Boolean;
If True, the action's menu item proxies will ignore the Gtk.Settings.Gtk_Settings:gtk-menu-images setting and always show their image, if available.
Use this property if the menu item would be useless or hard to use without their image.
procedure Block_Activate (Action : not null access Gtk_Action_Record)
Disable activation signals from the action This is needed when updating the state of your proxy Gtk.Activatable.Gtk_Activatable widget could result in calling Gtk.Action.Activate, this is a convenience function to avoid recursing in those cases (updating toggle state for instance). Since: gtk+ 2.16 Deprecated since 3.10, 1
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Action_Void is not null access procedure (Self : access Gtk_Action_Record'Class);
procedure Connect_Accelerator
(Action : not null access Gtk_Action_Record)
Installs the accelerator for Action if Action has an accel path and group. See Gtk.Action.Set_Accel_Path and Gtk.Action.Set_Accel_Group 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 Gtk.Action.Disconnect_Accelerator has been called as many times. Since: gtk+ 2.4 Deprecated since 3.10, 1
function Create_Icon
(Action : not null access Gtk_Action_Record;
Icon_Size : Gtk.Enums.Gtk_Icon_Size) return Gtk.Widget.Gtk_Widget
This function is intended for use by action implementations to create icons displayed in the proxy widgets. Since: gtk+ 2.4 Deprecated since 3.10, 1
the size of the icon (Gtk.Enums.Gtk_Icon_Size) that should be created.
a widget that displays the icon for this action.
function Create_Menu
(Action : not null access Gtk_Action_Record)
return Gtk.Widget.Gtk_Widget
If Action provides a Gtk.Menu.Gtk_Menu widget as a submenu for the menu item or the toolbar item it creates, this function returns an instance of that menu. Since: gtk+ 2.12 Deprecated since 3.10, 1
the menu item provided by the action, or null.
function Create_Menu_Item
(Action : not null access Gtk_Action_Record)
return Gtk.Widget.Gtk_Widget
Creates a menu item widget that proxies for the given action. Since: gtk+ 2.4 Deprecated since 3.10, 1
a menu item connected to the action.
function Create_Tool_Item
(Action : not null access Gtk_Action_Record)
return Gtk.Widget.Gtk_Widget
Creates a toolbar item widget that proxies for the given action. Since: gtk+ 2.4 Deprecated since 3.10, 1
a toolbar item connected to the action.
procedure Disconnect_Accelerator
(Action : not null access Gtk_Action_Record)
Undoes the effect of one call to Gtk.Action.Connect_Accelerator. Since: gtk+ 2.4 Deprecated since 3.10, 1
G_Icon_Property : constant Glib.Properties.Property_Boxed;
Type: Glib.G_Icon.G_Icon The Glib.G_Icon.G_Icon displayed in the Gtk.Action.Gtk_Action.
Note that the stock icon is preferred, if the Gtk.Action.Gtk_Action:stock-id property holds the id of an existing stock icon.
This is an appearance property and thus only applies if Gtk.Activatable.Gtk_Activatable:use-action-appearance is True.
function Get_Accel_Path
(Action : not null access Gtk_Action_Record) return UTF8_String
Returns the accel path for this action. Since: gtk+ 2.6 Deprecated since 3.10, 1
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.
function Get_Always_Show_Image
(Action : not null access Gtk_Action_Record) return Boolean
Returns whether Action's menu item proxies will always show their image, if available. Since: gtk+ 2.20 Deprecated since 3.10, 1
True if the menu item proxies will always show their image
function Get_Gicon
(Action : not null access Gtk_Action_Record) return Glib.G_Icon.G_Icon
Gets the gicon of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
The action's Glib.G_Icon.G_Icon if one is set.
function Get_Icon_Name
(Action : not null access Gtk_Action_Record) return UTF8_String
Gets the icon name of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the icon name
function Get_Is_Important
(Action : not null access Gtk_Action_Record) return Boolean
Checks whether Action is important or not Since: gtk+ 2.16 Deprecated since 3.10, 1
whether Action is important
function Get_Label
(Action : not null access Gtk_Action_Record) return UTF8_String
Gets the label text of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the label text
function Get_Name
(Action : not null access Gtk_Action_Record) return UTF8_String
Returns the name of the action. Since: gtk+ 2.4 Deprecated since 3.10, 1
the name of the action. The string belongs to GTK+ and should not be freed.
function Get_Proxies
(Action : not null access Gtk_Action_Record)
return Gtk.Widget.Widget_SList.GSlist
Returns the proxy widgets for an action. See also Gtk.Activatable.Get_Related_Action. Since: gtk+ 2.4 Deprecated since 3.10, 1
function Get_Sensitive
(Action : not null access Gtk_Action_Record) return Boolean
Returns whether the action itself is sensitive. Note that this doesn't necessarily mean effective sensitivity. See Gtk.Action.Is_Sensitive for that. Since: gtk+ 2.4 Deprecated since 3.10, 1
True if the action itself is sensitive.
function Get_Short_Label
(Action : not null access Gtk_Action_Record) return UTF8_String
Gets the short label text of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the short label text.
function Get_Stock_Id
(Action : not null access Gtk_Action_Record) return UTF8_String
Gets the stock id of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the stock id
function Get_Tooltip
(Action : not null access Gtk_Action_Record) return UTF8_String
Gets the tooltip text of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the tooltip text
function Get_Type return Glib.GType
function Get_Visible
(Action : not null access Gtk_Action_Record) return Boolean
Returns whether the action itself is visible. Note that this doesn't necessarily mean effective visibility. See Gtk.Action.Is_Sensitive for that. Since: gtk+ 2.4 Deprecated since 3.10, 1
True if the action itself is visible.
function Get_Visible_Horizontal
(Action : not null access Gtk_Action_Record) return Boolean
Checks whether Action is visible when horizontal Since: gtk+ 2.16 Deprecated since 3.10, 1
whether Action is visible when horizontal
function Get_Visible_Vertical
(Action : not null access Gtk_Action_Record) return Boolean
Checks whether Action is visible when horizontal Since: gtk+ 2.16 Deprecated since 3.10, 1
whether Action is visible when horizontal
type Gtk_Action is access all Gtk_Action_Record'Class;
function Gtk_Action_New
(Name : UTF8_String;
Label : UTF8_String := "";
Tooltip : UTF8_String := "";
Stock_Id : UTF8_String := "") return Gtk_Action
Creates a new Gtk.Action.Gtk_Action object. To add the action to a Gtk.Action_Group.Gtk_Action_Group and set the accelerator for the action, call Gtk.Action_Group.Add_Action_With_Accel. See the [UI Definition section][XML-UI] for information on allowed action names. Since: gtk+ 2.4
A unique name for the action
the label displayed in menu items and on buttons, or null
a tooltip for the action, or null
the stock icon to display in widgets representing the action, or null
type Gtk_Action_Record is new GObject_Record with null record;
procedure Gtk_New
(Action : out Gtk_Action;
Name : UTF8_String;
Label : UTF8_String := "";
Tooltip : UTF8_String := "";
Stock_Id : UTF8_String := "")
Creates a new Gtk.Action.Gtk_Action object. To add the action to a Gtk.Action_Group.Gtk_Action_Group and set the accelerator for the action, call Gtk.Action_Group.Add_Action_With_Accel. See the [UI Definition section][XML-UI] for information on allowed action names. Since: gtk+ 2.4 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
A unique name for the action
the label displayed in menu items and on buttons, or null
a tooltip for the action, or null
the stock icon to display in widgets representing the action, or null
Hide_If_Empty_Property : constant Glib.Properties.Property_Boolean;
When TRUE, empty menu proxies for this action are hidden.
Icon_Name_Property : constant Glib.Properties.Property_String;
The name of the icon from the icon theme.
Note that the stock icon is preferred, if the Gtk.Action.Gtk_Action:stock-id property holds the id of an existing stock icon, and the Glib.G_Icon.G_Icon is preferred if the Gtk.Action.Gtk_Action:gicon property is set.
This is an appearance property and thus only applies if Gtk.Activatable.Gtk_Activatable:use-action-appearance is True.
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Action_Record, Gtk_Action);
procedure Initialize
(Action : not null access Gtk_Action_Record'Class;
Name : UTF8_String;
Label : UTF8_String := "";
Tooltip : UTF8_String := "";
Stock_Id : UTF8_String := "")
Creates a new Gtk.Action.Gtk_Action object. To add the action to a Gtk.Action_Group.Gtk_Action_Group and set the accelerator for the action, call Gtk.Action_Group.Add_Action_With_Accel. See the [UI Definition section][XML-UI] for information on allowed action names. Since: gtk+ 2.4 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
A unique name for the action
the label displayed in menu items and on buttons, or null
a tooltip for the action, or null
the stock icon to display in widgets representing the action, or null
Is_Important_Property : constant Glib.Properties.Property_Boolean;
Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode.
function Is_Sensitive
(Action : not null access Gtk_Action_Record) return Boolean
Returns whether the action is effectively sensitive. Since: gtk+ 2.4 Deprecated since 3.10, 1
True if the action and its associated action group are both sensitive.
function Is_Visible
(Action : not null access Gtk_Action_Record) return Boolean
Returns whether the action is effectively visible. Since: gtk+ 2.4 Deprecated since 3.10, 1
True if the action and its associated action group are both visible.
Label_Property : constant Glib.Properties.Property_String;
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.
This is an appearance property and thus only applies if Gtk.Activatable.Gtk_Activatable:use-action-appearance is True.
Name_Property : constant Glib.Properties.Property_String;
A unique name for the action.
procedure On_Activate
(Self : not null access Gtk_Action_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The "activate" signal is emitted when the action is activated.
procedure On_Activate
(Self : not null access Gtk_Action_Record;
Call : Cb_Gtk_Action_Void;
After : Boolean := False)
The "activate" signal is emitted when the action is activated.
Sensitive_Property : constant Glib.Properties.Property_Boolean;
Whether the action is enabled.
procedure Set_Accel_Group
(Action : not null access Gtk_Action_Record;
Accel_Group : access Gtk.Accel_Group.Gtk_Accel_Group_Record'Class)
Sets the Gtk.Accel_Group.Gtk_Accel_Group in which the accelerator for this action will be installed. Since: gtk+ 2.4 Deprecated since 3.10, 1
a Gtk.Accel_Group.Gtk_Accel_Group or null
procedure Set_Accel_Path
(Action : not null access Gtk_Action_Record;
Accel_Path : UTF8_String)
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 Glib.GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string. Since: gtk+ 2.4 Deprecated since 3.10, 1
the accelerator path
procedure Set_Always_Show_Image
(Action : not null access Gtk_Action_Record;
Always_Show : Boolean)
Sets whether Action's menu item proxies will ignore the Gtk.Settings.Gtk_Settings: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. Since: gtk+ 2.20 Deprecated since 3.10, 1
True if menuitem proxies should always show their image
procedure Set_Gicon
(Action : not null access Gtk_Action_Record;
Icon : Glib.G_Icon.G_Icon)
Sets the icon of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the Glib.G_Icon.G_Icon to set
procedure Set_Icon_Name
(Action : not null access Gtk_Action_Record;
Icon_Name : UTF8_String)
Sets the icon name on Action Since: gtk+ 2.16 Deprecated since 3.10, 1
the icon name to set
procedure Set_Is_Important
(Action : not null access Gtk_Action_Record;
Is_Important : Boolean)
Sets whether the action is important, this attribute is used primarily by toolbar items to decide whether to show a label or not. Since: gtk+ 2.16 Deprecated since 3.10, 1
True to make the action important
procedure Set_Label
(Action : not null access Gtk_Action_Record;
Label : UTF8_String)
Sets the label of Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the label text to set
procedure Set_Sensitive
(Action : not null access Gtk_Action_Record;
Sensitive : Boolean)
Sets the :sensitive property of the action to Sensitive. Note that this doesn't necessarily mean effective sensitivity. See Gtk.Action.Is_Sensitive for that. Since: gtk+ 2.6 Deprecated since 3.10, 1
True to make the action sensitive
procedure Set_Short_Label
(Action : not null access Gtk_Action_Record;
Short_Label : UTF8_String)
Sets a shorter label text on Action. Since: gtk+ 2.16 Deprecated since 3.10, 1
the label text to set
procedure Set_Stock_Id
(Action : not null access Gtk_Action_Record;
Stock_Id : UTF8_String)
Sets the stock id on Action Since: gtk+ 2.16 Deprecated since 3.10, 1
the stock id
procedure Set_Tooltip
(Action : not null access Gtk_Action_Record;
Tooltip : UTF8_String)
Sets the tooltip text on Action Since: gtk+ 2.16 Deprecated since 3.10, 1
the tooltip text
procedure Set_Visible
(Action : not null access Gtk_Action_Record;
Visible : Boolean)
Sets the :visible property of the action to Visible. Note that this doesn't necessarily mean effective visibility. See Gtk.Action.Is_Visible for that. Since: gtk+ 2.6 Deprecated since 3.10, 1
True to make the action visible
procedure Set_Visible_Horizontal
(Action : not null access Gtk_Action_Record;
Visible_Horizontal : Boolean)
Sets whether Action is visible when horizontal Since: gtk+ 2.16 Deprecated since 3.10, 1
whether the action is visible horizontally
procedure Set_Visible_Vertical
(Action : not null access Gtk_Action_Record;
Visible_Vertical : Boolean)
Sets whether Action is visible when vertical Since: gtk+ 2.16 Deprecated since 3.10, 1
whether the action is visible vertically
Short_Label_Property : constant Glib.Properties.Property_String;
A shorter label that may be used on toolbar buttons.
This is an appearance property and thus only applies if Gtk.Activatable.Gtk_Activatable:use-action-appearance is True.
Signal_Activate : constant Glib.Signal_Name := "activate";
The "activate" signal is emitted when the action is activated.
Stock_Id_Property : constant Glib.Properties.Property_String;
The stock icon displayed in widgets representing this action.
This is an appearance property and thus only applies if Gtk.Activatable.Gtk_Activatable:use-action-appearance is True.
Tooltip_Property : constant Glib.Properties.Property_String;
A tooltip for this action.
procedure Unblock_Activate (Action : not null access Gtk_Action_Record)
Reenable activation signals from the action Since: gtk+ 2.16 Deprecated since 3.10, 1
Visible_Horizontal_Property : constant Glib.Properties.Property_Boolean;
Whether the toolbar item is visible when the toolbar is in a horizontal orientation.
Visible_Overflown_Property : constant Glib.Properties.Property_Boolean;
When True, toolitem proxies for this action are represented in the toolbar overflow menu.
Visible_Property : constant Glib.Properties.Property_Boolean;
Whether the action is visible.
Visible_Vertical_Property : constant Glib.Properties.Property_Boolean;
Whether the toolbar item is visible when the toolbar is in a vertical orientation.