| Top |
| void | ctk_stock_add () |
| void | ctk_stock_add_static () |
| CtkStockItem * | ctk_stock_item_copy () |
| void | ctk_stock_item_free () |
| GSList * | ctk_stock_list_ids () |
| gboolean | ctk_stock_lookup () |
| void | ctk_stock_set_translate_func () |
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 CTK_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 CTK+.
Each stock ID can be associated with a CtkStockItem, 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 CtkIconFactory. The connection between a CtkStockItem 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.
void ctk_stock_add (const CtkStockItem *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 CTK+ does not hold
any pointer into items
and items
can be freed. Use
ctk_stock_add_static() if items
is persistent and CTK+ need not
copy the array.
items |
a CtkStockItem or array of items. |
[array length=n_items] |
n_items |
number of CtkStockItem in |
void ctk_stock_add_static (const CtkStockItem *items,guint n_items);
Same as ctk_stock_add(), but doesn’t copy items
, so
items
must persist until application exit.
items |
a CtkStockItem or array of CtkStockItem. |
[array length=n_items] |
n_items |
number of items |
CtkStockItem *
ctk_stock_item_copy (const CtkStockItem *item);
Copies a stock item, mostly useful for language bindings and not in applications.
[skip]
void
ctk_stock_item_free (CtkStockItem *item);
Frees a stock item allocated on the heap, such as one returned by
ctk_stock_item_copy(). Also frees the fields inside the stock item,
if they are not NULL.
GSList *
ctk_stock_list_ids (void);
Retrieves a list of all known stock IDs added to a CtkIconFactory
or registered with ctk_stock_add(). The list must be freed with g_slist_free(),
and each string in the list must be freed with g_free().
gboolean ctk_stock_lookup (const gchar *stock_id,CtkStockItem *item);
Fills item
with the registered values for stock_id
, returning TRUE
if stock_id
was known.
void ctk_stock_set_translate_func (const gchar *domain,CtkTranslateFunc func,gpointer 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 CtkTranslateFunc uses
the correct domain when calling dgettext(). This can be useful, e.g.
when dealing with message contexts:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
CtkStockItem items[] = { { MY_ITEM1, NC_("odd items", "Item 1"), 0, 0, "odd-item-domain" }, { MY_ITEM2, NC_("even items", "Item 2"), 0, 0, "even-item-domain" }, }; gchar * my_translate_func (const gchar *msgid, gpointer data) { gchar *msgctxt = data; return (gchar*)g_dpgettext2 (GETTEXT_PACKAGE, msgctxt, msgid); } ... ctk_stock_add (items, G_N_ELEMENTS (items)); ctk_stock_set_translate_func ("odd-item-domain", my_translate_func, "odd items"); ctk_stock_set_translate_func ("even-item-domain", my_translate_func, "even items"); |
domain |
the translation domain for which |
|
func |
||
data |
data to pass to |
|
notify |
a GDestroyNotify that is called when |
Since: 2.8
struct CtkStockItem {
gchar *stock_id;
gchar *label;
CdkModifierType modifier;
guint keyval;
gchar *translation_domain;
};
Identifier. |
||
User visible label. |
||
CdkModifierType |
Modifier type for keyboard accelerator |
|
Keyboard accelerator |
||
Translation domain of the menu or toolbar item |
#define CTK_STOCK_CAPS_LOCK_WARNING ((CtkStock)"ctk-caps-lock-warning")
The “Caps Lock Warning” icon.
Since: 2.16
#define CTK_STOCK_COLOR_PICKER ((CtkStock)"ctk-color-picker")
The “Color Picker” item and icon.
Since: 2.2
#define CTK_STOCK_CONNECT ((CtkStock)"ctk-connect")
The “Connect” icon.
Since: 2.6
#define CTK_STOCK_DIALOG_AUTHENTICATION ((CtkStock)"ctk-dialog-authentication")
The “Authentication” item and icon.
Since: 2.4
#define CTK_STOCK_DIALOG_ERROR ((CtkStock)"ctk-dialog-error")
The “Error” item and icon.
#define CTK_STOCK_DIALOG_INFO ((CtkStock)"ctk-dialog-info")
The “Information” item and icon.
#define CTK_STOCK_DIALOG_QUESTION ((CtkStock)"ctk-dialog-question")
The “Question” item and icon.
#define CTK_STOCK_DIALOG_WARNING ((CtkStock)"ctk-dialog-warning")
The “Warning” item and icon.
#define CTK_STOCK_DIRECTORY ((CtkStock)"ctk-directory")
The “Directory” icon.
Since: 2.6
#define CTK_STOCK_DISCARD ((CtkStock)"ctk-discard")
The “Discard” item.
Since: 2.12
#define CTK_STOCK_DISCONNECT ((CtkStock)"ctk-disconnect")
The “Disconnect” icon.
Since: 2.6
#define CTK_STOCK_DND_MULTIPLE ((CtkStock)"ctk-dnd-multiple")
The “Drag-And-Drop multiple” icon.
#define CTK_STOCK_FILE ((CtkStock)"ctk-file")
The “File” item and icon.
Since 3.0, this item has a label, before it only had an icon.
Since: 2.6
#define CTK_STOCK_FIND_AND_REPLACE ((CtkStock)"ctk-find-and-replace")
The “Find and Replace” item and icon.
#define CTK_STOCK_FULLSCREEN ((CtkStock)"ctk-fullscreen")
The “Fullscreen” item and icon.
Since: 2.8
#define CTK_STOCK_GOTO_BOTTOM ((CtkStock)"ctk-goto-bottom")
The “Bottom” item and icon.
#define CTK_STOCK_GOTO_FIRST ((CtkStock)"ctk-goto-first")
The “First” item and icon. The icon has an RTL variant.
#define CTK_STOCK_GOTO_LAST ((CtkStock)"ctk-goto-last")
The “Last” item and icon. The icon has an RTL variant.
#define CTK_STOCK_GO_BACK ((CtkStock)"ctk-go-back")
The “Back” item and icon. The icon has an RTL variant.
#define CTK_STOCK_GO_FORWARD ((CtkStock)"ctk-go-forward")
The “Forward” item and icon. The icon has an RTL variant.
#define CTK_STOCK_HARDDISK ((CtkStock)"ctk-harddisk")
The “Harddisk” item and icon.
Since: 2.4
#define CTK_STOCK_INDENT ((CtkStock)"ctk-indent")
The “Indent” item and icon. The icon has an RTL variant.
Since: 2.4
#define CTK_STOCK_JUMP_TO ((CtkStock)"ctk-jump-to")
The “Jump to” item and icon. The icon has an RTL variant.
#define CTK_STOCK_JUSTIFY_CENTER ((CtkStock)"ctk-justify-center")
The “Center” item and icon.
#define CTK_STOCK_JUSTIFY_FILL ((CtkStock)"ctk-justify-fill")
The “Fill” item and icon.
#define CTK_STOCK_JUSTIFY_LEFT ((CtkStock)"ctk-justify-left")
The “Left” item and icon.
#define CTK_STOCK_JUSTIFY_RIGHT ((CtkStock)"ctk-justify-right")
The “Right” item and icon.
#define CTK_STOCK_LEAVE_FULLSCREEN ((CtkStock)"ctk-leave-fullscreen")
The “Leave Fullscreen” item and icon.
Since: 2.8
#define CTK_STOCK_MEDIA_FORWARD ((CtkStock)"ctk-media-forward")
The “Media Forward” item and icon. The icon has an RTL variant.
Since: 2.6
#define CTK_STOCK_MEDIA_NEXT ((CtkStock)"ctk-media-next")
The “Media Next” item and icon. The icon has an RTL variant.
Since: 2.6
#define CTK_STOCK_MEDIA_PAUSE ((CtkStock)"ctk-media-pause")
The “Media Pause” item and icon.
Since: 2.6
#define CTK_STOCK_MEDIA_PLAY ((CtkStock)"ctk-media-play")
The “Media Play” item and icon. The icon has an RTL variant.
Since: 2.6
#define CTK_STOCK_MEDIA_PREVIOUS ((CtkStock)"ctk-media-previous")
The “Media Previous” item and icon. The icon has an RTL variant.
Since: 2.6
#define CTK_STOCK_MEDIA_RECORD ((CtkStock)"ctk-media-record")
The “Media Record” item and icon.
Since: 2.6
#define CTK_STOCK_MEDIA_REWIND ((CtkStock)"ctk-media-rewind")
The “Media Rewind” item and icon. The icon has an RTL variant.
Since: 2.6
#define CTK_STOCK_MEDIA_STOP ((CtkStock)"ctk-media-stop")
The “Media Stop” item and icon.
Since: 2.6
#define CTK_STOCK_MISSING_IMAGE ((CtkStock)"ctk-missing-image")
The “Missing image” icon.
#define CTK_STOCK_NETWORK ((CtkStock)"ctk-network")
The “Network” item and icon.
Since: 2.4
#define CTK_STOCK_ORIENTATION_LANDSCAPE ((CtkStock)"ctk-orientation-landscape")
The “Landscape Orientation” item and icon.
Since: 2.10
#define CTK_STOCK_ORIENTATION_PORTRAIT ((CtkStock)"ctk-orientation-portrait")
The “Portrait Orientation” item and icon.
Since: 2.10
#define CTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE ((CtkStock)"ctk-orientation-reverse-landscape")
The “Reverse Landscape Orientation” item and icon.
Since: 2.10
#define CTK_STOCK_ORIENTATION_REVERSE_PORTRAIT ((CtkStock)"ctk-orientation-reverse-portrait")
The “Reverse Portrait Orientation” item and icon.
Since: 2.10
#define CTK_STOCK_PAGE_SETUP ((CtkStock)"ctk-page-setup")
The “Page Setup” item and icon.
Since: 2.14
#define CTK_STOCK_PREFERENCES ((CtkStock)"ctk-preferences")
The “Preferences” item and icon.
#define CTK_STOCK_PRINT_ERROR ((CtkStock)"ctk-print-error")
The “Print Error” icon.
Since: 2.14
#define CTK_STOCK_PRINT_PAUSED ((CtkStock)"ctk-print-paused")
The “Print Paused” icon.
Since: 2.14
#define CTK_STOCK_PRINT_PREVIEW ((CtkStock)"ctk-print-preview")
The “Print Preview” item and icon.
#define CTK_STOCK_PRINT_REPORT ((CtkStock)"ctk-print-report")
The “Print Report” icon.
Since: 2.14
#define CTK_STOCK_PRINT_WARNING ((CtkStock)"ctk-print-warning")
The “Print Warning” icon.
Since: 2.14
#define CTK_STOCK_PROPERTIES ((CtkStock)"ctk-properties")
The “Properties” item and icon.
#define CTK_STOCK_REDO ((CtkStock)"ctk-redo")
The “Redo” item and icon. The icon has an RTL variant.
#define CTK_STOCK_REVERT_TO_SAVED ((CtkStock)"ctk-revert-to-saved")
The “Revert” item and icon. The icon has an RTL variant.
#define CTK_STOCK_SELECT_ALL ((CtkStock)"ctk-select-all")
The “Select All” item and icon.
Since: 2.10
#define CTK_STOCK_SELECT_COLOR ((CtkStock)"ctk-select-color")
The “Color” item and icon.
#define CTK_STOCK_SELECT_FONT ((CtkStock)"ctk-select-font")
The “Font” item and icon.
#define CTK_STOCK_SORT_ASCENDING ((CtkStock)"ctk-sort-ascending")
The “Ascending” item and icon.
#define CTK_STOCK_SORT_DESCENDING ((CtkStock)"ctk-sort-descending")
The “Descending” item and icon.
#define CTK_STOCK_SPELL_CHECK ((CtkStock)"ctk-spell-check")
The “Spell Check” item and icon.
#define CTK_STOCK_STRIKETHROUGH ((CtkStock)"ctk-strikethrough")
The “Strikethrough” item and icon.
#define CTK_STOCK_UNDELETE ((CtkStock)"ctk-undelete")
The “Undelete” item and icon. The icon has an RTL variant.
#define CTK_STOCK_UNDERLINE ((CtkStock)"ctk-underline")
The “Underline” item and icon.
#define CTK_STOCK_UNDO ((CtkStock)"ctk-undo")
The “Undo” item and icon. The icon has an RTL variant.
#define CTK_STOCK_UNINDENT ((CtkStock)"ctk-unindent")
The “Unindent” item and icon. The icon has an RTL variant.
Since: 2.4
#define CTK_STOCK_ZOOM_100 ((CtkStock)"ctk-zoom-100")
The “Zoom 100%” item and icon.
#define CTK_STOCK_ZOOM_FIT ((CtkStock)"ctk-zoom-fit")
The “Zoom to Fit” item and icon.