Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::Action Class Reference

A GtkAction C++ wrapper class. More...

#include <xfc/gtk/action.hh>

Inheritance diagram for Xfc::Gtk::Action:

Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable Xfc::Gtk::ToggleAction Xfc::Gtk::RadioAction List of all members.

Property Prototypes

Signal Prototypes

Public Member Functions

Constructors
Accessors
Methods
Property Proxies
Signal Proxies

Protected Member Functions

Constructors
Methods

Detailed Description

A GtkAction C++ wrapper class.

The Action object represents an action that can be triggered by a menu or toolbar item. Actions are 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.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.

See also: the User Interface Manager HOWTO and example.


Constructor & Destructor Documentation

Xfc::Gtk::Action::Action GtkAction *  action,
bool  owns_reference = true
[explicit, protected]
 

Construct a new Action from an existing GtkAction.

Parameters:
action A pointer to a GtkAction.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The action can be a newly created GtkAction or an existing GtkAction (see G::Object::Object).

Xfc::Gtk::Action::Action const String name,
const String label
 

Constructs a new Action object with a reference count of 1 that the caller owns.

Parameters:
name A unique name for the action.
label The label displayed in menu items and on buttons.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action().

Xfc::Gtk::Action::Action const String name,
const StockId stock_id
 

Constructs a new Action object with a reference count of 1 that the caller owns.

Parameters:
name A unique name for the action.
stock_id The stock icon and label to display in widgets representing the action.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action().

Xfc::Gtk::Action::Action const String name,
const String label,
const StockId stock_id
 

Constructs a new Action object with a reference count of 1 that the caller owns.

Parameters:
name A unique name for the action.
label The label displayed in menu items and on buttons.
stock_id The stock icon to display in widgets representing the action.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action(). Note that label is displayed instead of the stock_id label.


Member Function Documentation

void Xfc::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. It can also be used to manually activate an action.

void Xfc::Gtk::Action::block_activate_from Widget proxy  )  [protected]
 

Disables calls to the activate() method by signals on the given proxy widget.

Parameters:
proxy The action widget.
This is used to break notification loops for things like check or radio actions. This method is intended for use by action implementations.

void Xfc::Gtk::Action::connect_accelerator  ) 
 

Installs the accelerator for the action, if the action has an accelerator path and group (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 method is called and doesn't remove the accelerator until disconnect_accelerator() has been called as many times.

void Xfc::Gtk::Action::connect_proxy Widget proxy  ) 
 

Connects a widget to an action object as a proxy.

Parameters:
proxy The proxy widget
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.

Image* Xfc::Gtk::Action::create_icon IconSize  icon_size  ) 
 

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

Parameters:
icon_size The size of the icon that should be created.
Returns:
A widget that displays the icon for this action.

MenuItem* Xfc::Gtk::Action::create_menu_item  ) 
 

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

Returns:
A menu item connected to the action.

ToolItem* Xfc::Gtk::Action::create_tool_item  ) 
 

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

Returns:
A toolbar item connected to the action.

void Xfc::Gtk::Action::disconnect_proxy Widget proxy  ) 
 

Disconnects a proxy widget from an action but does not destroy the widget.

Parameters:
proxy The proxy widget

String Xfc::Gtk::Action::get_accel_path  )  const
 

Obtains the accelerator path for this action.

Returns:
The accelerator path for this action, or null if none is set.

String Xfc::Gtk::Action::get_name  )  const
 

Gets the name of the action.

Returns:
The name of the action.

bool Xfc::Gtk::Action::get_proxies std::vector< Widget * > &  proxies  )  const
 

Gets a list of the proxy widgets for an action.

Parameters:
proxies A reference to a vector of Widget pointers to hold the proxy list.
Returns:
true if the proxies vector is not empty, false otherwise.

bool Xfc::Gtk::Action::get_sensitive  )  const
 

Determines whether the action itself is sensitive.

Returns:
true if the action itself is sensitive.
Note that this doesn't necessarily mean effective sensitivity (see is_sensitive() for that).

bool Xfc::Gtk::Action::get_visible  )  const
 

Determines whether the action itself is visible.

Returns:
true if the action itself is visible.
Note that this doesn't necessarily mean effective visibility (see is_visible() for that).

bool Xfc::Gtk::Action::is_sensitive  )  const
 

Determines whether the action is effectively sensitive.

Returns:
true if the action and its associated action group are both sensitive.

bool Xfc::Gtk::Action::is_visible  )  const
 

Determines whether the action is effectively visible.

Returns:
true if the action and its associated action group are both visible.

const IsImportantPropertyProxy Xfc::Gtk::Action::property_is_important  ) 
 

Whether the action is considered important.

When TRUE, toolitem proxiesfor this action show text in Gtk::TOOLBAR_BOTH_HORIZ mode (bool : Read / Write).

void Xfc::Gtk::Action::set_accel_group AccelGroup accel_group  ) 
 

Sets the AccelGroup in which the accelerator for this action will be installed (used by action groups).

Parameters:
accel_group An AccelGroup, or null.

void Xfc::Gtk::Action::set_accel_path const String accel_path  ) 
 

Sets the accelerator path for this action (used by action groups).

Parameters:
accel_path The accelerator path.
All proxy widgets associated with the action will have this accel path, so that their accelerators are consistent (use by action groups).

void Xfc::Gtk::Action::set_sensitive bool  sensitive  ) 
 

Sets the "sensitive" property of the action to sensitive.

Parameters:
sensitive Set to true to make the action sensitive.
Note that this doesn't necessarily mean effective sensitivity (see is_sensitive()).

void Xfc::Gtk::Action::set_tooltip const String tooltip  ) 
 

Sets the tooltip for the action.

Parameters:
tooltip The tooltip to display for the action.

void Xfc::Gtk::Action::set_visible bool  visible  ) 
 

Sets the "visible" property of the action to visible.

Parameters:
visible Set to true to make the action visible.
Note that this doesn't necessarily mean effective visibility (see is_visible()).

void Xfc::Gtk::Action::unblock_activate_from Widget proxy  )  [protected]
 

Re-enables calls to the activate() method by signals on the given proxy widget.

Parameters:
proxy The action widget.
This undoes the blocking done by block_activate_from(). This method is intended for use by action implementations.


Member Data Documentation

const ActivateSignalType Xfc::Gtk::Action::activate_signal [static, protected]
 

Activate signal (see signal_activate()).

Calls a slot with the signature:

             void function();


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3