Action
Object Hierarchy:
Gtk.Action
Gtk.Action
Gtk.Action
GLib.Object
GLib.Object
GLib.Object->Gtk.Action
Gtk.Buildable
Gtk.Buildable
Gtk.Buildable->Gtk.Action
Description:
[
CCode ( type_id =
"gtk_action_get_type ()" ) ]
[
Version ( deprecated =
true , deprecated_since =
"3.10" , replacement =
"GLib.Action" ) ]
public class Action :
Object ,
Buildable
Warning: Action is deprecated since 3.10. Use GLib.Action.
Note:
In GTK+ 3.10, GtkAction has been deprecated. Use Action instead, and associate actions with
Actionable widgets. Use MenuModel for
creating menus with Menu.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 , 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 Action subclasses.
Each action can have one or more proxy widgets. To act as an action proxy, widget needs to implement
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
sensitive and visible . gicon
, icon_name , label ,
short_label and stock_id
properties are only mirorred if proxy widget has
use_action_appearance property set to true .
When the proxy is activated, it should activate its action.
Content:
Properties:
public ActionGroup action_group { owned get ; set ; }
The GtkActionGroup this GtkAction is associated with, or NULL (for
internal use).
public bool always_show_image { get ; set construct ; }
If true , the action's menu item
proxies will ignore the gtk_menu_images setting and always show their
image, if available.
public Icon gicon { get ; set ; }
The Icon displayed in the
Action .
public bool hide_if_empty { get ; set ; }
When TRUE, empty menu proxies for this action are hidden.
public string icon_name { get ; set ; }
The name of the icon from the icon theme.
public bool is_important { get ; set ; }
Whether the action is considered important.
public string label { get ; set ; }
The label used for menu items and buttons that activate this action.
public string name { get ; construct ; }
A unique name for the action.
public bool sensitive { get ; set ; }
Whether the action is enabled.
public string short_label { get ; set ; }
A shorter label that may be used on toolbar buttons.
public string stock_id { get ; set ; }
The stock icon displayed in widgets representing this action.
public string tooltip { get ; set ; }
A tooltip for this action.
public bool visible { get ; set ; }
Whether the action is visible.
public bool visible_horizontal { get ; set ; }
Whether the toolbar item is visible when the toolbar is in a
horizontal orientation.
public bool visible_overflown { get ; set ; }
When true , toolitem proxies for this
action are represented in the toolbar overflow menu.
public bool visible_vertical { get ; set ; }
Whether the toolbar item is visible when the toolbar is in a vertical
orientation.
Creation methods:
Methods:
public void block_activate ()
Disable activation signals from the action
public void connect_accelerator ()
Installs the accelerator for this if
this has an accel path and group.
public virtual void connect_proxy (Widget proxy)
public unowned Widget create_icon (IconSize icon_size)
This function is intended for use by action implementations to create
icons displayed in the proxy widgets.
public virtual unowned Widget create_menu ()
If this provides a
Menu widget as a submenu for the menu item or the toolbar item it creates, this function
returns an instance of that menu.
public virtual unowned Widget create_menu_item ()
Creates a menu item widget that proxies for the given action.
public virtual unowned Widget create_tool_item ()
Creates a toolbar item widget that proxies for the given action.
public void disconnect_accelerator ()
public virtual void disconnect_proxy (Widget proxy)
public unowned Closure get_accel_closure ()
Returns the accel closure for this action.
public unowned string get_accel_path ()
Returns the accel path for this action.
public bool get_always_show_image ()
Returns whether this 's menu item
proxies will always show their image, if available.
public unowned Icon get_gicon ()
Gets the gicon of this .
public unowned string get_icon_name ()
Gets the icon name of this .
public bool get_is_important ()
Checks whether this is important or
not
public unowned string get_label ()
Gets the label text of this .
public unowned SList <Widget > get_proxies ()
Returns the proxy widgets for an action.
public bool get_sensitive ()
Returns whether the action itself is sensitive.
public unowned string get_short_label ()
Gets the short label text of this .
public unowned string get_stock_id ()
Gets the stock id of this .
public unowned string get_tooltip ()
Gets the tooltip text of this .
public bool get_visible ()
Returns whether the action itself is visible.
public bool get_visible_horizontal ()
Checks whether this is visible when
horizontal
public bool get_visible_vertical ()
Checks whether this is visible when
horizontal
public bool is_sensitive ()
Returns whether the action is effectively sensitive.
public bool is_visible ()
Returns whether the action is effectively visible.
public void set_accel_group (AccelGroup ? accel_group)
Sets the AccelGroup in
which the accelerator for this action will be installed.
public void set_accel_path (string accel_path)
Sets the accel path for this action.
public void set_always_show_image (bool always_show)
Sets whether this 's menu item
proxies will ignore the gtk_menu_images setting and always show their
image, if available.
public void set_gicon (Icon icon)
Sets the icon of this .
public void set_icon_name (string icon_name)
Sets the icon name on this
public void set_is_important (bool is_important)
Sets whether the action is important, this attribute is used primarily
by toolbar items to decide whether to show a label or not.
public void set_label (string label)
Sets the label of this .
public void set_sensitive (bool sensitive)
Sets the
sensitive property of the action to sensitive
.
public void set_short_label (string short_label)
Sets a shorter label text on this .
public void set_stock_id (string stock_id)
Sets the stock id on this
public void set_tooltip (string tooltip)
Sets the tooltip text on this
public void set_visible (bool visible)
Sets the visible
property of the action to visible
.
public void set_visible_horizontal (bool visible_horizontal)
Sets whether this is visible when
horizontal
public void set_visible_vertical (bool visible_vertical)
Sets whether this is visible when
vertical
public void unblock_activate ()
Reenable activation signals from the action
Signals:
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref
All known members inherited from interface Gtk.Buildable