Class
GtkAction
Description [src]
class Gtk.Action : GObject.Object
implements Gtk.Buildable {
/* No available fields */
}
In GTK+ 3.10, GtkAction has been deprecated. Use
GAction
instead, and associate actions withGtkActionable
widgets. UseGMenuModel
for creating menus with gtk_menu_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 GtkAction
subclasses.
Each action can have one or more proxy widgets. To act as an action proxy,
widget needs to implement GtkActivatable
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 GtkAction:sensitive
and
GtkAction:visible
. GtkAction:gicon
, GtkAction:icon-name
, GtkAction:label
,
GtkAction:short-label
and GtkAction:stock-id
properties are only mirorred
if proxy widget has GtkActivatable:use-action-appearance
property set to
TRUE
.
When the proxy is activated, it should activate its action.
Constructors
gtk_action_new
Creates a new GtkAction
object. To add the action to a
GtkActionGroup
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.
deprecated: 3.10 since: 2.4
Instance methods
gtk_action_activate
Emits the “activate” signal on the specified action, if it isn’t insensitive. This gets called by the proxy widgets when they get activated.
deprecated: 3.10 since: 2.4
gtk_action_connect_accelerator
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().
deprecated: 3.10 since: 2.4
gtk_action_create_icon
This function is intended for use by action implementations to create icons displayed in the proxy widgets.
deprecated: 3.10 since: 2.4
gtk_action_create_menu
If action
provides a GtkMenu
widget as a submenu for the menu
item or the toolbar item it creates, this function returns an
instance of that menu.
deprecated: 3.10 since: 2.12
gtk_action_create_menu_item
Creates a menu item widget that proxies for the given action.
deprecated: 3.10 since: 2.4
gtk_action_create_tool_item
Creates a toolbar item widget that proxies for the given action.
deprecated: 3.10 since: 2.4
gtk_action_disconnect_accelerator
Undoes the effect of one call to gtk_action_connect_accelerator().
deprecated: 3.10 since: 2.4
gtk_action_get_always_show_image
Returns whether action
‘s menu item proxies will always
show their image, if available.
deprecated: 3.10 since: 2.20
gtk_action_get_proxies
Returns the proxy widgets for an action. See also gtk_activatable_get_related_action().
deprecated: 3.10 since: 2.4
gtk_action_get_sensitive
Returns whether the action itself is sensitive. Note that this doesn’t
necessarily mean effective sensitivity. See gtk_action_is_sensitive()
for that.
deprecated: 3.10 since: 2.4
gtk_action_get_visible
Returns whether the action itself is visible. Note that this doesn’t
necessarily mean effective visibility. See gtk_action_is_sensitive()
for that.
deprecated: 3.10 since: 2.4
gtk_action_get_visible_horizontal
Checks whether action
is visible when horizontal.
deprecated: 3.10 since: 2.16
gtk_action_get_visible_vertical
Checks whether action
is visible when horizontal.
deprecated: 3.10 since: 2.16
gtk_action_is_sensitive
Returns whether the action is effectively sensitive.
deprecated: 3.10 since: 2.4
gtk_action_is_visible
Returns whether the action is effectively visible.
deprecated: 3.10 since: 2.4
gtk_action_set_accel_group
Sets the GtkAccelGroup
in which the accelerator for this action
will be installed.
deprecated: 3.10 since: 2.4
gtk_action_set_accel_path
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.
deprecated: 3.10 since: 2.4
gtk_action_set_always_show_image
Sets whether action
‘s menu item proxies will ignore the
GtkSettings:gtk-menu-images
setting and always show their image, if available.
deprecated: 3.10 since: 2.20
gtk_action_set_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.
deprecated: 3.10 since: 2.16
gtk_action_set_sensitive
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.
deprecated: 3.10 since: 2.6
gtk_action_set_visible
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.
deprecated: 3.10 since: 2.6
gtk_action_set_visible_horizontal
Sets whether action
is visible when horizontal.
deprecated: 3.10 since: 2.16
gtk_action_set_visible_vertical
Sets whether action
is visible when vertical.
deprecated: 3.10 since: 2.16
gtk_action_unblock_activate
Reenable activation signals from the action.
deprecated: 3.10 since: 2.16
Methods inherited from GtkBuildable (10)
gtk_buildable_add_child
Adds a child to buildable
. type
is an optional string
describing how the child should be added.
since: 2.12
gtk_buildable_construct_child
Constructs a child of buildable
with the name name
.
since: 2.12
gtk_buildable_custom_finished
This is similar to gtk_buildable_parser_finished()
but is
called once for each custom tag handled by the buildable
.
since: 2.12
gtk_buildable_custom_tag_end
This is called at the end of each custom element handled by the buildable.
since: 2.12
gtk_buildable_custom_tag_start
This is called for each unknown element under <child>
.
since: 2.12
gtk_buildable_get_internal_child
Get the internal child called childname
of the buildable
object.
since: 2.12
gtk_buildable_get_name
Gets the name of the buildable
object.
since: 2.12
gtk_buildable_parser_finished
Called when the builder finishes the parsing of a
[GtkBuilder UI definition][BUILDER-UI].
Note that this will be called once for each time
gtk_builder_add_from_file()
or gtk_builder_add_from_string()
is called on a builder.
since: 2.12
gtk_buildable_set_buildable_property
Sets the property name name
to value
on the buildable
object.
since: 2.12
gtk_buildable_set_name
Sets the name of the buildable
object.
since: 2.12
Properties
Gtk.Action:action-group
The GtkActionGroup this GtkAction is associated with, or NULL (for internal use).
deprecated: 3.10
Gtk.Action:always-show-image
If TRUE
, the action’s menu item proxies will ignore the GtkSettings:gtk-menu-images
setting and always show their image, if available.
deprecated: 3.10 since: 2.20
Gtk.Action:is-important
Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode.
deprecated: 3.10
Gtk.Action:label
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.
deprecated: 3.10
Gtk.Action:visible-horizontal
Whether the toolbar item is visible when the toolbar is in a horizontal orientation.
deprecated: 3.10
Gtk.Action:visible-overflown
When TRUE
, toolitem proxies for this action are represented in the
toolbar overflow menu.
deprecated: 3.10 since: 2.6
Gtk.Action:visible-vertical
Whether the toolbar item is visible when the toolbar is in a vertical orientation.
deprecated: 3.10
Signals
Gtk.Action::activate
The “activate” signal is emitted when the action is activated.
deprecated: 3.10 since: 2.4
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct GtkActionClass {
GObjectClass parent_class;
void (* activate) (
GtkAction* action
);
GtkWidget* (* create_menu_item) (
GtkAction* action
);
GtkWidget* (* create_tool_item) (
GtkAction* action
);
void (* connect_proxy) (
GtkAction* action,
GtkWidget* proxy
);
void (* disconnect_proxy) (
GtkAction* action,
GtkWidget* proxy
);
GtkWidget* (* create_menu) (
GtkAction* action
);
void (* _gtk_reserved1) (
void
);
void (* _gtk_reserved2) (
void
);
void (* _gtk_reserved3) (
void
);
void (* _gtk_reserved4) (
void
);
}
No description available.
Class members
parent_class: GObjectClass
The parent class.
activate: void (* activate) ( GtkAction* action )
Signal emitted when the action is activated.
create_menu_item: GtkWidget* (* create_menu_item) ( GtkAction* action )
No description available.
create_tool_item: GtkWidget* (* create_tool_item) ( GtkAction* action )
No description available.
connect_proxy: void (* connect_proxy) ( GtkAction* action, GtkWidget* proxy )
No description available.
disconnect_proxy: void (* disconnect_proxy) ( GtkAction* action, GtkWidget* proxy )
No description available.
create_menu: GtkWidget* (* create_menu) ( GtkAction* action )
No description available.
_gtk_reserved1: void (* _gtk_reserved1) ( void )
No description available.
_gtk_reserved2: void (* _gtk_reserved2) ( void )
No description available.
_gtk_reserved3: void (* _gtk_reserved3) ( void )
No description available.
_gtk_reserved4: void (* _gtk_reserved4) ( void )
No description available.
Virtual methods
Gtk.ActionClass.activate
Emits the “activate” signal on the specified action, if it isn’t insensitive. This gets called by the proxy widgets when they get activated.
deprecated: 3.10 since: 2.4
Gtk.ActionClass.create_menu
If action
provides a GtkMenu
widget as a submenu for the menu
item or the toolbar item it creates, this function returns an
instance of that menu.
deprecated: 3.10 since: 2.12
Gtk.ActionClass.create_menu_item
Creates a menu item widget that proxies for the given action.
deprecated: 3.10 since: 2.4
Gtk.ActionClass.create_tool_item
Creates a toolbar item widget that proxies for the given action.
deprecated: 3.10 since: 2.4