]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: common/stockitem.cpp | |
3 | // Purpose: Stock buttons, menu and toolbar items labels | |
4 | // Author: Vaclav Slavik | |
5 | // Modified by: | |
6 | // Created: 2004-08-15 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Vaclav Slavik, 2004 | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "stockitem.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #include "wx/stockitem.h" | |
32 | #include "wx/intl.h" | |
33 | ||
34 | wxString wxGetStockItemLabel(wxStockItemID item) | |
35 | { | |
36 | #define STOCKITEM(stockid, label) \ | |
37 | case stockid: \ | |
38 | return label; | |
39 | ||
40 | switch (item) | |
41 | { | |
42 | STOCKITEM(wxSTOCK_ADD, _("Add")) | |
43 | STOCKITEM(wxSTOCK_APPLY, _("&Apply")) | |
44 | STOCKITEM(wxSTOCK_BOLD, _("&Bold")) | |
45 | STOCKITEM(wxSTOCK_CANCEL, _("&Cancel")) | |
46 | STOCKITEM(wxSTOCK_CLEAR, _("&Clear")) | |
47 | STOCKITEM(wxSTOCK_CLOSE, _("&Close")) | |
48 | STOCKITEM(wxSTOCK_COPY, _("&Copy")) | |
49 | STOCKITEM(wxSTOCK_CUT, _("Cu&t")) | |
50 | STOCKITEM(wxSTOCK_DELETE, _("&Delete")) | |
51 | STOCKITEM(wxSTOCK_FIND, _("&Find")) | |
52 | STOCKITEM(wxSTOCK_FIND_AND_REPLACE, _("Find and rep&lace")) | |
53 | STOCKITEM(wxSTOCK_GO_BACK, _("&Back")) | |
54 | STOCKITEM(wxSTOCK_GO_DOWN, _("&Down")) | |
55 | STOCKITEM(wxSTOCK_GO_FORWARD, _("&Forward")) | |
56 | STOCKITEM(wxSTOCK_GO_UP, _("&Up")) | |
57 | STOCKITEM(wxSTOCK_HELP, _("&Help")) | |
58 | STOCKITEM(wxSTOCK_HOME, _("&Home")) | |
59 | STOCKITEM(wxSTOCK_INDENT, _("Indent")) | |
60 | STOCKITEM(wxSTOCK_INDEX, _("&Index")) | |
61 | STOCKITEM(wxSTOCK_ITALIC, _("&Italic")) | |
62 | STOCKITEM(wxSTOCK_JUSTIFY_CENTER, _("Centered")) | |
63 | STOCKITEM(wxSTOCK_JUSTIFY_FILL, _("Justified")) | |
64 | STOCKITEM(wxSTOCK_JUSTIFY_LEFT, _("Align Left")) | |
65 | STOCKITEM(wxSTOCK_JUSTIFY_RIGHT, _("Align Right")) | |
66 | STOCKITEM(wxSTOCK_NEW, _("&New")) | |
67 | STOCKITEM(wxSTOCK_NO, _("&No")) | |
68 | STOCKITEM(wxSTOCK_OK, _("&OK")) | |
69 | STOCKITEM(wxSTOCK_OPEN, _("&Open")) | |
70 | STOCKITEM(wxSTOCK_PASTE, _("&Paste")) | |
71 | STOCKITEM(wxSTOCK_PREFERENCES, _("&Preferences")) | |
72 | STOCKITEM(wxSTOCK_PRINT, _("&Print")) | |
73 | STOCKITEM(wxSTOCK_PRINT_PREVIEW, _("Print previe&w")) | |
74 | STOCKITEM(wxSTOCK_PROPERTIES, _("&Properties")) | |
75 | STOCKITEM(wxSTOCK_QUIT, _("&Quit")) | |
76 | STOCKITEM(wxSTOCK_REDO, _("&Redo")) | |
77 | STOCKITEM(wxSTOCK_REFRESH, _("Refresh")) | |
78 | STOCKITEM(wxSTOCK_REMOVE, _("Remove")) | |
79 | STOCKITEM(wxSTOCK_REVERT_TO_SAVED, _("Revert to Saved")) | |
80 | STOCKITEM(wxSTOCK_SAVE, _("&Save")) | |
81 | STOCKITEM(wxSTOCK_SAVE_AS, _("Save &As...")) | |
82 | STOCKITEM(wxSTOCK_STOP, _("&Stop")) | |
83 | STOCKITEM(wxSTOCK_UNDELETE, _("Undelete")) | |
84 | STOCKITEM(wxSTOCK_UNDERLINE, _("&Underline")) | |
85 | STOCKITEM(wxSTOCK_UNDO, _("&Undo")) | |
86 | STOCKITEM(wxSTOCK_UNINDENT, _("&Unindent")) | |
87 | STOCKITEM(wxSTOCK_YES, _("&Yes")) | |
88 | STOCKITEM(wxSTOCK_ZOOM_100, _("&Actual Size")) | |
89 | STOCKITEM(wxSTOCK_ZOOM_FIT, _("Zoom to &Fit")) | |
90 | STOCKITEM(wxSTOCK_ZOOM_IN, _("Zoom &In")) | |
91 | STOCKITEM(wxSTOCK_ZOOM_OUT, _("Zoom &Out")) | |
92 | ||
93 | case wxSTOCK_NONE: | |
94 | default: | |
95 | wxFAIL_MSG( _T("invalid stock item ID") ); | |
96 | break; | |
97 | }; | |
98 | ||
99 | #undef STOCKITEM | |
100 | ||
101 | return wxEmptyString; | |
102 | } | |
103 | ||
104 | ||
105 | #ifdef __WXGTK20__ | |
106 | ||
107 | #include <gtk/gtk.h> | |
108 | ||
109 | const char *wxStockItemToGTK(wxStockItemID item) | |
110 | { | |
111 | #define STOCKITEM(stockid) \ | |
112 | case wx##stockid: \ | |
113 | return GTK_##stockid; | |
114 | ||
115 | #define STOCKITEM_MISSING(stockid) \ | |
116 | case wx##stockid: \ | |
117 | return NULL; | |
118 | ||
119 | #if GTK_CHECK_VERSION(2,4,0) | |
120 | #define STOCKITEM_24(stockid) STOCKITEM(stockid) | |
121 | #else | |
122 | #define STOCKITEM_24(stockid) STOCKITEM_MISSING(stockid) | |
123 | #endif | |
124 | ||
125 | switch (item) | |
126 | { | |
127 | STOCKITEM(STOCK_ADD) | |
128 | STOCKITEM(STOCK_APPLY) | |
129 | STOCKITEM(STOCK_BOLD) | |
130 | STOCKITEM(STOCK_CANCEL) | |
131 | STOCKITEM(STOCK_CLEAR) | |
132 | STOCKITEM(STOCK_CLOSE) | |
133 | STOCKITEM(STOCK_COPY) | |
134 | STOCKITEM(STOCK_CUT) | |
135 | STOCKITEM(STOCK_DELETE) | |
136 | STOCKITEM(STOCK_FIND) | |
137 | STOCKITEM(STOCK_FIND_AND_REPLACE) | |
138 | STOCKITEM(STOCK_GO_BACK) | |
139 | STOCKITEM(STOCK_GO_DOWN) | |
140 | STOCKITEM(STOCK_GO_FORWARD) | |
141 | STOCKITEM(STOCK_GO_UP) | |
142 | STOCKITEM(STOCK_HELP) | |
143 | STOCKITEM(STOCK_HOME) | |
144 | STOCKITEM_24(STOCK_INDENT) | |
145 | STOCKITEM(STOCK_INDEX) | |
146 | STOCKITEM(STOCK_ITALIC) | |
147 | STOCKITEM(STOCK_JUSTIFY_CENTER) | |
148 | STOCKITEM(STOCK_JUSTIFY_FILL) | |
149 | STOCKITEM(STOCK_JUSTIFY_LEFT) | |
150 | STOCKITEM(STOCK_JUSTIFY_RIGHT) | |
151 | STOCKITEM(STOCK_NEW) | |
152 | STOCKITEM(STOCK_NO) | |
153 | STOCKITEM(STOCK_OK) | |
154 | STOCKITEM(STOCK_OPEN) | |
155 | STOCKITEM(STOCK_PASTE) | |
156 | STOCKITEM(STOCK_PREFERENCES) | |
157 | STOCKITEM(STOCK_PRINT) | |
158 | STOCKITEM(STOCK_PRINT_PREVIEW) | |
159 | STOCKITEM(STOCK_PROPERTIES) | |
160 | STOCKITEM(STOCK_QUIT) | |
161 | STOCKITEM(STOCK_REDO) | |
162 | STOCKITEM(STOCK_REFRESH) | |
163 | STOCKITEM(STOCK_REMOVE) | |
164 | STOCKITEM(STOCK_REVERT_TO_SAVED) | |
165 | STOCKITEM(STOCK_SAVE) | |
166 | STOCKITEM(STOCK_SAVE_AS) | |
167 | STOCKITEM(STOCK_STOP) | |
168 | STOCKITEM(STOCK_UNDELETE) | |
169 | STOCKITEM(STOCK_UNDERLINE) | |
170 | STOCKITEM(STOCK_UNDO) | |
171 | STOCKITEM_24(STOCK_UNINDENT) | |
172 | STOCKITEM(STOCK_YES) | |
173 | STOCKITEM(STOCK_ZOOM_100) | |
174 | STOCKITEM(STOCK_ZOOM_FIT) | |
175 | STOCKITEM(STOCK_ZOOM_IN) | |
176 | STOCKITEM(STOCK_ZOOM_OUT) | |
177 | ||
178 | case wxSTOCK_NONE: | |
179 | default: | |
180 | wxFAIL_MSG( _T("invalid stock item ID") ); | |
181 | break; | |
182 | }; | |
183 | ||
184 | #undef STOCKITEM | |
185 | ||
186 | return NULL; | |
187 | } | |
188 | ||
189 | #endif // __WXGTK20__ |