]>
Commit | Line | Data |
---|---|---|
2aca4a98 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: artprov.h | |
3 | // Purpose: wxArtProvider class | |
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 | #ifndef _WX_ARTPROV_H_ | |
13 | #define _WX_ARTPROV_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "artprov.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/string.h" | |
20 | #include "wx/bitmap.h" | |
21 | #include "wx/icon.h" | |
22 | ||
23 | class WXDLLEXPORT wxArtProvidersList; | |
24 | class WXDLLEXPORT wxArtProviderCache; | |
25 | ||
26 | // ---------------------------------------------------------------------------- | |
27 | // Types | |
28 | // ---------------------------------------------------------------------------- | |
29 | ||
57b0987b | 30 | typedef wxString wxArtClient; |
2aca4a98 VS |
31 | typedef wxString wxArtID; |
32 | ||
db70a2f2 VS |
33 | #define wxART_MAKE_CLIENT_ID(id) _T(#id)_T("_C") |
34 | #define wxART_MAKE_ART_ID(id) _T(#id) | |
35 | ||
57b0987b VS |
36 | // ---------------------------------------------------------------------------- |
37 | // Art clients | |
38 | // ---------------------------------------------------------------------------- | |
39 | ||
db70a2f2 VS |
40 | #define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) |
41 | #define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) | |
42 | #define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) | |
57b0987b | 43 | |
db70a2f2 VS |
44 | #define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) |
45 | #define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) | |
46 | #define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) | |
57b0987b | 47 | |
db70a2f2 | 48 | #define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) |
57b0987b VS |
49 | |
50 | // ---------------------------------------------------------------------------- | |
51 | // Art IDs | |
52 | // ---------------------------------------------------------------------------- | |
53 | ||
db70a2f2 VS |
54 | #define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) |
55 | #define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) | |
56 | #define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) | |
57 | #define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) | |
58 | #define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) | |
59 | #define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) | |
60 | #define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) | |
61 | #define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) | |
62 | #define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) | |
63 | #define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) | |
64 | #define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) | |
65 | #define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) | |
66 | #define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) | |
67 | #define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) | |
68 | #define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) | |
69 | #define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) | |
70 | #define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) | |
71 | #define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) | |
72 | #define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) | |
73 | #define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) | |
74 | #define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) | |
75 | #define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) | |
76 | #define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) | |
77 | #define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) | |
78 | #define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) | |
79 | #define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) | |
80 | #define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) | |
81 | #define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) | |
82 | #define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) | |
83 | #define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) | |
57b0987b | 84 | |
2aca4a98 VS |
85 | // ---------------------------------------------------------------------------- |
86 | // wxArtProvider class | |
87 | // ---------------------------------------------------------------------------- | |
88 | ||
89 | class WXDLLEXPORT wxArtProvider : public wxObject | |
90 | { | |
91 | public: | |
92 | // Add new provider to the top of providers stack. | |
93 | static void PushProvider(wxArtProvider *provider); | |
94 | ||
95 | // Remove latest added provider and delete it. | |
96 | static bool PopProvider(); | |
97 | ||
98 | // Remove provider. The provider must have been added previously! | |
99 | // The provider is _not_ deleted. | |
100 | static bool RemoveProvider(wxArtProvider *provider); | |
101 | ||
102 | // Query the providers for bitmap with given ID and return it. Return | |
103 | // wxNullBitmap if no provider provides it. | |
57b0987b VS |
104 | static wxBitmap GetBitmap(const wxArtID& id, |
105 | const wxArtClient& client = wxART_OTHER, | |
2aca4a98 VS |
106 | const wxSize& size = wxDefaultSize); |
107 | ||
108 | // Query the providers for icon with given ID and return it. Return | |
109 | // wxNullIcon if no provider provides it. | |
57b0987b VS |
110 | static wxIcon GetIcon(const wxArtID& id, |
111 | const wxArtClient& client = wxART_OTHER, | |
2aca4a98 VS |
112 | const wxSize& size = wxDefaultSize); |
113 | ||
114 | // Destroy caches & all providers | |
115 | static void CleanUpProviders(); | |
116 | ||
117 | protected: | |
118 | // Derived classes must override this method to create requested | |
119 | // art resource. This method is called only once per instance's | |
120 | // lifetime for each requested wxArtID. | |
57b0987b VS |
121 | virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), |
122 | const wxArtClient& WXUNUSED(client), | |
a81c3c23 | 123 | const wxSize& WXUNUSED(size)) = 0; |
2aca4a98 VS |
124 | |
125 | private: | |
126 | // list of providers: | |
127 | static wxArtProvidersList *sm_providers; | |
128 | // art resources cache (so that CreateXXX is not called that often): | |
129 | static wxArtProviderCache *sm_cache; | |
130 | ||
131 | DECLARE_ABSTRACT_CLASS(wxArtProvider) | |
132 | }; | |
133 | ||
134 | ||
2aca4a98 | 135 | #endif // _WX_ARTPROV_H_ |