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