1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: stock wxArtProvider instance with default wxWin art
4 // Author: Vaclav Slavik
8 // Copyright: (c) Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ---------------------------------------------------------------------------
14 // ---------------------------------------------------------------------------
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #if defined(__BORLANDC__)
24 #if WXWIN_COMPATIBILITY_2_2
29 #include "wx/artprov.h"
30 #include "wx/module.h"
32 // For the purposes of forcing this module to link
33 char g_ArtProviderModule
= 0;
35 // ----------------------------------------------------------------------------
36 // wxDefaultArtProvider
37 // ----------------------------------------------------------------------------
39 class wxDefaultArtProvider
: public wxArtProvider
42 virtual wxBitmap
CreateBitmap(const wxArtID
& id
, const wxArtClient
& client
,
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 // Standard macro for getting a resource from XPM file:
51 #define ART(artId, xpmRc) \
52 if ( id == artId ) return wxBitmap(xpmRc##_xpm);
54 // Compatibility hack to use wxApp::GetStdIcon of overriden by the user
55 #if WXWIN_COMPATIBILITY_2_2
56 #define GET_STD_ICON_FROM_APP(iconId) \
57 if ( client == wxART_MESSAGE_BOX ) \
59 wxIcon icon = wxTheApp->GetStdIcon(iconId); \
63 bmp.CopyFromIcon(icon); \
68 #define GET_STD_ICON_FROM_APP(iconId)
71 // There are two ways of getting the standard icon: either via XPMs or via
72 // wxIcon ctor. This depends on the platform:
73 #if defined(__WXUNIVERSAL__)
74 #define CREATE_STD_ICON(iconId, xpmRc) return wxNullBitmap;
75 #elif defined(__WXGTK__) || defined(__WXMOTIF__)
76 #define CREATE_STD_ICON(iconId, xpmRc) return wxBitmap(xpmRc##_xpm);
78 #define CREATE_STD_ICON(iconId, xpmRc) \
80 wxIcon icon(_T(iconId)); \
82 bmp.CopyFromIcon(icon); \
87 // Macro used in CreateBitmap to get wxICON_FOO icons:
88 #define ART_MSGBOX(artId, iconId, xpmRc) \
91 GET_STD_ICON_FROM_APP(iconId) \
92 CREATE_STD_ICON(#iconId, xpmRc) \
95 // ----------------------------------------------------------------------------
96 // wxDefaultArtProviderModule
97 // ----------------------------------------------------------------------------
99 class wxDefaultArtProviderModule
: public wxModule
104 wxArtProvider::PushProvider(new wxDefaultArtProvider
);
109 DECLARE_DYNAMIC_CLASS(wxDefaultArtProviderModule
)
112 IMPLEMENT_DYNAMIC_CLASS(wxDefaultArtProviderModule
, wxModule
)
115 // ----------------------------------------------------------------------------
117 // ----------------------------------------------------------------------------
119 // XPM hack: make the arrays const
120 #define static static const
122 #if defined(__WXGTK__)
123 #include "../../art/gtk/info.xpm"
124 #include "../../art/gtk/error.xpm"
125 #include "../../art/gtk/warning.xpm"
126 #include "../../art/gtk/question.xpm"
127 #elif defined(__WXMOTIF__)
128 #include "../../art/motif/info.xpm"
129 #include "../../art/motif/error.xpm"
130 #include "../../art/motif/warning.xpm"
131 #include "../../art/motif/question.xpm"
135 #include "../../art/htmsidep.xpm"
136 #include "../../art/htmoptns.xpm"
137 #include "../../art/htmbook.xpm"
138 #include "../../art/htmfoldr.xpm"
139 #include "../../art/htmpage.xpm"
142 #include "../../art/addbookm.xpm"
143 #include "../../art/delbookm.xpm"
144 #include "../../art/back.xpm"
145 #include "../../art/forward.xpm"
146 #include "../../art/up.xpm"
147 #include "../../art/down.xpm"
148 #include "../../art/toparent.xpm"
149 #include "../../art/fileopen.xpm"
150 #include "../../art/print.xpm"
151 #include "../../art/helpicon.xpm"
152 #include "../../art/tipicon.xpm"
153 #include "../../art/home.xpm"
154 #include "../../art/repview.xpm"
155 #include "../../art/listview.xpm"
156 #include "../../art/new_dir.xpm"
157 #include "../../art/folder.xpm"
158 #include "../../art/dir_up.xpm"
159 #include "../../art/exefile.xpm"
160 #include "../../art/deffile.xpm"
161 #include "../../art/tick.xpm"
162 #include "../../art/cross.xpm"
166 // ----------------------------------------------------------------------------
167 // CreateBitmap routine
168 // ----------------------------------------------------------------------------
170 wxBitmap
wxDefaultArtProvider::CreateBitmap(const wxArtID
& id
,
171 const wxArtClient
& client
,
172 const wxSize
& WXUNUSED(size
))
174 // wxMessageBox icons:
175 ART_MSGBOX(wxART_ERROR
, wxICON_ERROR
, error
)
176 ART_MSGBOX(wxART_INFORMATION
, wxICON_INFORMATION
, info
)
177 ART_MSGBOX(wxART_WARNING
, wxICON_WARNING
, warning
)
178 ART_MSGBOX(wxART_QUESTION
, wxICON_QUESTION
, question
)
182 ART(wxART_HELP_SIDE_PANEL
, htmsidep
)
183 ART(wxART_HELP_SETTINGS
, htmoptns
)
184 ART(wxART_HELP_BOOK
, htmbook
)
185 ART(wxART_HELP_FOLDER
, htmfoldr
)
186 ART(wxART_HELP_PAGE
, htmpage
)
188 ART(wxART_ADD_BOOKMARK
, addbookm
)
189 ART(wxART_DEL_BOOKMARK
, delbookm
)
190 ART(wxART_GO_BACK
, back
)
191 ART(wxART_GO_FORWARD
, forward
)
193 ART(wxART_GO_DOWN
, down
)
194 ART(wxART_GO_TO_PARENT
, toparent
)
195 ART(wxART_GO_HOME
, home
)
196 ART(wxART_FILE_OPEN
, fileopen
)
197 ART(wxART_PRINT
, print
)
198 ART(wxART_HELP
, helpicon
)
199 ART(wxART_TIP
, tipicon
)
200 ART(wxART_REPORT_VIEW
, repview
)
201 ART(wxART_LIST_VIEW
, listview
)
202 ART(wxART_NEW_DIR
, new_dir
)
203 ART(wxART_FOLDER
, folder
)
204 ART(wxART_GO_DIR_UP
, dir_up
)
205 ART(wxART_EXECUTABLE_FILE
, exefile
)
206 ART(wxART_NORMAL_FILE
, deffile
)
207 ART(wxART_TICK_MARK
, tick
)
208 ART(wxART_CROSS_MARK
, cross
)