]>
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // --------------------------------------------------------------------------- | |
13 | // headers | |
14 | // --------------------------------------------------------------------------- | |
15 | ||
16 | #ifdef __GNUG__ | |
17 | #pragma implementation "artprov.h" | |
18 | #endif | |
19 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #if defined(__BORLANDC__) | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #include "wx/artprov.h" | |
28 | #include "wx/module.h" | |
29 | ||
30 | // ---------------------------------------------------------------------------- | |
31 | // wxDefaultArtProvider | |
32 | // ---------------------------------------------------------------------------- | |
33 | ||
34 | class wxDefaultArtProvider : public wxArtProvider | |
35 | { | |
36 | protected: | |
37 | virtual wxBitmap CreateBitmap(const wxArtDomain& domain, | |
38 | const wxArtID& id, const wxSize& size); | |
39 | }; | |
40 | ||
41 | #define BEGIN_DOMAIN(domainId) if ( domain == domainId ) { | |
42 | #define END_DOMAIN() } | |
43 | #define ART_ID(artId, xpmRc) if ( id == artId ) return wxBitmap(xpmRc##_xpm); | |
44 | ||
45 | // ---------------------------------------------------------------------------- | |
46 | // wxDefaultArtProviderModule | |
47 | // ---------------------------------------------------------------------------- | |
48 | ||
49 | class wxDefaultArtProviderModule: public wxModule | |
50 | { | |
51 | public: | |
52 | bool OnInit() | |
53 | { | |
54 | wxArtProvider::PushProvider(new wxDefaultArtProvider); | |
55 | return TRUE; | |
56 | } | |
57 | void OnExit() {} | |
58 | ||
59 | DECLARE_DYNAMIC_CLASS(wxDefaultArtProviderModule) | |
60 | }; | |
61 | ||
62 | IMPLEMENT_DYNAMIC_CLASS(wxDefaultArtProviderModule, wxModule) | |
63 | ||
64 | ||
65 | // ---------------------------------------------------------------------------- | |
66 | // XPMs with the art | |
67 | // ---------------------------------------------------------------------------- | |
68 | ||
69 | // XPM hack: make the arrays const | |
70 | #define static static const | |
71 | ||
72 | #if wxUSE_HTML | |
73 | #include "../../art/wxhtml/addbookm.xpm" | |
74 | #include "../../art/wxhtml/delbookm.xpm" | |
75 | #include "../../art/wxhtml/navig.xpm" | |
76 | #include "../../art/wxhtml/settings.xpm" | |
77 | #include "../../art/wxhtml/book.xpm" | |
78 | #include "../../art/wxhtml/folder.xpm" | |
79 | #include "../../art/wxhtml/page.xpm" | |
80 | #endif // wxUSE_HTML | |
81 | ||
82 | #include "../../art/browser/back.xpm" | |
83 | #include "../../art/browser/forward.xpm" | |
84 | #include "../../art/browser/up.xpm" | |
85 | #include "../../art/browser/down.xpm" | |
86 | #include "../../art/browser/toparent.xpm" | |
87 | ||
88 | #include "../../art/toolbar/fileopen.xpm" | |
89 | #include "../../art/toolbar/print.xpm" | |
90 | ||
91 | #include "../../art/framicon/help.xpm" | |
92 | ||
93 | #undef static | |
94 | ||
95 | // ---------------------------------------------------------------------------- | |
96 | // CreateBitmap routine | |
97 | // ---------------------------------------------------------------------------- | |
98 | ||
99 | wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtDomain& domain, | |
100 | const wxArtID& id, | |
101 | const wxSize& size) | |
102 | { | |
103 | #if wxUSE_HTML | |
104 | BEGIN_DOMAIN(wxART_WXHTML) | |
105 | ART_ID(wxART_ADD_BOOKMARK, addbookm) | |
106 | ART_ID(wxART_DEL_BOOKMARK, delbookm) | |
107 | ART_ID(wxART_NAVIG_PANEL, navig) | |
108 | ART_ID(wxART_HELP_SETTINGS, settings) | |
109 | ART_ID(wxART_HELP_BOOK, book) | |
110 | ART_ID(wxART_HELP_FOLDER, folder) | |
111 | ART_ID(wxART_HELP_PAGE, page) | |
112 | END_DOMAIN() | |
113 | #endif // wxUSE_HTML | |
114 | ||
115 | BEGIN_DOMAIN(wxART_BROWSER_TOOLBAR) | |
116 | ART_ID(wxART_GO_BACK, back) | |
117 | ART_ID(wxART_GO_FORWARD, forward) | |
118 | ART_ID(wxART_GO_UP, up) | |
119 | ART_ID(wxART_GO_DOWN, down) | |
120 | ART_ID(wxART_GO_TO_PARENT, toparent) | |
121 | END_DOMAIN() | |
122 | ||
123 | BEGIN_DOMAIN(wxART_TOOLBAR) | |
124 | ART_ID(wxART_FILE_OPEN, fileopen) | |
125 | ART_ID(wxART_PRINT, print) | |
126 | END_DOMAIN() | |
127 | ||
128 | BEGIN_DOMAIN(wxART_FRAME_ICON) | |
129 | ART_ID(wxART_HELP, help) | |
130 | END_DOMAIN() | |
131 | ||
132 | return wxNullBitmap; | |
133 | } |