]> git.saurik.com Git - wxWidgets.git/blame - include/wx/artprov.h
added wxArtProvider
[wxWidgets.git] / include / wx / artprov.h
CommitLineData
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
23class WXDLLEXPORT wxArtProvidersList;
24class WXDLLEXPORT wxArtProviderCache;
25
26// ----------------------------------------------------------------------------
27// Types
28// ----------------------------------------------------------------------------
29
30typedef wxString wxArtDomain;
31typedef wxString wxArtID;
32
33// ----------------------------------------------------------------------------
34// wxArtProvider class
35// ----------------------------------------------------------------------------
36
37class WXDLLEXPORT wxArtProvider : public wxObject
38{
39public:
40 // Add new provider to the top of providers stack.
41 static void PushProvider(wxArtProvider *provider);
42
43 // Remove latest added provider and delete it.
44 static bool PopProvider();
45
46 // Remove provider. The provider must have been added previously!
47 // The provider is _not_ deleted.
48 static bool RemoveProvider(wxArtProvider *provider);
49
50 // Query the providers for bitmap with given ID and return it. Return
51 // wxNullBitmap if no provider provides it.
52 static wxBitmap GetBitmap(const wxArtDomain& domain, const wxArtID& id,
53 const wxSize& size = wxDefaultSize);
54
55 // Query the providers for icon with given ID and return it. Return
56 // wxNullIcon if no provider provides it.
57 static wxIcon GetIcon(const wxArtDomain& domain, const wxArtID& id,
58 const wxSize& size = wxDefaultSize);
59
60 // Destroy caches & all providers
61 static void CleanUpProviders();
62
63protected:
64 // Derived classes must override this method to create requested
65 // art resource. This method is called only once per instance's
66 // lifetime for each requested wxArtID.
67 virtual wxBitmap CreateBitmap(const wxArtDomain& WXUNUSED(domain),
68 const wxArtID& WXUNUSED(id),
69 const wxSize& WXUNUSED(size))
70 {
71 wxFAIL_MSG(_T("pure virtual method wxArtProvider::CreateBitmap called!"));
72 return wxNullBitmap;
73 }
74
75private:
76 // list of providers:
77 static wxArtProvidersList *sm_providers;
78 // art resources cache (so that CreateXXX is not called that often):
79 static wxArtProviderCache *sm_cache;
80
81 DECLARE_ABSTRACT_CLASS(wxArtProvider)
82};
83
84
85// ----------------------------------------------------------------------------
86// Art pieces identifiers
87// ----------------------------------------------------------------------------
88
89// This is comprehensive list of art identifiers recognized by wxWindows. The
90// identifiers follow two-levels scheme where a piece of art is described by
91// its domain (file dialog, HTML help toolbar etc.) and resource identifier
92// within the domain
93
94#define wxART_WXHTML _T("wxhtml")
95 #define wxART_ADD_BOOKMARK _T("add_bookmark")
96 #define wxART_DEL_BOOKMARK _T("del_bookmark")
97 #define wxART_NAVIG_PANEL _T("navig_panel")
98 #define wxART_HELP_SETTINGS _T("help_settings")
99 #define wxART_HELP_BOOK _T("help_book")
100 #define wxART_HELP_FOLDER _T("help_folder")
101 #define wxART_HELP_PAGE _T("help_page")
102
103#define wxART_BROWSER_TOOLBAR _T("browser_toolbar")
104 #define wxART_GO_BACK _T("go_back")
105 #define wxART_GO_FORWARD _T("go_forward")
106 #define wxART_GO_UP _T("go_up")
107 #define wxART_GO_DOWN _T("go_down")
108 #define wxART_GO_TO_PARENT _T("go_to_parent")
109
110#define wxART_TOOLBAR _T("toolbar")
111 #define wxART_FILE_OPEN _T("file_open")
112 #define wxART_PRINT _T("print")
113
114#define wxART_FRAME_ICON _T("frame_icon")
115 #define wxART_HELP _T("help")
116
117
118
119#endif // _WX_ARTPROV_H_