Gtk.Action
const Gtk = imports.gi.Gtk; let action = new Gtk.Action({ action_group: value, always_show_image: value, gicon: value, hide_if_empty: value, icon_name: value, is_important: value, label: value, name: value, sensitive: value, short_label: value, stock_id: value, tooltip: value, visible: value, visible_horizontal: value, visible_overflown: value, visible_vertical: value, });
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: <itemizedlist> <listitem><para>a name (not translated, for path lookup)</para></listitem> <listitem><para>a label (translated, for display)</para></listitem> <listitem><para>an accelerator</para></listitem> <listitem><para>whether label indicates a stock id</para></listitem> <listitem><para>a tooltip (optional, translated)</para></listitem> <listitem><para>a toolbar label (optional, shorter than label)</para></listitem> </itemizedlist> The action will also have some state information: <itemizedlist> <listitem><para>visible (shown/hidden)</para></listitem> <listitem><para>sensitive (enabled/disabled)</para></listitem> </itemizedlist> Apart from regular actions, there are <link linkend="GtkToggleAction">toggle actions</link>, which can be toggled between two states and <link linkend="GtkRadioAction">radio actions</link>, of which only one in a group can be in the "active" state. Other actions can be implemented as Gtk.Action subclasses.
Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement 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.sensitive and Gtk.visible. Gtk.gicon, Gtk.icon-name, Gtk.label, Gtk.short-label and Gtk.stock-id properties are only mirorred if proxy widget has Gtk.use-action-appearance property set to true.
When the proxy is activated, it should activate its action.
Hierarchy
-
GObject.Object
- Gtk.Action
Methods
- Gtk.Action.prototype.activate
- Gtk.Action.prototype.block_activate
- Gtk.Action.prototype.connect_accelerator
- Gtk.Action.prototype.create_icon
- Gtk.Action.prototype.create_menu
- Gtk.Action.prototype.create_menu_item
- Gtk.Action.prototype.create_tool_item
- Gtk.Action.prototype.disconnect_accelerator
- Gtk.Action.prototype.get_accel_closure
- Gtk.Action.prototype.get_accel_path
- Gtk.Action.prototype.get_always_show_image
- Gtk.Action.prototype.get_gicon
- Gtk.Action.prototype.get_icon_name
- Gtk.Action.prototype.get_is_important
- Gtk.Action.prototype.get_label
- Gtk.Action.prototype.get_name
- Gtk.Action.prototype.get_proxies
- Gtk.Action.prototype.get_sensitive
- Gtk.Action.prototype.get_short_label
- Gtk.Action.prototype.get_stock_id
- Gtk.Action.prototype.get_tooltip
- Gtk.Action.prototype.get_visible
- Gtk.Action.prototype.get_visible_horizontal
- Gtk.Action.prototype.get_visible_vertical
- Gtk.Action.prototype.is_sensitive
- Gtk.Action.prototype.is_visible
- Gtk.Action.prototype.set_accel_group
- Gtk.Action.prototype.set_accel_path
- Gtk.Action.prototype.set_always_show_image
- Gtk.Action.prototype.set_gicon
- Gtk.Action.prototype.set_icon_name
- Gtk.Action.prototype.set_is_important
- Gtk.Action.prototype.set_label
- Gtk.Action.prototype.set_sensitive
- Gtk.Action.prototype.set_short_label
- Gtk.Action.prototype.set_stock_id
- Gtk.Action.prototype.set_tooltip
- Gtk.Action.prototype.set_visible
- Gtk.Action.prototype.set_visible_horizontal
- Gtk.Action.prototype.set_visible_vertical
- Gtk.Action.prototype.unblock_activate