]>
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 | |
65571936 | 9 | // Licence: wxWindows licence |
2aca4a98 VS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_ARTPROV_H_ | |
13 | #define _WX_ARTPROV_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
2aca4a98 VS |
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; | |
2b5f62a0 | 25 | class wxArtProviderModule; |
2aca4a98 VS |
26 | |
27 | // ---------------------------------------------------------------------------- | |
28 | // Types | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
57b0987b | 31 | typedef wxString wxArtClient; |
2aca4a98 VS |
32 | typedef wxString wxArtID; |
33 | ||
409ded0f | 34 | #define wxART_MAKE_CLIENT_ID_FROM_STR(id) (id + _T("_C")) |
6ada5c33 VS |
35 | #define wxART_MAKE_CLIENT_ID(id) _T(#id) _T("_C") |
36 | #define wxART_MAKE_ART_ID_FROM_STR(id) (id) | |
37 | #define wxART_MAKE_ART_ID(id) _T(#id) | |
db70a2f2 | 38 | |
57b0987b VS |
39 | // ---------------------------------------------------------------------------- |
40 | // Art clients | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
4629016d WS |
43 | #define wxART_TOOLBAR wxART_MAKE_CLIENT_ID(wxART_TOOLBAR) |
44 | #define wxART_MENU wxART_MAKE_CLIENT_ID(wxART_MENU) | |
45 | #define wxART_FRAME_ICON wxART_MAKE_CLIENT_ID(wxART_FRAME_ICON) | |
57b0987b | 46 | |
4629016d WS |
47 | #define wxART_CMN_DIALOG wxART_MAKE_CLIENT_ID(wxART_CMN_DIALOG) |
48 | #define wxART_HELP_BROWSER wxART_MAKE_CLIENT_ID(wxART_HELP_BROWSER) | |
49 | #define wxART_MESSAGE_BOX wxART_MAKE_CLIENT_ID(wxART_MESSAGE_BOX) | |
b5cf8234 | 50 | #define wxART_BUTTON wxART_MAKE_CLIENT_ID(wxART_BUTTON) |
57b0987b | 51 | |
4629016d | 52 | #define wxART_OTHER wxART_MAKE_CLIENT_ID(wxART_OTHER) |
57b0987b VS |
53 | |
54 | // ---------------------------------------------------------------------------- | |
55 | // Art IDs | |
56 | // ---------------------------------------------------------------------------- | |
57 | ||
4629016d WS |
58 | #define wxART_ADD_BOOKMARK wxART_MAKE_ART_ID(wxART_ADD_BOOKMARK) |
59 | #define wxART_DEL_BOOKMARK wxART_MAKE_ART_ID(wxART_DEL_BOOKMARK) | |
60 | #define wxART_HELP_SIDE_PANEL wxART_MAKE_ART_ID(wxART_HELP_SIDE_PANEL) | |
61 | #define wxART_HELP_SETTINGS wxART_MAKE_ART_ID(wxART_HELP_SETTINGS) | |
62 | #define wxART_HELP_BOOK wxART_MAKE_ART_ID(wxART_HELP_BOOK) | |
63 | #define wxART_HELP_FOLDER wxART_MAKE_ART_ID(wxART_HELP_FOLDER) | |
64 | #define wxART_HELP_PAGE wxART_MAKE_ART_ID(wxART_HELP_PAGE) | |
65 | #define wxART_GO_BACK wxART_MAKE_ART_ID(wxART_GO_BACK) | |
66 | #define wxART_GO_FORWARD wxART_MAKE_ART_ID(wxART_GO_FORWARD) | |
67 | #define wxART_GO_UP wxART_MAKE_ART_ID(wxART_GO_UP) | |
68 | #define wxART_GO_DOWN wxART_MAKE_ART_ID(wxART_GO_DOWN) | |
69 | #define wxART_GO_TO_PARENT wxART_MAKE_ART_ID(wxART_GO_TO_PARENT) | |
70 | #define wxART_GO_HOME wxART_MAKE_ART_ID(wxART_GO_HOME) | |
71 | #define wxART_FILE_OPEN wxART_MAKE_ART_ID(wxART_FILE_OPEN) | |
50f65637 VZ |
72 | #define wxART_FILE_SAVE wxART_MAKE_ART_ID(wxART_FILE_SAVE) |
73 | #define wxART_FILE_SAVE_AS wxART_MAKE_ART_ID(wxART_FILE_SAVE_AS) | |
4629016d WS |
74 | #define wxART_PRINT wxART_MAKE_ART_ID(wxART_PRINT) |
75 | #define wxART_HELP wxART_MAKE_ART_ID(wxART_HELP) | |
76 | #define wxART_TIP wxART_MAKE_ART_ID(wxART_TIP) | |
77 | #define wxART_REPORT_VIEW wxART_MAKE_ART_ID(wxART_REPORT_VIEW) | |
78 | #define wxART_LIST_VIEW wxART_MAKE_ART_ID(wxART_LIST_VIEW) | |
79 | #define wxART_NEW_DIR wxART_MAKE_ART_ID(wxART_NEW_DIR) | |
ddf6088b RR |
80 | #define wxART_HARDDISK wxART_MAKE_ART_ID(wxART_HARDDISK) |
81 | #define wxART_FLOPPY wxART_MAKE_ART_ID(wxART_FLOPPY) | |
82 | #define wxART_CDROM wxART_MAKE_ART_ID(wxART_CDROM) | |
83 | #define wxART_REMOVABLE wxART_MAKE_ART_ID(wxART_REMOVABLE) | |
4629016d | 84 | #define wxART_FOLDER wxART_MAKE_ART_ID(wxART_FOLDER) |
ddf6088b | 85 | #define wxART_FOLDER_OPEN wxART_MAKE_ART_ID(wxART_FOLDER_OPEN) |
4629016d WS |
86 | #define wxART_GO_DIR_UP wxART_MAKE_ART_ID(wxART_GO_DIR_UP) |
87 | #define wxART_EXECUTABLE_FILE wxART_MAKE_ART_ID(wxART_EXECUTABLE_FILE) | |
88 | #define wxART_NORMAL_FILE wxART_MAKE_ART_ID(wxART_NORMAL_FILE) | |
89 | #define wxART_TICK_MARK wxART_MAKE_ART_ID(wxART_TICK_MARK) | |
90 | #define wxART_CROSS_MARK wxART_MAKE_ART_ID(wxART_CROSS_MARK) | |
91 | #define wxART_ERROR wxART_MAKE_ART_ID(wxART_ERROR) | |
92 | #define wxART_QUESTION wxART_MAKE_ART_ID(wxART_QUESTION) | |
93 | #define wxART_WARNING wxART_MAKE_ART_ID(wxART_WARNING) | |
94 | #define wxART_INFORMATION wxART_MAKE_ART_ID(wxART_INFORMATION) | |
cba5a276 | 95 | #define wxART_MISSING_IMAGE wxART_MAKE_ART_ID(wxART_MISSING_IMAGE) |
57b0987b | 96 | |
50f65637 VZ |
97 | #define wxART_COPY wxART_MAKE_ART_ID(wxART_COPY) |
98 | #define wxART_CUT wxART_MAKE_ART_ID(wxART_CUT) | |
99 | #define wxART_PASTE wxART_MAKE_ART_ID(wxART_PASTE) | |
100 | #define wxART_DELETE wxART_MAKE_ART_ID(wxART_DELETE) | |
101 | ||
102 | #define wxART_UNDO wxART_MAKE_ART_ID(wxART_UNDO) | |
103 | #define wxART_REDO wxART_MAKE_ART_ID(wxART_REDO) | |
104 | ||
105 | #define wxART_QUIT wxART_MAKE_ART_ID(wxART_QUIT) | |
106 | ||
107 | #define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) | |
108 | #define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) | |
109 | ||
110 | ||
2aca4a98 VS |
111 | // ---------------------------------------------------------------------------- |
112 | // wxArtProvider class | |
113 | // ---------------------------------------------------------------------------- | |
114 | ||
115 | class WXDLLEXPORT wxArtProvider : public wxObject | |
116 | { | |
117 | public: | |
118 | // Add new provider to the top of providers stack. | |
119 | static void PushProvider(wxArtProvider *provider); | |
120 | ||
121 | // Remove latest added provider and delete it. | |
122 | static bool PopProvider(); | |
123 | ||
124 | // Remove provider. The provider must have been added previously! | |
125 | // The provider is _not_ deleted. | |
126 | static bool RemoveProvider(wxArtProvider *provider); | |
4629016d | 127 | |
2aca4a98 VS |
128 | // Query the providers for bitmap with given ID and return it. Return |
129 | // wxNullBitmap if no provider provides it. | |
4629016d | 130 | static wxBitmap GetBitmap(const wxArtID& id, |
57b0987b | 131 | const wxArtClient& client = wxART_OTHER, |
2aca4a98 VS |
132 | const wxSize& size = wxDefaultSize); |
133 | ||
134 | // Query the providers for icon with given ID and return it. Return | |
135 | // wxNullIcon if no provider provides it. | |
57b0987b VS |
136 | static wxIcon GetIcon(const wxArtID& id, |
137 | const wxArtClient& client = wxART_OTHER, | |
2aca4a98 VS |
138 | const wxSize& size = wxDefaultSize); |
139 | ||
2b5f62a0 VZ |
140 | protected: |
141 | friend class wxArtProviderModule; | |
142 | // Initializes default provider | |
143 | static void InitStdProvider(); | |
b5cf8234 VS |
144 | // Initializes platform's native provider, if available (e.g. GTK2) |
145 | static void InitNativeProvider(); | |
2aca4a98 VS |
146 | // Destroy caches & all providers |
147 | static void CleanUpProviders(); | |
148 | ||
4629016d | 149 | // Derived classes must override this method to create requested |
2aca4a98 VS |
150 | // art resource. This method is called only once per instance's |
151 | // lifetime for each requested wxArtID. | |
57b0987b VS |
152 | virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), |
153 | const wxArtClient& WXUNUSED(client), | |
a81c3c23 | 154 | const wxSize& WXUNUSED(size)) = 0; |
2aca4a98 VS |
155 | |
156 | private: | |
157 | // list of providers: | |
158 | static wxArtProvidersList *sm_providers; | |
159 | // art resources cache (so that CreateXXX is not called that often): | |
160 | static wxArtProviderCache *sm_cache; | |
161 | ||
162 | DECLARE_ABSTRACT_CLASS(wxArtProvider) | |
163 | }; | |
164 | ||
165 | ||
2aca4a98 | 166 | #endif // _WX_ARTPROV_H_ |