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


Xfc::Gtk::StockItem Class Reference

A GtkStockItem C++ wrapper class. More...

#include <xfc/gtk/stock.hh>

Inheritance diagram for Xfc::Gtk::StockItem:

Xfc::StackObject List of all members.

Constructors

Public Member Functions

Accessors
Methods

Detailed Description

A GtkStockItem C++ wrapper class.

Stock items represent commonly-used menu or toolbar items such as "Open" or "Exit". Each stock item is identified by a stock ID; stock IDs are just strings. GTK+ provides macros, such as GTK_STOCK_OPEN, to avoid typing mistakes in the strings. XFC wraps the stock ID's in a class called Gtk::StockId. As well as providing constructors, StockId provides convenient ready-to-use static StockId objects, one for each pre-registered GTK+ stock ID, such as Gtk::StockId::OPEN and Gtk::StockId::QUIT.

Applications can register their own stock items in addition to those built-in to GTK+. Each stock ID can be associated with a StockItem, which contains the user-visible label, keyboard accelerator, and translation domain of the menu or toolbar item; and/or with an icon stored in an IconFactory. See IconFactory for more information on stock icons. The connection between a StockItem and stock icons is purely conventional (by virtue of using the same stock ID); it's possible to register a stock item but no icon, and vice versa (see Gtk::StockId).

StockItem is derived from Xfc::StackObject, a base class that can only be created on the stack and not dynamically on the heap. In the <demo/gfc-demo> source directory the application.cc file has an example that registers a new stock item and the stockbrowser.cc file has an example that retrieves the values for registered stock items.


Constructor & Destructor Documentation

Xfc::Gtk::StockItem::StockItem ( const StockId stock_id,
const String label,
const String domain = 0 
)

Constructs a new StockItem initialized with the specified values; This item should be registered with Gtk::Stock::add().

Parameters:
stock_id The string identifier for the stock item.
label The user-visible label.
domain The translation domain.
If the item already exists with the same stock ID as one of the items, the old item gets replaced. This stock item will have no accelerator key.

Xfc::Gtk::StockItem::StockItem ( const StockId stock_id,
const String label,
const AccelKey accel_key,
const String domain = 0 
)

Constructs a new StockItem initialized with the specified values; This item should be registered with Gtk::Stock::add().

Parameters:
stock_id The string identifier for the stock item.
label The user-visible label.
accel_key An AccelKey that holds the accelerator modifier and key values to set.
domain The translation domain.
If the item already exists with the same stock ID as one of the items, the old item gets replaced.

Xfc::Gtk::StockItem::StockItem ( const StockId stock_id,
const String label,
Gdk::ModifierTypeField  modifier,
unsigned int  key,
const String domain = 0 
)

Constructs a new StockItem initialized with the specified values; This item should be registered with Gtk::Stock::add().

Parameters:
stock_id The string identifier for the stock item.
label The user-visible label.
modifier The modifier combination of the accelerator.
key The key value of the accelerator
domain The translation domain.
If the item already exists with the same stock ID as one of the items, the old item gets replaced.

Xfc::Gtk::StockItem::StockItem ( const StockItem src  ) 

Copy constructor.

Parameters:
src Another stock item.


Member Function Documentation

StockItem& Xfc::Gtk::StockItem::operator= ( const StockItem src  ) 

Assignment operator.

Parameters:
src Another stock item.
Returns:
A reference to the modified stock item, after assignment.

void Xfc::Gtk::StockItem::set ( const StockId stock_id,
const String label,
Gdk::ModifierTypeField  modifier,
unsigned int  key,
const String domain 
)

Sets the values for the stock item.

Parameters:
stock_id The string identifier for the stock item.
label The user-visible label.
modifier The modifier combination of the accelerator.
key The key value of the accelerator
domain The translation domain.


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