GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gtk::Action Class Reference

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

#include <gfc/gtk/action.hh>

Inheritance diagram for GFC::Gtk::Action:

GFC::G::Object GFC::G::TypeInstance GFC::Trackable GFC::Gtk::ToggleAction GFC::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.


Constructor & Destructor Documentation

GFC::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).

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

Constructs a new Action object.

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().

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

Constructs a new Action object.

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().

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

Constructs a new Action object.

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 GFC::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 GFC::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 GFC::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 GFC::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* GFC::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* GFC::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* GFC::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 GFC::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 GFC::Gtk::Action::get_name  )  const
 

Gets the name of the action.

Returns:
The name of the action.

bool GFC::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 GFC::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 GFC::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 GFC::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 GFC::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 GFC::Gtk::Action::prop_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 GFC::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 GFC::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 GFC::Gtk::Action::set_tooltip const String tooltip  ) 
 

Sets the tooltip for the action.

Parameters:
tooltip The tooltip to display for the action.

void GFC::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 GFC::Gtk::Action::activate_signal [static, protected]
 

Activate signal (see sig_activate()).

Calls a slot with the signature:

             void function();


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:37 2004 for GFC-UI by doxygen 1.3.8