11.24Class GtkAction

An action which can be triggered by a menu or toolbar item

Class GtkAction( name, [label],[tooltip],[stock_id] )
name A unique name for the action
label the label displayed in menu items and on buttons
tooltip a tooltip for the action
stock_id the stock icon to display in widgets representing the action

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)

The action will also have some state information:

- visible (shown/hidden)

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.

Methods
activateEmits the "activate" signal on the specified action, if it isn't insensitive.
block_activateDisable activation signals from the action
connect_acceleratorInstalls the accelerator for action if action has an accel path and group.
create_iconThis function is intended for use by action implementations to create icons displayed in the proxy widgets.
create_menuIf 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.
create_menu_itemCreates a menu item widget that proxies for the given action.
create_tool_itemCreates a toolbar item widget that proxies for the given action.
disconnect_acceleratorUndoes the effect of one call to connect_accelerator().
get_accel_pathReturns the accel path for this action.
get_always_show_imageReturns whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.
get_icon_nameGets the icon name of action.
get_is_importantChecks whether action is important or not
get_labelGets the label text of action.
get_nameReturns the name of the action.
get_proxiesReturns the proxy widgets for an action.
get_sensitiveReturns whether the action itself is sensitive.
get_short_labelGets the short label text of action.
get_stock_idGets the stock id of action.
get_tooltipGets the tooltip text of action.
get_visibleReturns whether the action itself is visible.
get_visible_horizontalChecks whether action is visible when horizontal
get_visible_verticalChecks whether action is visible when horizontal
is_sensitiveReturns whether the action is effectively sensitive.
is_visibleReturns whether the action is effectively visible.
set_accel_pathSets the accel path for this action.
set_always_show_imageSets whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.
set_icon_nameSets the icon name on action
set_is_importantSets whether the action is important.
set_labelSets the label of action.
set_sensitiveSets the sensitive property of the action to sensitive.
set_short_labelSets a shorter label text on action.
set_stock_idSets the stock id on action
set_tooltipSets the tooltip text on action
set_visibleSets the visible property of the action to visible.
set_visible_horizontalSets whether action is visible when horizontal
set_visible_verticalSets whether action is visible when vertical
signal_activateThe "activate" signal is emitted when the action is activated.
unblock_activateReenable activation signals from the action

Methods

activate

Emits the "activate" signal on the specified action, if it isn't insensitive.

GtkAction.activate()

This gets called by the proxy widgets when they get activated.

It can also be used to manually activate an action.

block_activate

Disable activation signals from the action

GtkAction.block_activate()

This is needed when updating the state of your proxy GtkActivatable widget could result in calling gtk_action_activate(), this is a convenience function to avoid recursing in those cases (updating toggle state for instance).

connect_accelerator

Installs the accelerator for action if action has an accel path and group.

GtkAction.connect_accelerator()

See set_accel_path() and 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 disconnect_accelerator() has been called as many times.

create_icon

This function is intended for use by action implementations to create icons displayed in the proxy widgets.

GtkAction.create_icon( icon_size )
icon_size the size of the icon that should be created (GtkIconSize).
Returna widget that displays the icon for this action (GtkImage).

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.

GtkAction.create_menu()
Returnthe menu item provided by the action (GtkMenu), or nil.

create_menu_item

Creates a menu item widget that proxies for the given action.

GtkAction.create_menu_item()
Returna menu item connected to the action (GtkMenuItem).

create_tool_item

Creates a toolbar item widget that proxies for the given action.

GtkAction.create_tool_item()
Returna toolbar item connected to the action (GtkToolItem).

disconnect_accelerator

Undoes the effect of one call to connect_accelerator().

GtkAction.disconnect_accelerator()

get_accel_path

Returns the accel path for this action.

GtkAction.get_accel_path()
Returnthe accel path for this action, or nil if none is set.

get_always_show_image

Returns whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.

GtkAction.get_always_show_image()
Returntrue if the menu item proxies will always show their image

get_icon_name

Gets the icon name of action.

GtkAction.get_icon_name()
Returnthe icon name.

get_is_important

Checks whether action is important or not

GtkAction.get_is_important()
Returnwhether action is important

get_label

Gets the label text of action.

GtkAction.get_label()
Returnthe label text

get_name

Returns the name of the action.

GtkAction.get_name()
Returnthe name of the action

get_proxies

Returns the proxy widgets for an action.

GtkAction.get_proxies()
Returnan array of proxy widgets (GtkWidget).

See also gtk_widget_get_action().

get_sensitive

Returns whether the action itself is sensitive.

GtkAction.get_sensitive()
Returntrue if the action itself is sensitive.

Note that this doesn't necessarily mean effective sensitivity. See is_sensitive() for that.

get_short_label

Gets the short label text of action.

GtkAction.get_short_label()
Returnthe short label text

get_stock_id

Gets the stock id of action.

GtkAction.get_stock_id()
Returnthe stock id

get_tooltip

Gets the tooltip text of action.

GtkAction.get_tooltip()
Returnthe tooltip text

get_visible

Returns whether the action itself is visible.

GtkAction.get_visible()
Returntrue if the action itself is visible.

Note that this doesn't necessarily mean effective visibility. See is_sensitive() for that.

get_visible_horizontal

Checks whether action is visible when horizontal

GtkAction.get_visible_horizontal()
Returnwhether action is visible when horizontal

get_visible_vertical

Checks whether action is visible when horizontal

GtkAction.get_visible_vertical()
Returnwhether action is visible when horizontal

is_sensitive

Returns whether the action is effectively sensitive.

GtkAction.is_sensitive()
Returntrue if the action and its associated action group are both sensitive.

is_visible

Returns whether the action is effectively visible.

GtkAction.is_visible()
Returntrue if the action and its associated action group are both visible.

set_accel_path

Sets the accel path for this action.

GtkAction.set_accel_path( accel_path )
accel_path the accelerator path (string)

All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent.

set_always_show_image

Sets whether action's menu item proxies will ignore the "gtk-menu-images" setting and always show their image, if available.

GtkAction.set_always_show_image()

Use this if the menu item would be useless or hard to use without their image.

set_icon_name

Sets the icon name on action

GtkAction.set_icon_name( icon_name )
icon_name the icon name to set

set_is_important

Sets whether the action is important.

GtkAction.set_is_important( is_important )
is_important TRUE to make the action important

This attribute is used primarily by toolbar items to decide whether to show a label or not.

set_label

Sets the label of action.

GtkAction.set_label( label )
label the label text to set

set_sensitive

Sets the sensitive property of the action to sensitive.

GtkAction.set_sensitive( sensitive )
sensitive true to make the action sensitive

Note that this doesn't necessarily mean effective sensitivity. See is_sensitive() for that.

set_short_label

Sets a shorter label text on action.

GtkAction.set_short_label( short_label )
short_label the label text to set

set_stock_id

Sets the stock id on action

GtkAction.set_stock_id( stock_id )
stock_id the stock id

set_tooltip

Sets the tooltip text on action

GtkAction.set_tooltip( tooltip )
tooltip the tooltip text

set_visible

Sets the visible property of the action to visible.

GtkAction.set_visible( true )
true to make the action visible

Note that this doesn't necessarily mean effective visibility. See is_visible() for that.

set_visible_horizontal

Sets whether action is visible when horizontal

GtkAction.set_visible_horizontal( visible_horizontal )
visible_horizontal whether the action is visible horizontally

set_visible_vertical

Sets whether action is visible when vertical

GtkAction.set_visible_vertical( visible_vertical )
visible_vertical whether the action is visible vertically

signal_activate

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

GtkAction.signal_activate()

unblock_activate

Reenable activation signals from the action

GtkAction.unblock_activate()
Made with http://www.falconpl.org