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