Gtk.Action

Entities

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

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

The action will also have some state information:

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
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Action
Parameters
Interf
Return Value

Action_Group_Property

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

Activate

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

Parameters
Action

Always_Show_Image_Property

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.

Block_Activate

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

Parameters
Action

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Action_Void

type Cb_Gtk_Action_Void is not null access procedure (Self : access Gtk_Action_Record'Class);
Parameters
Self

Connect_Accelerator

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

Parameters
Action

Create_Icon

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

Parameters
Action
Icon_Size

the size of the icon (Gtk.Enums.Gtk_Icon_Size) that should be created.

Return Value

a widget that displays the icon for this action.

Create_Menu

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

Parameters
Action
Return Value

the menu item provided by the action, or null.

Create_Menu_Item

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

Parameters
Action
Return Value

a menu item connected to the action.

Create_Tool_Item

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

Parameters
Action
Return Value

a toolbar item connected to the action.

Disconnect_Accelerator

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

Parameters
Action

G_Icon_Property

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.

Get_Accel_Path

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

Parameters
Action
Return Value

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.

Get_Always_Show_Image

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

Parameters
Action
Return Value

True if the menu item proxies will always show their image

Get_Gicon

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

Parameters
Action
Return Value

The action's Glib.G_Icon.G_Icon if one is set.

Get_Icon_Name

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

Parameters
Action
Return Value

the icon name

Get_Is_Important

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

Parameters
Action
Return Value

whether Action is important

Get_Label

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

Parameters
Action
Return Value

the label text

Get_Name

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

Parameters
Action
Return Value

the name of the action. The string belongs to GTK+ and should not be freed.

Get_Proxies

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

Parameters
Action
Return Value

Get_Sensitive

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

Parameters
Action
Return Value

True if the action itself is sensitive.

Get_Short_Label

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

Parameters
Action
Return Value

the short label text.

Get_Stock_Id

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

Parameters
Action
Return Value

the stock id

Get_Tooltip

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

Parameters
Action
Return Value

the tooltip text

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Visible

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

Parameters
Action
Return Value

True if the action itself is visible.

Get_Visible_Horizontal

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

Parameters
Action
Return Value

whether Action is visible when horizontal

Get_Visible_Vertical

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

Parameters
Action
Return Value

whether Action is visible when horizontal

Gtk_Action

type Gtk_Action is access all Gtk_Action_Record'Class;

Gtk_Action_New

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

Parameters
Name

A unique name for the action

Label

the label displayed in menu items and on buttons, or null

Tooltip

a tooltip for the action, or null

Stock_Id

the stock icon to display in widgets representing the action, or null

Return Value

Gtk_Action_Record

type Gtk_Action_Record is new GObject_Record with null record;

Gtk_New

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.

Parameters
Action
Name

A unique name for the action

Label

the label displayed in menu items and on buttons, or null

Tooltip

a tooltip for the action, or null

Stock_Id

the stock icon to display in widgets representing the action, or null

Hide_If_Empty_Property

Hide_If_Empty_Property : constant Glib.Properties.Property_Boolean;

When TRUE, empty menu proxies for this action are hidden.

Icon_Name_Property

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.

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Action_Record, Gtk_Action);

Initialize

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.

Parameters
Action
Name

A unique name for the action

Label

the label displayed in menu items and on buttons, or null

Tooltip

a tooltip for the action, or null

Stock_Id

the stock icon to display in widgets representing the action, or null

Is_Important_Property

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.

Is_Sensitive

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

Parameters
Action
Return Value

True if the action and its associated action group are both sensitive.

Is_Visible

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

Parameters
Action
Return Value

True if the action and its associated action group are both visible.

Label_Property

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

Name_Property : constant Glib.Properties.Property_String;

A unique name for the action.

On_Activate

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.

Parameters
Self
Call
Slot
After

On_Activate

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.

Parameters
Self
Call
After

Sensitive_Property

Sensitive_Property : constant Glib.Properties.Property_Boolean;

Whether the action is enabled.

Set_Accel_Group

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

Parameters
Action
Accel_Group

a Gtk.Accel_Group.Gtk_Accel_Group or null

Set_Accel_Path

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

Parameters
Action
Accel_Path

the accelerator path

Set_Always_Show_Image

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

Parameters
Action
Always_Show

True if menuitem proxies should always show their image

Set_Gicon

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

Parameters
Action
Icon

the Glib.G_Icon.G_Icon to set

Set_Icon_Name

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

Parameters
Action
Icon_Name

the icon name to set

Set_Is_Important

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

Parameters
Action
Is_Important

True to make the action important

Set_Label

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

Parameters
Action
Label

the label text to set

Set_Sensitive

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

Parameters
Action
Sensitive

True to make the action sensitive

Set_Short_Label

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

Parameters
Action
Short_Label

the label text to set

Set_Stock_Id

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

Parameters
Action
Stock_Id

the stock id

Set_Tooltip

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

Parameters
Action
Tooltip

the tooltip text

Set_Visible

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

Parameters
Action
Visible

True to make the action visible

Set_Visible_Horizontal

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

Parameters
Action
Visible_Horizontal

whether the action is visible horizontally

Set_Visible_Vertical

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

Parameters
Action
Visible_Vertical

whether the action is visible vertically

Short_Label_Property

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

Signal_Activate : constant Glib.Signal_Name := "activate";

The "activate" signal is emitted when the action is activated.

Stock_Id_Property

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

Tooltip_Property : constant Glib.Properties.Property_String;

A tooltip for this action.

Unblock_Activate

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

Parameters
Action

Visible_Horizontal_Property

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

Visible_Overflown_Property : constant Glib.Properties.Property_Boolean;

When True, toolitem proxies for this action are represented in the toolbar overflow menu.

Visible_Property

Visible_Property : constant Glib.Properties.Property_Boolean;

Whether the action is visible.

Visible_Vertical_Property

Visible_Vertical_Property : constant Glib.Properties.Property_Boolean;

Whether the toolbar item is visible when the toolbar is in a vertical orientation.