Synopsis
#include <gtk/gtk.h>
GtkAction;
GtkAction* gtk_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id);
const gchar* gtk_action_get_name (GtkAction *action);
gboolean gtk_action_is_sensitive (GtkAction *action);
gboolean gtk_action_get_sensitive (GtkAction *action);
void gtk_action_set_sensitive (GtkAction *action,
gboolean sensitive);
gboolean gtk_action_is_visible (GtkAction *action);
gboolean gtk_action_get_visible (GtkAction *action);
void gtk_action_set_visible (GtkAction *action,
gboolean visible);
void gtk_action_activate (GtkAction *action);
GtkWidget* gtk_action_create_icon (GtkAction *action,
GtkIconSize icon_size);
GtkWidget* gtk_action_create_menu_item (GtkAction *action);
GtkWidget* gtk_action_create_tool_item (GtkAction *action);
GtkWidget* gtk_action_create_menu (GtkAction *action);
void gtk_action_connect_proxy (GtkAction *action,
GtkWidget *proxy);
void gtk_action_disconnect_proxy (GtkAction *action,
GtkWidget *proxy);
GSList* gtk_action_get_proxies (GtkAction *action);
void gtk_action_connect_accelerator (GtkAction *action);
void gtk_action_disconnect_accelerator (GtkAction *action);
void gtk_action_block_activate_from (GtkAction *action,
GtkWidget *proxy);
void gtk_action_unblock_activate_from (GtkAction *action,
GtkWidget *proxy);
const gchar* gtk_action_get_accel_path (GtkAction *action);
void gtk_action_set_accel_path (GtkAction *action,
const gchar *accel_path);
GClosure* gtk_action_get_accel_closure (GtkAction *action);
void gtk_action_set_accel_group (GtkAction *action,
GtkAccelGroup *accel_group);
Properties"action-group" GtkActionGroup* : Read / Write "hide-if-empty" gboolean : Read / Write "icon-name" gchar* : Read / Write "is-important" gboolean : Read / Write "label" gchar* : Read / Write "name" gchar* : Read / Write / Construct Only "sensitive" gboolean : Read / Write "short-label" gchar* : Read / Write "stock-id" gchar* : Read / Write "tooltip" gchar* : Read / Write "visible" gboolean : Read / Write "visible-horizontal" gboolean : Read / Write "visible-overflown" gboolean : Read / Write "visible-vertical" gboolean : Read / Write DescriptionActions 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, 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 GtkAction subclasses. Each action can have one or more proxy menu item, toolbar button or other proxy widgets. Proxies mirror the state of the action (text label, tooltip, icon, visible, sensitive, etc), and should change when the action's state changes. When the proxy is activated, it should activate its action. DetailsGtkActiontypedef struct _GtkAction GtkAction; The GtkAction struct contains only private members and should not be accessed directly. gtk_action_new ()GtkAction* gtk_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id);
Creates a new GtkAction object. To add the action to a
GtkActionGroup and set the accelerator for the action,
call
Since 2.4 gtk_action_get_name ()const gchar* gtk_action_get_name (GtkAction *action); Returns the name of the action.
Since 2.4 gtk_action_is_sensitive ()gboolean gtk_action_is_sensitive (GtkAction *action); Returns whether the action is effectively sensitive.
Since 2.4 gtk_action_get_sensitive ()gboolean gtk_action_get_sensitive (GtkAction *action);
Returns whether the action itself is sensitive. Note that this doesn't
necessarily mean effective sensitivity. See
Since 2.4 gtk_action_set_sensitive ()void gtk_action_set_sensitive (GtkAction *action, gboolean sensitive);
Sets the ::sensitive property of the action to
Since 2.6 gtk_action_is_visible ()gboolean gtk_action_is_visible (GtkAction *action); Returns whether the action is effectively visible.
Since 2.4 gtk_action_get_visible ()gboolean gtk_action_get_visible (GtkAction *action);
Returns whether the action itself is visible. Note that this doesn't
necessarily mean effective visibility. See
Since 2.4 gtk_action_set_visible ()void gtk_action_set_visible (GtkAction *action, gboolean visible);
Sets the ::visible property of the action to
Since 2.6 gtk_action_activate ()void gtk_action_activate (GtkAction *action); 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 2.4 gtk_action_create_icon ()GtkWidget* gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size); This function is intended for use by action implementations to create icons displayed in the proxy widgets.
Since 2.4 gtk_action_create_menu_item ()GtkWidget* gtk_action_create_menu_item (GtkAction *action); Creates a menu item widget that proxies for the given action.
Since 2.4 gtk_action_create_tool_item ()GtkWidget* gtk_action_create_tool_item (GtkAction *action); Creates a toolbar item widget that proxies for the given action.
Since 2.4 gtk_action_create_menu ()GtkWidget* gtk_action_create_menu (GtkAction *action);
If
Since 2.12 gtk_action_connect_proxy ()void gtk_action_connect_proxy (GtkAction *action, GtkWidget *proxy); Connects a widget to an action object as a proxy. Synchronises various properties of the action with the widget (such as label text, icon, tooltip, etc), and attaches a callback so that the action gets activated when the proxy widget does. If the widget is already connected to an action, it is disconnected first.
Since 2.4 gtk_action_disconnect_proxy ()void gtk_action_disconnect_proxy (GtkAction *action, GtkWidget *proxy); Disconnects a proxy widget from an action. Does not destroy the widget, however.
Since 2.4 gtk_action_get_proxies ()GSList* gtk_action_get_proxies (GtkAction *action);
Returns the proxy widgets for an action.
See also
Since 2.4 gtk_action_connect_accelerator ()void gtk_action_connect_accelerator (GtkAction *action);
Installs the accelerator for
Since multiple proxies may independently trigger the installation
of the accelerator, the
Since 2.4 gtk_action_disconnect_accelerator ()void gtk_action_disconnect_accelerator (GtkAction *action);
Undoes the effect of one call to
Since 2.4 gtk_action_block_activate_from ()void gtk_action_block_activate_from (GtkAction *action, GtkWidget *proxy);
Disables calls to the This function is intended for use by action implementations.
Since 2.4 gtk_action_unblock_activate_from ()void gtk_action_unblock_activate_from (GtkAction *action, GtkWidget *proxy);
Re-enables calls to the This function is intended for use by action implementations.
Since 2.4 gtk_action_get_accel_path ()const gchar* gtk_action_get_accel_path (GtkAction *action); Returns the accel path for this action.
Since 2.6 gtk_action_set_accel_path ()void gtk_action_set_accel_path (GtkAction *action, const gchar *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.
Note that
Since 2.4 gtk_action_get_accel_closure ()GClosure* gtk_action_get_accel_closure (GtkAction *action); Returns the accel closure for this action.
Since 2.8 gtk_action_set_accel_group ()void gtk_action_set_accel_group (GtkAction *action, GtkAccelGroup *accel_group); Sets the GtkAccelGroup in which the accelerator for this action will be installed.
Since 2.4 Property DetailsThe
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||