]> git.saurik.com Git - wxWidgets.git/blame - src/common/stockitem.cpp
accept files in wxHtmlEasyPrinting::{Print,Preview}File, not only URLs
[wxWidgets.git] / src / common / stockitem.cpp
CommitLineData
401e3b6e
VS
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
34wxString wxGetStockItemLabel(wxStockItemID item)
35{
36 #define STOCKITEM(stockid, label) \
37 case stockid: \
38 return label; \
39 break;
40
41 switch (item)
42 {
43 STOCKITEM(wxSTOCK_ADD, _("Add"))
44 STOCKITEM(wxSTOCK_APPLY, _("&Apply"))
45 STOCKITEM(wxSTOCK_BOLD, _("&Bold"))
46 STOCKITEM(wxSTOCK_CANCEL, _("&Cancel"))
47 STOCKITEM(wxSTOCK_CLEAR, _("&Clear"))
48 STOCKITEM(wxSTOCK_CLOSE, _("&Close"))
49 STOCKITEM(wxSTOCK_COPY, _("&Copy"))
50 STOCKITEM(wxSTOCK_CUT, _("Cu&t"))
51 STOCKITEM(wxSTOCK_DELETE, _("&Delete"))
52 STOCKITEM(wxSTOCK_FIND, _("&Find"))
53 STOCKITEM(wxSTOCK_FIND_AND_REPLACE, _("Find and rep&lace"))
54 STOCKITEM(wxSTOCK_GO_BACK, _("&Back"))
55 STOCKITEM(wxSTOCK_GO_DOWN, _("&Down"))
56 STOCKITEM(wxSTOCK_GO_FORWARD, _("&Forward"))
57 STOCKITEM(wxSTOCK_GO_UP, _("&Up"))
58 STOCKITEM(wxSTOCK_HELP, _("&Help"))
59 STOCKITEM(wxSTOCK_HOME, _("&Home"))
60 STOCKITEM(wxSTOCK_INDENT, _("Indent"))
61 STOCKITEM(wxSTOCK_INDEX, _("&Index"))
62 STOCKITEM(wxSTOCK_ITALIC, _("&Italic"))
63 STOCKITEM(wxSTOCK_JUSTIFY_CENTER, _("Centered"))
64 STOCKITEM(wxSTOCK_JUSTIFY_FILL, _("Justified"))
65 STOCKITEM(wxSTOCK_JUSTIFY_LEFT, _("Align Left"))
66 STOCKITEM(wxSTOCK_JUSTIFY_RIGHT, _("Align Right"))
67 STOCKITEM(wxSTOCK_NEW, _("&New"))
68 STOCKITEM(wxSTOCK_NO, _("&No"))
69 STOCKITEM(wxSTOCK_OK, _("&OK"))
70 STOCKITEM(wxSTOCK_OPEN, _("&Open"))
71 STOCKITEM(wxSTOCK_PASTE, _("&Paste"))
72 STOCKITEM(wxSTOCK_PREFERENCES, _("&Preferences"))
73 STOCKITEM(wxSTOCK_PRINT, _("&Print"))
74 STOCKITEM(wxSTOCK_PRINT_PREVIEW, _("Print previe&w"))
75 STOCKITEM(wxSTOCK_PROPERTIES, _("&Properties"))
76 STOCKITEM(wxSTOCK_QUIT, _("&Quit"))
77 STOCKITEM(wxSTOCK_REDO, _("&Redo"))
78 STOCKITEM(wxSTOCK_REFRESH, _("Refresh"))
79 STOCKITEM(wxSTOCK_REMOVE, _("Remove"))
80 STOCKITEM(wxSTOCK_REVERT_TO_SAVED, _("Revert to Saved"))
81 STOCKITEM(wxSTOCK_SAVE, _("&Save"))
82 STOCKITEM(wxSTOCK_SAVE_AS, _("Save &As..."))
83 STOCKITEM(wxSTOCK_STOP, _("&Stop"))
84 STOCKITEM(wxSTOCK_UNDELETE, _("Undelete"))
85 STOCKITEM(wxSTOCK_UNDERLINE, _("&Underline"))
86 STOCKITEM(wxSTOCK_UNDO, _("&Undo"))
87 STOCKITEM(wxSTOCK_UNINDENT, _("&Unindent"))
88 STOCKITEM(wxSTOCK_YES, _("&Yes"))
89 STOCKITEM(wxSTOCK_ZOOM_100, _("&Actual Size"))
90 STOCKITEM(wxSTOCK_ZOOM_FIT, _("Zoom to &Fit"))
91 STOCKITEM(wxSTOCK_ZOOM_IN, _("Zoom &In"))
92 STOCKITEM(wxSTOCK_ZOOM_OUT, _("Zoom &Out"))
93
94 case wxSTOCK_NONE:
95 default:
96 wxFAIL_MSG( _T("invalid stock item ID") );
97 break;
98 };
99
100 #undef STOCKITEM
101
102 return wxEmptyString;
103}
104
105
106#ifdef __WXGTK20__
107
108#include <gtk/gtk.h>
109
110const char *wxStockItemToGTK(wxStockItemID item)
111{
c20889ab
VS
112 #define STOCKITEM(stockid) \
113 case wx##stockid: \
114 return GTK_##stockid; \
401e3b6e 115 break;
c20889ab
VS
116
117 #define STOCKITEM_MISSING(stockid) \
118 case wx##stockid: \
8334c5b9 119 return NULL; \
c20889ab
VS
120 break;
121
122 #if GTK_CHECK_VERSION(2,4,0)
123 #define STOCKITEM_24(stockid) STOCKITEM(stockid)
124 #else
125 #define STOCKITEM_24(stockid) STOCKITEM_MISSING(stockid)
126 #endif
401e3b6e
VS
127
128 switch (item)
129 {
130 STOCKITEM(STOCK_ADD)
131 STOCKITEM(STOCK_APPLY)
132 STOCKITEM(STOCK_BOLD)
133 STOCKITEM(STOCK_CANCEL)
134 STOCKITEM(STOCK_CLEAR)
135 STOCKITEM(STOCK_CLOSE)
136 STOCKITEM(STOCK_COPY)
137 STOCKITEM(STOCK_CUT)
138 STOCKITEM(STOCK_DELETE)
139 STOCKITEM(STOCK_FIND)
140 STOCKITEM(STOCK_FIND_AND_REPLACE)
141 STOCKITEM(STOCK_GO_BACK)
142 STOCKITEM(STOCK_GO_DOWN)
143 STOCKITEM(STOCK_GO_FORWARD)
144 STOCKITEM(STOCK_GO_UP)
145 STOCKITEM(STOCK_HELP)
146 STOCKITEM(STOCK_HOME)
c20889ab 147 STOCKITEM_24(STOCK_INDENT)
401e3b6e
VS
148 STOCKITEM(STOCK_INDEX)
149 STOCKITEM(STOCK_ITALIC)
150 STOCKITEM(STOCK_JUSTIFY_CENTER)
151 STOCKITEM(STOCK_JUSTIFY_FILL)
152 STOCKITEM(STOCK_JUSTIFY_LEFT)
153 STOCKITEM(STOCK_JUSTIFY_RIGHT)
154 STOCKITEM(STOCK_NEW)
155 STOCKITEM(STOCK_NO)
156 STOCKITEM(STOCK_OK)
157 STOCKITEM(STOCK_OPEN)
158 STOCKITEM(STOCK_PASTE)
159 STOCKITEM(STOCK_PREFERENCES)
160 STOCKITEM(STOCK_PRINT)
161 STOCKITEM(STOCK_PRINT_PREVIEW)
162 STOCKITEM(STOCK_PROPERTIES)
163 STOCKITEM(STOCK_QUIT)
164 STOCKITEM(STOCK_REDO)
165 STOCKITEM(STOCK_REFRESH)
166 STOCKITEM(STOCK_REMOVE)
167 STOCKITEM(STOCK_REVERT_TO_SAVED)
168 STOCKITEM(STOCK_SAVE)
169 STOCKITEM(STOCK_SAVE_AS)
170 STOCKITEM(STOCK_STOP)
171 STOCKITEM(STOCK_UNDELETE)
172 STOCKITEM(STOCK_UNDERLINE)
173 STOCKITEM(STOCK_UNDO)
c20889ab 174 STOCKITEM_24(STOCK_UNINDENT)
401e3b6e
VS
175 STOCKITEM(STOCK_YES)
176 STOCKITEM(STOCK_ZOOM_100)
177 STOCKITEM(STOCK_ZOOM_FIT)
178 STOCKITEM(STOCK_ZOOM_IN)
179 STOCKITEM(STOCK_ZOOM_OUT)
180
181 case wxSTOCK_NONE:
182 default:
183 wxFAIL_MSG( _T("invalid stock item ID") );
184 break;
185 };
186
187 #undef STOCKITEM
188
189 return NULL;
190}
191
192#endif // __WXGTK20__