Stock Items

Stock Items — Prebuilt common menu/toolbar items and corresponding icons

Synopsis


#include <gtk/gtk.h>


                    GtkStockItem;
void                gtk_stock_add                       (const GtkStockItem *items,
                                                         guint n_items);
void                gtk_stock_add_static                (const GtkStockItem *items,
                                                         guint n_items);
GtkStockItem*       gtk_stock_item_copy                 (const GtkStockItem *item);
void                gtk_stock_item_free                 (GtkStockItem *item);
GSList*             gtk_stock_list_ids                  (void);
gboolean            gtk_stock_lookup                    (const gchar *stock_id,
                                                         GtkStockItem *item);
void                gtk_stock_set_translate_func        (const gchar *domain,
                                                         GtkTranslateFunc func,
                                                         gpointer data,
                                                         GtkDestroyNotify notify);

#define             GTK_STOCK_ABOUT
#define             GTK_STOCK_ADD
#define             GTK_STOCK_APPLY
#define             GTK_STOCK_BOLD
#define             GTK_STOCK_CANCEL
#define             GTK_STOCK_CDROM
#define             GTK_STOCK_CLEAR
#define             GTK_STOCK_CLOSE
#define             GTK_STOCK_COLOR_PICKER
#define             GTK_STOCK_CONVERT
#define             GTK_STOCK_CONNECT
#define             GTK_STOCK_COPY
#define             GTK_STOCK_CUT
#define             GTK_STOCK_DELETE
#define             GTK_STOCK_DIALOG_AUTHENTICATION
#define             GTK_STOCK_DIALOG_ERROR
#define             GTK_STOCK_DIALOG_INFO
#define             GTK_STOCK_DIALOG_QUESTION
#define             GTK_STOCK_DIALOG_WARNING
#define             GTK_STOCK_DIRECTORY
#define             GTK_STOCK_DISCONNECT
#define             GTK_STOCK_DND
#define             GTK_STOCK_DND_MULTIPLE
#define             GTK_STOCK_EDIT
#define             GTK_STOCK_EXECUTE
#define             GTK_STOCK_FILE
#define             GTK_STOCK_FIND
#define             GTK_STOCK_FIND_AND_REPLACE
#define             GTK_STOCK_FLOPPY
#define             GTK_STOCK_FULLSCREEN
#define             GTK_STOCK_GOTO_BOTTOM
#define             GTK_STOCK_GOTO_FIRST
#define             GTK_STOCK_GOTO_LAST
#define             GTK_STOCK_GOTO_TOP
#define             GTK_STOCK_GO_BACK
#define             GTK_STOCK_GO_DOWN
#define             GTK_STOCK_GO_FORWARD
#define             GTK_STOCK_GO_UP
#define             GTK_STOCK_HARDDISK
#define             GTK_STOCK_HELP
#define             GTK_STOCK_HOME
#define             GTK_STOCK_INDENT
#define             GTK_STOCK_INDEX
#define             GTK_STOCK_INFO
#define             GTK_STOCK_ITALIC
#define             GTK_STOCK_JUMP_TO
#define             GTK_STOCK_JUSTIFY_CENTER
#define             GTK_STOCK_JUSTIFY_FILL
#define             GTK_STOCK_JUSTIFY_LEFT
#define             GTK_STOCK_JUSTIFY_RIGHT
#define             GTK_STOCK_LEAVE_FULLSCREEN
#define             GTK_STOCK_MEDIA_FORWARD
#define             GTK_STOCK_MEDIA_NEXT
#define             GTK_STOCK_MEDIA_PAUSE
#define             GTK_STOCK_MEDIA_PLAY
#define             GTK_STOCK_MEDIA_PREVIOUS
#define             GTK_STOCK_MEDIA_RECORD
#define             GTK_STOCK_MEDIA_REWIND
#define             GTK_STOCK_MEDIA_STOP
#define             GTK_STOCK_MISSING_IMAGE
#define             GTK_STOCK_NETWORK
#define             GTK_STOCK_NEW
#define             GTK_STOCK_NO
#define             GTK_STOCK_OK
#define             GTK_STOCK_OPEN
#define             GTK_STOCK_ORIENTATION_LANDSCAPE
#define             GTK_STOCK_ORIENTATION_PORTRAIT
#define             GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE
#define             GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT
#define             GTK_STOCK_PASTE
#define             GTK_STOCK_PREFERENCES
#define             GTK_STOCK_PRINT
#define             GTK_STOCK_PRINT_PREVIEW
#define             GTK_STOCK_PROPERTIES
#define             GTK_STOCK_QUIT
#define             GTK_STOCK_REDO
#define             GTK_STOCK_REFRESH
#define             GTK_STOCK_REMOVE
#define             GTK_STOCK_REVERT_TO_SAVED
#define             GTK_STOCK_SAVE
#define             GTK_STOCK_SAVE_AS
#define             GTK_STOCK_SELECT_ALL
#define             GTK_STOCK_SELECT_COLOR
#define             GTK_STOCK_SELECT_FONT
#define             GTK_STOCK_SORT_ASCENDING
#define             GTK_STOCK_SORT_DESCENDING
#define             GTK_STOCK_SPELL_CHECK
#define             GTK_STOCK_STOP
#define             GTK_STOCK_STRIKETHROUGH
#define             GTK_STOCK_UNDELETE
#define             GTK_STOCK_UNDERLINE
#define             GTK_STOCK_UNDO
#define             GTK_STOCK_UNINDENT
#define             GTK_STOCK_YES
#define             GTK_STOCK_ZOOM_100
#define             GTK_STOCK_ZOOM_FIT
#define             GTK_STOCK_ZOOM_IN
#define             GTK_STOCK_ZOOM_OUT

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.

Details

GtkStockItem

typedef struct {
  gchar *stock_id;
  gchar *label;
  GdkModifierType modifier;
  guint keyval;
  gchar *translation_domain;
} GtkStockItem;


gtk_stock_add ()

void                gtk_stock_add                       (const GtkStockItem *items,
                                                         guint n_items);

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.

items : a GtkStockItem or array of items
n_items : number of GtkStockItem in items

gtk_stock_add_static ()

void                gtk_stock_add_static                (const GtkStockItem *items,
                                                         guint n_items);

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

items : a GtkStockItem or array of GtkStockItem
n_items : number of items

gtk_stock_item_copy ()

GtkStockItem*       gtk_stock_item_copy                 (const GtkStockItem *item);

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

item : a GtkStockItem
Returns : a new GtkStockItem

gtk_stock_item_free ()

void                gtk_stock_item_free                 (GtkStockItem *item);

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.

item : a GtkStockItem

gtk_stock_list_ids ()

GSList*             gtk_stock_list_ids                  (void);

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

Returns : a list of known stock IDs

gtk_stock_lookup ()

gboolean            gtk_stock_lookup                    (const gchar *stock_id,
                                                         GtkStockItem *item);

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

stock_id : a stock item name
item : stock item to initialize with values
Returns : TRUE if item was initialized

gtk_stock_set_translate_func ()

void                gtk_stock_set_translate_func        (const gchar *domain,
                                                         GtkTranslateFunc func,
                                                         gpointer data,
                                                         GtkDestroyNotify notify);

Sets a function to be used for translating the label of a stock item.

If no function is registered for a translation domain, dgettext() is used.

domain : the translation domain for which func shall be used
func : a GtkTranslateFunc
data : data to pass to func
notify : a GtkDestroyNotify that is called when data is no longer needed

Since 2.8


GTK_STOCK_ABOUT

#define GTK_STOCK_ABOUT            "gtk-about"

The "About" item.

Since 2.6


GTK_STOCK_ADD

#define GTK_STOCK_ADD              "gtk-add"

The "Add" item.


GTK_STOCK_APPLY

#define GTK_STOCK_APPLY            "gtk-apply"

The "Apply" item.


GTK_STOCK_BOLD

#define GTK_STOCK_BOLD             "gtk-bold"

The "Bold" item.


GTK_STOCK_CANCEL

#define GTK_STOCK_CANCEL           "gtk-cancel"

The "Cancel" item.


GTK_STOCK_CDROM

#define GTK_STOCK_CDROM            "gtk-cdrom"

The "CD-Rom" item.


GTK_STOCK_CLEAR

#define GTK_STOCK_CLEAR            "gtk-clear"

The "Clear" item.


GTK_STOCK_CLOSE

#define GTK_STOCK_CLOSE            "gtk-close"

The "Close" item.


GTK_STOCK_COLOR_PICKER

#define GTK_STOCK_COLOR_PICKER     "gtk-color-picker"

The "Color Picker" item.

Since 2.2


GTK_STOCK_CONVERT

#define GTK_STOCK_CONVERT          "gtk-convert"

The "Convert" item.


GTK_STOCK_CONNECT

#define GTK_STOCK_CONNECT          "gtk-connect"

The "Connect" icon.

Since 2.6


GTK_STOCK_COPY

#define GTK_STOCK_COPY             "gtk-copy"

The "Copy" item.


GTK_STOCK_CUT

#define GTK_STOCK_CUT              "gtk-cut"

The "Cut" item.


GTK_STOCK_DELETE

#define GTK_STOCK_DELETE           "gtk-delete"

The "Delete" item.


GTK_STOCK_DIALOG_AUTHENTICATION

#define             GTK_STOCK_DIALOG_AUTHENTICATION

The "Authentication" item.

Since 2.4


GTK_STOCK_DIALOG_ERROR

#define GTK_STOCK_DIALOG_ERROR     "gtk-dialog-error"

The "Error" item.


GTK_STOCK_DIALOG_INFO

#define GTK_STOCK_DIALOG_INFO      "gtk-dialog-info"

The "Information" item.


GTK_STOCK_DIALOG_QUESTION

#define GTK_STOCK_DIALOG_QUESTION  "gtk-dialog-question"

The "Question" item.


GTK_STOCK_DIALOG_WARNING

#define GTK_STOCK_DIALOG_WARNING   "gtk-dialog-warning"

The "Warning" item.


GTK_STOCK_DIRECTORY

#define GTK_STOCK_DIRECTORY        "gtk-directory"

The "Directory" icon.

Since 2.6


GTK_STOCK_DISCONNECT

#define GTK_STOCK_DISCONNECT       "gtk-disconnect"

The "Disconnect" icon.

Since 2.6


GTK_STOCK_DND

#define GTK_STOCK_DND              "gtk-dnd"

The "Drag-And-Drop" icon.


GTK_STOCK_DND_MULTIPLE

#define GTK_STOCK_DND_MULTIPLE     "gtk-dnd-multiple"

The "Drag-And-Drop multiple" icon.


GTK_STOCK_EDIT

#define GTK_STOCK_EDIT             "gtk-edit"

The "Edit" item.

Since 2.6


GTK_STOCK_EXECUTE

#define GTK_STOCK_EXECUTE          "gtk-execute"

The "Execute" item.


GTK_STOCK_FILE

#define GTK_STOCK_FILE             "gtk-file"

The "File" icon.

Since 2.6


GTK_STOCK_FIND

#define GTK_STOCK_FIND             "gtk-find"

The "Find" item.


GTK_STOCK_FIND_AND_REPLACE

#define GTK_STOCK_FIND_AND_REPLACE "gtk-find-and-replace"

The "Find and Replace" item.


GTK_STOCK_FLOPPY

#define GTK_STOCK_FLOPPY           "gtk-floppy"

The "Floppy" item.


GTK_STOCK_FULLSCREEN

#define GTK_STOCK_FULLSCREEN       "gtk-fullscreen"

The "Fullscreen" item.

Since 2.8


GTK_STOCK_GOTO_BOTTOM

#define GTK_STOCK_GOTO_BOTTOM      "gtk-goto-bottom"

The "Bottom" item.


GTK_STOCK_GOTO_FIRST

#define GTK_STOCK_GOTO_FIRST       "gtk-goto-first"

The "First" item. RTL variant


GTK_STOCK_GOTO_LAST

#define GTK_STOCK_GOTO_LAST        "gtk-goto-last"

The "Last" item. RTL variant


GTK_STOCK_GOTO_TOP

#define GTK_STOCK_GOTO_TOP         "gtk-goto-top"

The "Top" item.


GTK_STOCK_GO_BACK

#define GTK_STOCK_GO_BACK          "gtk-go-back"

The "Back" item. RTL variant


GTK_STOCK_GO_DOWN

#define GTK_STOCK_GO_DOWN          "gtk-go-down"

The "Down" item.


GTK_STOCK_GO_FORWARD

#define GTK_STOCK_GO_FORWARD       "gtk-go-forward"

The "Forward" item. RTL variant


GTK_STOCK_GO_UP

#define GTK_STOCK_GO_UP            "gtk-go-up"

The "Up" item.


GTK_STOCK_HARDDISK

#define GTK_STOCK_HARDDISK         "gtk-harddisk"

The "Harddisk" item.

Since 2.4


GTK_STOCK_HELP

#define GTK_STOCK_HELP             "gtk-help"

The "Help" item.


GTK_STOCK_HOME

#define GTK_STOCK_HOME             "gtk-home"

The "Home" item.


GTK_STOCK_INDENT

#define GTK_STOCK_INDENT           "gtk-indent"

The "Indent" item. RTL variant

Since 2.4


GTK_STOCK_INDEX

#define GTK_STOCK_INDEX            "gtk-index"

The "Index" item.


GTK_STOCK_INFO

#define GTK_STOCK_INFO             "gtk-info"

The "Info" item.

Since 2.8


GTK_STOCK_ITALIC

#define GTK_STOCK_ITALIC           "gtk-italic"

The "Italic" item.


GTK_STOCK_JUMP_TO

#define GTK_STOCK_JUMP_TO          "gtk-jump-to"

The "Jump to" item. RTL-variant


GTK_STOCK_JUSTIFY_CENTER

#define GTK_STOCK_JUSTIFY_CENTER   "gtk-justify-center"

The "Center" item.


GTK_STOCK_JUSTIFY_FILL

#define GTK_STOCK_JUSTIFY_FILL     "gtk-justify-fill"

The "Fill" item.


GTK_STOCK_JUSTIFY_LEFT

#define GTK_STOCK_JUSTIFY_LEFT     "gtk-justify-left"

The "Left" item.


GTK_STOCK_JUSTIFY_RIGHT

#define GTK_STOCK_JUSTIFY_RIGHT    "gtk-justify-right"

The "Right" item.


GTK_STOCK_LEAVE_FULLSCREEN

#define GTK_STOCK_LEAVE_FULLSCREEN "gtk-leave-fullscreen"

The "Leave Fullscreen" item.

Since 2.8


GTK_STOCK_MEDIA_FORWARD

#define GTK_STOCK_MEDIA_FORWARD    "gtk-media-forward"

The "Media Forward" item. RTL variant

Since 2.6


GTK_STOCK_MEDIA_NEXT

#define GTK_STOCK_MEDIA_NEXT       "gtk-media-next"

The "Media Next" item. RTL variant

Since 2.6


GTK_STOCK_MEDIA_PAUSE

#define GTK_STOCK_MEDIA_PAUSE      "gtk-media-pause"

The "Media Pause" item.

Since 2.6


GTK_STOCK_MEDIA_PLAY

#define GTK_STOCK_MEDIA_PLAY       "gtk-media-play"

The "Media Play" item. RTL variant

Since 2.6


GTK_STOCK_MEDIA_PREVIOUS

#define GTK_STOCK_MEDIA_PREVIOUS   "gtk-media-previous"

The "Media Previous" item. RTL variant

Since 2.6


GTK_STOCK_MEDIA_RECORD

#define GTK_STOCK_MEDIA_RECORD     "gtk-media-record"

The "Media Record" item.

Since 2.6


GTK_STOCK_MEDIA_REWIND

#define GTK_STOCK_MEDIA_REWIND     "gtk-media-rewind"

The "Media Rewind" item. RTL variant

Since 2.6


GTK_STOCK_MEDIA_STOP

#define GTK_STOCK_MEDIA_STOP       "gtk-media-stop"

The "Media Stop" item.

Since 2.6


GTK_STOCK_MISSING_IMAGE

#define GTK_STOCK_MISSING_IMAGE    "gtk-missing-image"

The "Missing image" icon.


GTK_STOCK_NETWORK

#define GTK_STOCK_NETWORK          "gtk-network"

The "Network" item.

Since 2.4


GTK_STOCK_NEW

#define GTK_STOCK_NEW              "gtk-new"

The "New" item.


GTK_STOCK_NO

#define GTK_STOCK_NO               "gtk-no"

The "No" item.


GTK_STOCK_OK

#define GTK_STOCK_OK               "gtk-ok"

The "OK" item.


GTK_STOCK_OPEN

#define GTK_STOCK_OPEN             "gtk-open"

The "Open" item.


GTK_STOCK_ORIENTATION_LANDSCAPE

#define GTK_STOCK_ORIENTATION_LANDSCAPE "gtk-orientation-landscape"

The "Landscape Orientation" item.

Since 2.10


GTK_STOCK_ORIENTATION_PORTRAIT

#define GTK_STOCK_ORIENTATION_PORTRAIT "gtk-orientation-portrait"

The "Portrait Orientation" item.

Since 2.10


GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE

#define GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE "gtk-orientation-reverse-landscape"

The "Reverse Landscape Orientation" item.

Since 2.10


GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT

#define GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT "gtk-orientation-reverse-portrait"

The "Reverse Portrait Orientation" item.

Since 2.10


GTK_STOCK_PASTE

#define GTK_STOCK_PASTE            "gtk-paste"

The "Paste" item.


GTK_STOCK_PREFERENCES

#define GTK_STOCK_PREFERENCES      "gtk-preferences"

The "Preferences" item.


GTK_STOCK_PRINT

#define GTK_STOCK_PRINT            "gtk-print"

The "Print" item.


GTK_STOCK_PRINT_PREVIEW

#define GTK_STOCK_PRINT_PREVIEW    "gtk-print-preview"

The "Print Preview" item.


GTK_STOCK_PROPERTIES

#define GTK_STOCK_PROPERTIES       "gtk-properties"

The "Properties" item.


GTK_STOCK_QUIT

#define GTK_STOCK_QUIT             "gtk-quit"

The "Quit" item.


GTK_STOCK_REDO

#define GTK_STOCK_REDO             "gtk-redo"

The "Redo" item. RTL variant


GTK_STOCK_REFRESH

#define GTK_STOCK_REFRESH          "gtk-refresh"

The "Refresh" item.


GTK_STOCK_REMOVE

#define GTK_STOCK_REMOVE           "gtk-remove"

The "Remove" item.


GTK_STOCK_REVERT_TO_SAVED

#define GTK_STOCK_REVERT_TO_SAVED  "gtk-revert-to-saved"

The "Revert" item. RTL variant


GTK_STOCK_SAVE

#define GTK_STOCK_SAVE             "gtk-save"

The "Save" item.


GTK_STOCK_SAVE_AS

#define GTK_STOCK_SAVE_AS          "gtk-save-as"

The "Save As" item.


GTK_STOCK_SELECT_ALL

#define GTK_STOCK_SELECT_ALL       "gtk-select-all"

The "Select All" item.

Since 2.10


GTK_STOCK_SELECT_COLOR

#define GTK_STOCK_SELECT_COLOR     "gtk-select-color"

The "Color" item.


GTK_STOCK_SELECT_FONT

#define GTK_STOCK_SELECT_FONT      "gtk-select-font"

The "Font" item.


GTK_STOCK_SORT_ASCENDING

#define GTK_STOCK_SORT_ASCENDING   "gtk-sort-ascending"

The "Ascending" item.


GTK_STOCK_SORT_DESCENDING

#define GTK_STOCK_SORT_DESCENDING  "gtk-sort-descending"

The "Descending" item.


GTK_STOCK_SPELL_CHECK

#define GTK_STOCK_SPELL_CHECK      "gtk-spell-check"

The "Spell Check" item.


GTK_STOCK_STOP

#define GTK_STOCK_STOP             "gtk-stop"

The "Stop" item.


GTK_STOCK_STRIKETHROUGH

#define GTK_STOCK_STRIKETHROUGH    "gtk-strikethrough"

The "Strikethrough" item.


GTK_STOCK_UNDELETE

#define GTK_STOCK_UNDELETE         "gtk-undelete"

The "Undelete" item. RTL variant


GTK_STOCK_UNDERLINE

#define GTK_STOCK_UNDERLINE        "gtk-underline"

The "Underline" item.


GTK_STOCK_UNDO

#define GTK_STOCK_UNDO             "gtk-undo"

The "Undo" item. RTL variant


GTK_STOCK_UNINDENT

#define GTK_STOCK_UNINDENT         "gtk-unindent"

The "Unindent" item. RTL variant

Since 2.4


GTK_STOCK_YES

#define GTK_STOCK_YES              "gtk-yes"

The "Yes" item.


GTK_STOCK_ZOOM_100

#define GTK_STOCK_ZOOM_100         "gtk-zoom-100"

The "Zoom 100%" item.


GTK_STOCK_ZOOM_FIT

#define GTK_STOCK_ZOOM_FIT         "gtk-zoom-fit"

The "Zoom to Fit" item.


GTK_STOCK_ZOOM_IN

#define GTK_STOCK_ZOOM_IN          "gtk-zoom-in"

The "Zoom In" item.


GTK_STOCK_ZOOM_OUT

#define GTK_STOCK_ZOOM_OUT         "gtk-zoom-out"

The "Zoom Out" item.