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


Xfc::Gtk::StockId Class Reference

A C++ wrapper class for GTK+ stock IDs. More...

#include <xfc/gtk/stockid.hh>

List of all members.

Public Member Functions

Constructors
Accessors

Static Public Attributes

Pre-registered Stock IDs (not all are stock items; some are images only)

Detailed Description

A C++ wrapper class for GTK+ stock IDs.

StockId is a simple class that has two purposes. First, it is a convenient wrapper class that makes it possible to pass character strings to overloaded constructors and functions that already have a character string argument, like a label, such as in Gtk::ImageMenuItem. Second, StockId provides a ready-to-use static StockId for each pre-registered GTK+ stock item, such as Gtk::StockId::OPEN and Gtk::StockId::EXIT. The StockId conversion operator implicitly converts a StockId to a 'const char*' so you can pass a StockId to any function that takes a character string argument.

StockId is derived from Xfc::StackObject so it can only be created on the stack and not dynamically on the heap. StockId does no memory mamangement. It's only member is a const char* which points to the StockId's corresponding GTK+ stock ID string. GTK+ keeps a copy of all pre-registered stock ID strings so local string memory management is not required. When you call Gtk::Stock::add() to register a new stock item GTK+ will store a copy of your stock ID string.

The usual way to use Gtk::StockId is like this:

    void function(const StockId& stockId);
   
    #include <xfc/gtk/stockid.hh>
   
    function(Gtk::StockId::OPEN);
   
    or
   
    function(Gtk::StockId("my_stock_id"));
   
    or
   
    Gtk::StockId stock_id("my_stock_id");
    function(stock_id);


Constructor & Destructor Documentation

Xfc::Gtk::StockId::StockId const char *  stock_id  ) 
 

Constructs a StockId for the stock ID character string stock_id.

Parameters:
stock_id The stock id for a stock item.

Xfc::Gtk::StockId::StockId const String stock_id  ) 
 

Constructs a StockId for the stock ID character string stock_id.

Parameters:
stock_id The stock id for a stock item.

Xfc::Gtk::StockId::StockId const StockId src  ) 
 

Copy constructor.

Parameters:
src Another StockId.


Member Function Documentation

const char* Xfc::Gtk::StockId::c_str  )  const
 

Returns a pointer the stock ID's internal character string.

Returns:
A const pointer to the stock id character string.

StockId& Xfc::Gtk::StockId::operator= const StockId src  ) 
 

Assignment operator.

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

String Xfc::Gtk::StockId::str  )  const
 

Returns the stock id as a String.

Returns:
A String.


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