Xfce Foundation Classes
Main Page | Index | Namespace 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

- StockId ()
    Constructs an empty StockId.
- StockId (const char *stock_id)
    Constructs a StockId for the stock ID character string stock_id.
- StockId (const String &stock_id)
    Constructs a StockId for the stock ID character string stock_id.
- StockId (const StockId &src)
    Copy constructor.
- ~StockId ()
    Destructor.
- StockId & operator= (const StockId &src)
    Assignment operator.

Accessors

- String str () const
    Returns the stock id as a String.
- const char * c_str () const
    Returns a pointer the stock ID's internal character string.
- operator const char * () const
    Conversion operator; safely converts a StockId to a 'const char' pointer.

## Static Public Attributes

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

- const StockId DIALOG_AUTHENTICATION
    stock indentifier: "gtk-dialog-authentication"
- const StockId DIALOG_INFO
    stock indentifier: "gtk-dialog-info"
- const StockId DIALOG_WARNING
    stock indentifier: "gtk-dialog-warning"
- const StockId DIALOG_ERROR
    stock indentifier: "gtk-dialog-error"
- const StockId DIALOG_QUESTION
    stock indentifier: "gtk-dialog-question"
- const StockId DND
    stock indentifier: "gtk-dnd"
- const StockId DND_MULTIPLE
    stock indentifier: "gtk-dnd-multiple"
- const StockId ABOUT
    stock indentifier: "gtk-about"
- const StockId ADD
    stock indentifier: "gtk-add"
- const StockId APPLY
    stock indentifier: "gtk-apply"
- const StockId BOLD
    stock indentifier: "gtk-bold"
- const StockId CANCEL
    stock indentifier: "gtk-cancel"
- const StockId CDROM
    stock indentifier: "gtk-cdrom"
- const StockId CLEAR
    stock indentifier: "gtk-clear"
- const StockId CLOSE
    stock indentifier: "gtk-close"
- const StockId COLOR_PICKER
    stock indentifier: "gtk-color-picker"
- const StockId CONNECT
    stock indentifier: "gtk-connect"
- const StockId CONVERT
    stock indentifier: "gtk-convert"
- const StockId COPY
    stock indentifier: "gtk-copy"
- const StockId CUT
    stock indentifier: "gtk-cut"
- const StockId DELETE
    stock indentifier: "gtk-delete"
- const StockId DIRECTORY
    stock indentifier: "gtk-directory"
- const StockId DISCONNECT
    stock indentifier: "gtk-disconnect"
- const StockId EDIT
    stock indentifier: "gtk-edit"
- const StockId EXECUTE
    stock indentifier: "gtk-execute"
- const StockId FILE
    stock indentifier: "gtk-file"
- const StockId FIND
    stock indentifier: "gtk-find"
- const StockId FIND_AND_REPLACE
    stock indentifier: "gtk-find-and-replace"
- const StockId FLOPPY
    stock indentifier: "gtk-floppy"
- const StockId GOTO_BOTTOM
    stock indentifier: "gtk-goto-bottom"
- const StockId GOTO_FIRST
    stock indentifier: "gtk-goto-first"
- const StockId GOTO_LAST
    stock indentifier: gtk-goto-last"
- const StockId GOTO_TOP
    stock indentifier: "gtk-goto-top"
- const StockId GO_BACK
    stock indentifier: "gtk-go-back"
- const StockId GO_DOWN
    stock indentifier: "gtk-go-down"
- const StockId GO_FORWARD
    stock indentifier: "gtk-go-forward"
- const StockId GO_UP
    stock indentifier: "gtk-go-up"
- const StockId HARDDISK
    stock indentifier: "gtk-harddisk"
- const StockId HELP
    stock indentifier: "gtk-help"
- const StockId HOME
    stock indentifier: "gtk-home"
- const StockId INDEX
    stock indentifier: "gtk-index"
- const StockId INDENT
    stock indentifier: "gtk-indent"
- const StockId UNINDENT
    stock indentifier: "gtk-unindent"
- const StockId ITALIC
    stock indentifier: "gtk-italic"
- const StockId JUMP_TO
    stock indentifier: "gtk-jump-to"
- const StockId JUSTIFY_CENTER
    stock indentifier: "gtk-justify-center"
- const StockId JUSTIFY_FILL
    stock indentifier: "gtk-justify-fill"
- const StockId JUSTIFY_LEFT
    stock indentifier: "gtk-justify-left"
- const StockId JUSTIFY_RIGHT
    stock indentifier: "gtk-justify-right"
- const StockId MISSING_IMAGE
    stock indentifier: "gtk-missing-image"
- const StockId MEDIA_FORWARD
    stock indentifier: "gtk-media-forward"
- const StockId MEDIA_NEXT
    stock indentifier: "gtk-media-next"
- const StockId MEDIA_PAUSE
    stock indentifier: "gtk-media-pause"
- const StockId MEDIA_PLAY
    stock indentifier: "gtk-media-play"
- const StockId MEDIA_PREVIOUS
    stock indentifier: "gtk-media-previous"
- const StockId MEDIA_RECORD
    stock indentifier: "gtk-media-record"
- const StockId MEDIA_REWIND
    stock indentifier: "gtk-media-rewind"
- const StockId MEDIA_STOP
    stock indentifier: "gtk-media-stop"
- const StockId NETWORK
    stock indentifier: "gtk-network"
- const StockId NEW
    stock indentifier: "gtk-new"
- const StockId NO
    stock indentifier: "gtk-no"
- const StockId OK
    stock indentifier: "gtk-ok"
- const StockId OPEN
    stock indentifier: "gtk-open"
- const StockId PASTE
    stock indentifier: "gtk-paste"
- const StockId PREFERENCES
    stock indentifier: "gtk-preferences"
- const StockId PRINT
    stock indentifier: "gtk-print"
- const StockId PRINT_PREVIEW
    stock indentifier: "gtk-print-preview"
- const StockId PROPERTIES
    stock indentifier: "gtk-properties"
- const StockId QUIT
    stock indentifier: "gtk-quit"
- const StockId REDO
    stock indentifier: "gtk-redo"
- const StockId REFRESH
    stock indentifier: "gtk-refresh"
- const StockId REMOVE
    stock indentifier: "gtk-remove"
- const StockId REVERT_TO_SAVED
    stock indentifier: "gtk-revert-to-saved"
- const StockId SAVE
    stock indentifier: "gtk-save"
- const StockId SAVE_AS
    stock indentifier: "gtk-save-as"
- const StockId SELECT_COLOR
    stock indentifier: "gtk-select-color"
- const StockId SELECT_FONT
    stock indentifier: "gtk-select-font"
- const StockId SORT_ASCENDING
    stock indentifier: "gtk-sort-ascending"
- const StockId SORT_DESCENDING
    stock indentifier: "gtk-sort-descending"
- const StockId SPELL_CHECK
    stock indentifier: "gtk-spell-check"
- const StockId STOP
    stock indentifier: "gtk-stop"
- const StockId STRIKETHROUGH
    stock indentifier: "gtk-strikethrough"
- const StockId UNDELETE
    stock indentifier: "gtk-undelete"
- const StockId UNDERLINE
    stock indentifier: "gtk-undo"
- const StockId UNDO
    stock indentifier: "gtk-yes"
- const StockId YES
    stock indentifier: "gtk-yes"
- const StockId ZOOM_100
    stock indentifier: "gtk-zoom-100"
- const StockId ZOOM_FIT
    stock indentifier: "gtk-zoom-fit"
- const StockId ZOOM_IN
    stock indentifier: "gtk-zoom-in"
- const StockId ZOOM_OUT
    stock indentifier: "gtk-zoom-out"

## 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:

- stockid.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3