StockItem

Description 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, but macros such as GTK_STOCK_OPEN are provided to avoid typing mistakes in the strings. Applications can register their own stock items in addition to those built-in to GTK+. Each stock ID can be associated with a GtkStockItem, which contains the user-visible label, keyboard accelerator, and translation domain of the menu or toolbar item; and/or with an icon stored in a GtkIconFactory. See GtkIconFactory for more information on stock icons. The connection between a GtkStockItem 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. Stock icons may have a RTL variant which gets used for right-to-left locales.

Constructors

this
this(GtkStockItem* gtkStockItem)

Sets our main struct and passes it to the parent class

Members

Functions

add
void add(uint nItems)

Registers each of the stock items in items. If an item already exists with the same stock ID as one of the items, the old item gets replaced. The stock items are copied, so GTK+ does not hold any pointer into items and items can be freed. Use gtk_stock_add_static() if items is persistent and GTK+ need not copy the array.

addStatic
void addStatic(uint nItems)

Same as gtk_stock_add(), but doesn't copy items, so items must persist until application exit.

getStockItemStruct
GtkStockItem* getStockItemStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

itemCopy
StockItem itemCopy()

Copies a stock item, mostly useful for language bindings and not in applications.

itemFree
void itemFree()

Frees a stock item allocated on the heap, such as one returned by gtk_stock_item_copy(). Also frees the fields inside the stock item, if they are not NULL.

Static functions

listIds
ListSG listIds()

Retrieves a list of all known stock IDs added to a GtkIconFactory or registered with gtk_stock_add(). The list must be freed with g_slist_free(), and each string in the list must be freed with g_free().

lookup
int lookup(string stockId, StockItem item)

Fills item with the registered values for stock_id, returning TRUE if stock_id was known.

setTranslateFunc
void setTranslateFunc(string domain, GtkTranslateFunc func, void* data, GDestroyNotify notify)

Sets a function to be used for translating the label of a stock item. If no function is registered for a translation domain, g_dgettext() is used. The function is used for all stock items whose translation_domain matches domain. Note that it is possible to use strings different from the actual gettext translation domain of your application for this, as long as your GtkTranslateFunc uses the correct domain when calling dgettext(). This can be useful, e.g. Since 2.8

Variables

gtkStockItem
GtkStockItem* gtkStockItem;

the main Gtk struct

Meta