]>
Commit | Line | Data |
---|---|---|
2aca4a98 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: artstd.cpp | |
3 | // Purpose: stock wxArtProvider instance with default wxWin art | |
4 | // Author: Vaclav Slavik | |
5 | // Modified by: | |
6 | // Created: 18/03/2002 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Vaclav Slavik | |
65571936 | 9 | // Licence: wxWindows licence |
2aca4a98 VS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // --------------------------------------------------------------------------- | |
13 | // headers | |
14 | // --------------------------------------------------------------------------- | |
15 | ||
2aca4a98 VS |
16 | // For compilers that support precompilation, includes "wx.h". |
17 | #include "wx/wxprec.h" | |
18 | ||
19 | #if defined(__BORLANDC__) | |
20 | #pragma hdrstop | |
21 | #endif | |
22 | ||
66941e14 VS |
23 | #ifndef WX_PRECOMP |
24 | #if WXWIN_COMPATIBILITY_2_2 | |
25 | #include "wx/app.h" | |
26 | #endif | |
27 | #endif | |
28 | ||
2aca4a98 | 29 | #include "wx/artprov.h" |
2aca4a98 | 30 | |
e5f4aeb6 JS |
31 | // For the purposes of forcing this module to link |
32 | char g_ArtProviderModule = 0; | |
33 | ||
2aca4a98 VS |
34 | // ---------------------------------------------------------------------------- |
35 | // wxDefaultArtProvider | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
38 | class wxDefaultArtProvider : public wxArtProvider | |
39 | { | |
40 | protected: | |
57b0987b VS |
41 | virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, |
42 | const wxSize& size); | |
2aca4a98 VS |
43 | }; |
44 | ||
66941e14 VS |
45 | // ---------------------------------------------------------------------------- |
46 | // helper macros | |
47 | // ---------------------------------------------------------------------------- | |
48 | ||
49 | // Standard macro for getting a resource from XPM file: | |
57b0987b VS |
50 | #define ART(artId, xpmRc) \ |
51 | if ( id == artId ) return wxBitmap(xpmRc##_xpm); | |
66941e14 | 52 | |
66941e14 VS |
53 | // There are two ways of getting the standard icon: either via XPMs or via |
54 | // wxIcon ctor. This depends on the platform: | |
55 | #if defined(__WXUNIVERSAL__) | |
56 | #define CREATE_STD_ICON(iconId, xpmRc) return wxNullBitmap; | |
57 | #elif defined(__WXGTK__) || defined(__WXMOTIF__) | |
58 | #define CREATE_STD_ICON(iconId, xpmRc) return wxBitmap(xpmRc##_xpm); | |
59 | #else | |
60 | #define CREATE_STD_ICON(iconId, xpmRc) \ | |
61 | { \ | |
62 | wxIcon icon(_T(iconId)); \ | |
63 | wxBitmap bmp; \ | |
64 | bmp.CopyFromIcon(icon); \ | |
65 | return bmp; \ | |
66 | } | |
67 | #endif | |
68 | ||
69 | // Macro used in CreateBitmap to get wxICON_FOO icons: | |
70 | #define ART_MSGBOX(artId, iconId, xpmRc) \ | |
71 | if ( id == artId ) \ | |
72 | { \ | |
66941e14 VS |
73 | CREATE_STD_ICON(#iconId, xpmRc) \ |
74 | } | |
2aca4a98 VS |
75 | |
76 | // ---------------------------------------------------------------------------- | |
2b5f62a0 | 77 | // wxArtProvider::InitStdProvider |
2aca4a98 VS |
78 | // ---------------------------------------------------------------------------- |
79 | ||
2b5f62a0 | 80 | /*static*/ void wxArtProvider::InitStdProvider() |
2aca4a98 | 81 | { |
2b5f62a0 VZ |
82 | // NB: A few notes about this function: |
83 | // (1) it is in artstd.cpp and not in artprov.cpp on purpose. I wanted | |
84 | // to avoid declaring wxDefaultArtProvider in any public header as | |
85 | // it is only an implementation detail | |
86 | // (2) other default art providers (e.g. GTK one) should NOT be added | |
87 | // here. Instead, add them in port-specific initialialization code | |
88 | ||
89 | wxArtProvider::PushProvider(new wxDefaultArtProvider); | |
90 | } | |
2aca4a98 VS |
91 | |
92 | ||
93 | // ---------------------------------------------------------------------------- | |
94 | // XPMs with the art | |
95 | // ---------------------------------------------------------------------------- | |
96 | ||
97 | // XPM hack: make the arrays const | |
98 | #define static static const | |
99 | ||
66941e14 VS |
100 | #if defined(__WXGTK__) |
101 | #include "../../art/gtk/info.xpm" | |
102 | #include "../../art/gtk/error.xpm" | |
103 | #include "../../art/gtk/warning.xpm" | |
104 | #include "../../art/gtk/question.xpm" | |
105 | #elif defined(__WXMOTIF__) | |
106 | #include "../../art/motif/info.xpm" | |
107 | #include "../../art/motif/error.xpm" | |
108 | #include "../../art/motif/warning.xpm" | |
109 | #include "../../art/motif/question.xpm" | |
110 | #endif | |
111 | ||
2aca4a98 | 112 | #if wxUSE_HTML |
57b0987b VS |
113 | #include "../../art/htmsidep.xpm" |
114 | #include "../../art/htmoptns.xpm" | |
115 | #include "../../art/htmbook.xpm" | |
116 | #include "../../art/htmfoldr.xpm" | |
117 | #include "../../art/htmpage.xpm" | |
214bdb93 | 118 | #include "../../art/missimg.xpm" |
2aca4a98 VS |
119 | #endif // wxUSE_HTML |
120 | ||
57b0987b VS |
121 | #include "../../art/addbookm.xpm" |
122 | #include "../../art/delbookm.xpm" | |
123 | #include "../../art/back.xpm" | |
124 | #include "../../art/forward.xpm" | |
125 | #include "../../art/up.xpm" | |
126 | #include "../../art/down.xpm" | |
127 | #include "../../art/toparent.xpm" | |
128 | #include "../../art/fileopen.xpm" | |
129 | #include "../../art/print.xpm" | |
130 | #include "../../art/helpicon.xpm" | |
131 | #include "../../art/tipicon.xpm" | |
60d2cc25 VS |
132 | #include "../../art/home.xpm" |
133 | #include "../../art/repview.xpm" | |
134 | #include "../../art/listview.xpm" | |
135 | #include "../../art/new_dir.xpm" | |
136 | #include "../../art/folder.xpm" | |
137 | #include "../../art/dir_up.xpm" | |
138 | #include "../../art/exefile.xpm" | |
139 | #include "../../art/deffile.xpm" | |
00958db5 VS |
140 | #include "../../art/tick.xpm" |
141 | #include "../../art/cross.xpm" | |
2aca4a98 VS |
142 | |
143 | #undef static | |
144 | ||
145 | // ---------------------------------------------------------------------------- | |
146 | // CreateBitmap routine | |
147 | // ---------------------------------------------------------------------------- | |
148 | ||
57b0987b | 149 | wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id, |
fc7a2a60 | 150 | const wxArtClient& WXUNUSED(client), |
d84afea9 | 151 | const wxSize& WXUNUSED(size)) |
2aca4a98 | 152 | { |
66941e14 VS |
153 | // wxMessageBox icons: |
154 | ART_MSGBOX(wxART_ERROR, wxICON_ERROR, error) | |
155 | ART_MSGBOX(wxART_INFORMATION, wxICON_INFORMATION, info) | |
156 | ART_MSGBOX(wxART_WARNING, wxICON_WARNING, warning) | |
157 | ART_MSGBOX(wxART_QUESTION, wxICON_QUESTION, question) | |
158 | ||
159 | // standard icons: | |
2aca4a98 | 160 | #if wxUSE_HTML |
57b0987b VS |
161 | ART(wxART_HELP_SIDE_PANEL, htmsidep) |
162 | ART(wxART_HELP_SETTINGS, htmoptns) | |
163 | ART(wxART_HELP_BOOK, htmbook) | |
164 | ART(wxART_HELP_FOLDER, htmfoldr) | |
165 | ART(wxART_HELP_PAGE, htmpage) | |
214bdb93 | 166 | ART(wxART_MISSING_IMAGE, missimg) |
2aca4a98 | 167 | #endif // wxUSE_HTML |
57b0987b VS |
168 | ART(wxART_ADD_BOOKMARK, addbookm) |
169 | ART(wxART_DEL_BOOKMARK, delbookm) | |
170 | ART(wxART_GO_BACK, back) | |
171 | ART(wxART_GO_FORWARD, forward) | |
172 | ART(wxART_GO_UP, up) | |
173 | ART(wxART_GO_DOWN, down) | |
174 | ART(wxART_GO_TO_PARENT, toparent) | |
60d2cc25 | 175 | ART(wxART_GO_HOME, home) |
57b0987b VS |
176 | ART(wxART_FILE_OPEN, fileopen) |
177 | ART(wxART_PRINT, print) | |
178 | ART(wxART_HELP, helpicon) | |
179 | ART(wxART_TIP, tipicon) | |
60d2cc25 VS |
180 | ART(wxART_REPORT_VIEW, repview) |
181 | ART(wxART_LIST_VIEW, listview) | |
182 | ART(wxART_NEW_DIR, new_dir) | |
183 | ART(wxART_FOLDER, folder) | |
184 | ART(wxART_GO_DIR_UP, dir_up) | |
185 | ART(wxART_EXECUTABLE_FILE, exefile) | |
186 | ART(wxART_NORMAL_FILE, deffile) | |
00958db5 VS |
187 | ART(wxART_TICK_MARK, tick) |
188 | ART(wxART_CROSS_MARK, cross) | |
2aca4a98 VS |
189 | |
190 | return wxNullBitmap; | |
191 | } |