]>
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 | ||
57b0987b VS |
33 | // ---------------------------------------------------------------------------- |
34 | // Art clients | |
35 | // ---------------------------------------------------------------------------- | |
36 | ||
37 | #define wxART_TOOLBAR _T("toolbar_C") | |
38 | #define wxART_MENU _T("menu_C") | |
39 | #define wxART_FRAME_ICON _T("frame_icon_C") | |
40 | ||
41 | #define wxART_CMN_DIALOG _T("cmn_dialog_C") | |
42 | #define wxART_HELP_BROWSER _T("help_browser_C") | |
43 | ||
44 | #define wxART_OTHER _T("other_C") | |
45 | ||
46 | // ---------------------------------------------------------------------------- | |
47 | // Art IDs | |
48 | // ---------------------------------------------------------------------------- | |
49 | ||
50 | #define wxART_ADD_BOOKMARK _T("add_bookmark") | |
51 | #define wxART_DEL_BOOKMARK _T("del_bookmark") | |
52 | #define wxART_HELP_SIDE_PANEL _T("help_side_panel") | |
53 | #define wxART_HELP_SETTINGS _T("help_settings") | |
54 | #define wxART_HELP_BOOK _T("help_book") | |
55 | #define wxART_HELP_FOLDER _T("help_folder") | |
56 | #define wxART_HELP_PAGE _T("help_page") | |
57 | #define wxART_GO_BACK _T("go_back") | |
58 | #define wxART_GO_FORWARD _T("go_forward") | |
59 | #define wxART_GO_UP _T("go_up") | |
60 | #define wxART_GO_DOWN _T("go_down") | |
61 | #define wxART_GO_TO_PARENT _T("go_to_parent") | |
62 | #define wxART_FILE_OPEN _T("file_open") | |
63 | #define wxART_PRINT _T("print") | |
64 | #define wxART_HELP _T("help") | |
65 | #define wxART_TIP _T("tip") | |
66 | ||
2aca4a98 VS |
67 | // ---------------------------------------------------------------------------- |
68 | // wxArtProvider class | |
69 | // ---------------------------------------------------------------------------- | |
70 | ||
71 | class WXDLLEXPORT wxArtProvider : public wxObject | |
72 | { | |
73 | public: | |
74 | // Add new provider to the top of providers stack. | |
75 | static void PushProvider(wxArtProvider *provider); | |
76 | ||
77 | // Remove latest added provider and delete it. | |
78 | static bool PopProvider(); | |
79 | ||
80 | // Remove provider. The provider must have been added previously! | |
81 | // The provider is _not_ deleted. | |
82 | static bool RemoveProvider(wxArtProvider *provider); | |
83 | ||
84 | // Query the providers for bitmap with given ID and return it. Return | |
85 | // wxNullBitmap if no provider provides it. | |
57b0987b VS |
86 | static wxBitmap GetBitmap(const wxArtID& id, |
87 | const wxArtClient& client = wxART_OTHER, | |
2aca4a98 VS |
88 | const wxSize& size = wxDefaultSize); |
89 | ||
90 | // Query the providers for icon with given ID and return it. Return | |
91 | // wxNullIcon if no provider provides it. | |
57b0987b VS |
92 | static wxIcon GetIcon(const wxArtID& id, |
93 | const wxArtClient& client = wxART_OTHER, | |
2aca4a98 VS |
94 | const wxSize& size = wxDefaultSize); |
95 | ||
96 | // Destroy caches & all providers | |
97 | static void CleanUpProviders(); | |
98 | ||
99 | protected: | |
100 | // Derived classes must override this method to create requested | |
101 | // art resource. This method is called only once per instance's | |
102 | // lifetime for each requested wxArtID. | |
57b0987b VS |
103 | virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id), |
104 | const wxArtClient& WXUNUSED(client), | |
2aca4a98 VS |
105 | const wxSize& WXUNUSED(size)) |
106 | { | |
107 | wxFAIL_MSG(_T("pure virtual method wxArtProvider::CreateBitmap called!")); | |
108 | return wxNullBitmap; | |
109 | } | |
110 | ||
111 | private: | |
112 | // list of providers: | |
113 | static wxArtProvidersList *sm_providers; | |
114 | // art resources cache (so that CreateXXX is not called that often): | |
115 | static wxArtProviderCache *sm_cache; | |
116 | ||
117 | DECLARE_ABSTRACT_CLASS(wxArtProvider) | |
118 | }; | |
119 | ||
120 | ||
2aca4a98 | 121 | #endif // _WX_ARTPROV_H_ |