]> git.saurik.com Git - wxWidgets.git/blob - include/wx/artprov.h
9fb5f85feed65e4269feeba84c05ba4982fb9e85
[wxWidgets.git] / include / wx / artprov.h
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
30 typedef wxString wxArtClient;
31 typedef wxString wxArtID;
32
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_GO_HOME _T("go_home")
63 #define wxART_FILE_OPEN _T("file_open")
64 #define wxART_PRINT _T("print")
65 #define wxART_HELP _T("help")
66 #define wxART_TIP _T("tip")
67 #define wxART_REPORT_VIEW _T("report_view")
68 #define wxART_LIST_VIEW _T("list_view")
69 #define wxART_NEW_DIR _T("new_dir")
70 #define wxART_FOLDER _T("folder")
71 #define wxART_GO_DIR_UP _T("go_dir_up")
72 #define wxART_EXECUTABLE_FILE _T("executable_file")
73 #define wxART_NORMAL_FILE _T("normal_file")
74
75 // ----------------------------------------------------------------------------
76 // wxArtProvider class
77 // ----------------------------------------------------------------------------
78
79 class WXDLLEXPORT wxArtProvider : public wxObject
80 {
81 public:
82 // Add new provider to the top of providers stack.
83 static void PushProvider(wxArtProvider *provider);
84
85 // Remove latest added provider and delete it.
86 static bool PopProvider();
87
88 // Remove provider. The provider must have been added previously!
89 // The provider is _not_ deleted.
90 static bool RemoveProvider(wxArtProvider *provider);
91
92 // Query the providers for bitmap with given ID and return it. Return
93 // wxNullBitmap if no provider provides it.
94 static wxBitmap GetBitmap(const wxArtID& id,
95 const wxArtClient& client = wxART_OTHER,
96 const wxSize& size = wxDefaultSize);
97
98 // Query the providers for icon with given ID and return it. Return
99 // wxNullIcon if no provider provides it.
100 static wxIcon GetIcon(const wxArtID& id,
101 const wxArtClient& client = wxART_OTHER,
102 const wxSize& size = wxDefaultSize);
103
104 // Destroy caches & all providers
105 static void CleanUpProviders();
106
107 protected:
108 // Derived classes must override this method to create requested
109 // art resource. This method is called only once per instance's
110 // lifetime for each requested wxArtID.
111 virtual wxBitmap CreateBitmap(const wxArtID& WXUNUSED(id),
112 const wxArtClient& WXUNUSED(client),
113 const wxSize& WXUNUSED(size))
114 {
115 wxFAIL_MSG(_T("pure virtual method wxArtProvider::CreateBitmap called!"));
116 return wxNullBitmap;
117 }
118
119 private:
120 // list of providers:
121 static wxArtProvidersList *sm_providers;
122 // art resources cache (so that CreateXXX is not called that often):
123 static wxArtProviderCache *sm_cache;
124
125 DECLARE_ABSTRACT_CLASS(wxArtProvider)
126 };
127
128
129 #endif // _WX_ARTPROV_H_