]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/artprov.tex
corrected typo in the creation date
[wxWidgets.git] / docs / latex / wx / artprov.tex
... / ...
CommitLineData
1%
2% automatically generated by HelpGen $Revision$ from
3% artprov.h at 08/Apr/02 17:44:57
4%
5
6\section{\class{wxArtProvider}}\label{wxartprovider}
7
8wxArtProvider class is used to customize the look of wxWidgets application.
9When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file
10dialog), it does not use a hard-coded resource but asks wxArtProvider for it
11instead. This way users can plug in their own wxArtProvider class and easily
12replace standard art with their own version. All
13that is needed is to derive a class from wxArtProvider, override either its
14\helpref{CreateBitmap}{wxartprovidercreatebitmap} and/or its
15\helpref{CreateIconBundle}{wxartprovidercreateiconbundle} methods
16and register the provider with
17\helpref{wxArtProvider::Push}{wxartproviderpush}:
18
19\begin{verbatim}
20 class MyProvider : public wxArtProvider
21 {
22 protected:
23 wxBitmap CreateBitmap(const wxArtID& id,
24 const wxArtClient& client,
25 const wxSize size)
26
27 // optionally override this one as well
28 wxIconBundle CreateIconBundle(const wxArtID& id,
29 const wxArtClient& client)
30 { ... }
31 };
32 ...
33 wxArtProvider::Push(new MyProvider);
34\end{verbatim}
35
36If you need bitmap images (of the same artwork) that should be displayed at different sizes
37you should probably consider overriding \helpref{CreateIconBundle()}{wxartprovidercreateiconbundle}
38and supplying icon bundles that contain different bitmap sizes.
39
40There's another way of taking advantage of this class: you can use it in your code and use
41platform native icons as provided by \helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap} or
42\helpref{wxArtProvider::GetIcon}{wxartprovidergeticon} (NB: this is not yet really
43possible as of wxWidgets 2.3.3, the set of wxArtProvider bitmaps is too
44small).
45
46
47\membersection{Identifying art resources}\label{artprovideridentifying}
48
49Every bitmap and icon bundle are known to wxArtProvider under an unique ID that is used when
50requesting a resource from it. The ID is represented by wxArtID type and can
51have one of these predefined values (you can see bitmaps represented by these
52constants in the \helpref{artprov}{sampleartprovider} sample):
53\begin{itemize}\itemsep=0pt
54
55\item wxART\_ERROR
56\item wxART\_QUESTION
57\item wxART\_WARNING
58\item wxART\_INFORMATION
59\item wxART\_ADD\_BOOKMARK
60\item wxART\_DEL\_BOOKMARK
61\item wxART\_HELP\_SIDE\_PANEL
62\item wxART\_HELP\_SETTINGS
63\item wxART\_HELP\_BOOK
64\item wxART\_HELP\_FOLDER
65\item wxART\_HELP\_PAGE
66\item wxART\_GO\_BACK
67\item wxART\_GO\_FORWARD
68\item wxART\_GO\_UP
69\item wxART\_GO\_DOWN
70\item wxART\_GO\_TO\_PARENT
71\item wxART\_GO\_HOME
72\item wxART\_PRINT
73\item wxART\_HELP
74\item wxART\_TIP
75\item wxART\_REPORT\_VIEW
76\item wxART\_LIST\_VIEW
77\item wxART\_NEW\_DIR
78\item wxART\_FOLDER
79\item wxART\_FOLDER\_OPEN
80\item wxART\_GO\_DIR\_UP
81\item wxART\_EXECUTABLE\_FILE
82\item wxART\_NORMAL\_FILE
83\item wxART\_TICK\_MARK
84\item wxART\_CROSS\_MARK
85\item wxART\_MISSING\_IMAGE
86\item wxART\_NEW
87\item wxART\_FILE\_OPEN
88\item wxART\_FILE\_SAVE
89\item wxART\_FILE\_SAVE\_AS
90\item wxART\_DELETE
91\item wxART\_COPY
92\item wxART\_CUT
93\item wxART\_PASTE
94\item wxART\_UNDO
95\item wxART\_REDO
96\item wxART\_QUIT
97\item wxART\_FIND
98\item wxART\_FIND\_AND\_REPLACE
99\item wxART\_HARDDISK
100\item wxART\_FLOPPY
101\item wxART\_CDROM
102\item wxART\_REMOVABLE
103
104\end{itemize}
105
106Additionally, any string recognized by custom art providers registered using
107\helpref{Push}{wxartproviderpush} may be used.
108
109\wxheading{GTK+ Note}
110
111When running under GTK+ 2, GTK+ stock item IDs (e.g. {\tt "gtk-cdrom"}) may
112be used as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then
113it is also possible to load icons from current icon theme by specifying their
114name (without extension and directory components). Icon themes recognized
115by GTK+ follow the
116\urlref{freedesktop.org Icon Themes specification}{http://freedesktop.org/Standards/icon-theme-spec}. Note that themes are not guaranteed to contain all
117icons, so wxArtProvider may return {\tt wxNullBitmap} or {\tt wxNullIcon}.
118Default theme is typically installed in {\tt /usr/share/icons/hicolor}.
119
120
121\membersection{Clients}\label{artproviderclients}
122
123Client is the entity that calls wxArtProvider's GetBitmap or GetIcon
124function. It is represented by wxClientID type and can have one of these
125values:
126\begin{itemize}\itemsep=0pt
127\item wxART\_TOOLBAR
128\item wxART\_MENU
129\item wxART\_BUTTON
130\item wxART\_FRAME\_ICON
131\item wxART\_CMN\_DIALOG
132\item wxART\_HELP\_BROWSER
133\item wxART\_MESSAGE\_BOX
134\item wxART\_OTHER (used for all requests that don't fit into any of the categories above)
135\end{itemize}
136Client ID servers as a hint to wxArtProvider that is supposed to help it to
137choose the best looking bitmap. For example it is often desirable to use
138slightly different icons in menus and toolbars even though they represent the
139same action (e.g. {\tt wx\_ART\_FILE\_OPEN}). Remember that this is really
140only a hint for wxArtProvider -- it is common that
141\helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap}
142returns identical bitmap for different {\it client} values!
143
144\wxheading{See also}
145
146See the \helpref{artprov}{sampleartprovider} sample for an example of wxArtProvider usage.
147
148\wxheading{Derived from}
149
150\helpref{wxObject}{wxobject}
151
152\wxheading{Include files}
153
154<wx/artprov.h>
155
156\latexignore{\rtfignore{\wxheading{Members}}}
157
158
159\membersection{wxArtProvider::\destruct{wxArtProvider}}\label{wxartproviderdtor}
160
161\func{}{\destruct{wxArtProvider}}{\void}
162
163The destructor automatically removes the provider from the provider stack used
164by \helpref{GetBitmap}{wxartprovidergetbitmap}.
165
166
167\membersection{wxArtProvider::CreateBitmap}\label{wxartprovidercreatebitmap}
168
169\func{wxBitmap}{CreateBitmap}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client}, \param{const wxSize\& }{size}}
170
171Derived art provider classes must override this method or the CreateIconBundle() method
172to create requested art resource. Note that returned bitmaps are cached by wxArtProvider
173and it is therefore not necessary to optimize CreateBitmap() for speed (e.g. you may create
174wxBitmap objects from XPMs here).
175
176\wxheading{Parameters}
177
178\docparam{id}{wxArtID unique identifier of the bitmap.}
179
180\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
181This only servers as a hint.}
182
183\docparam{size}{Preferred size of the bitmap. The function may return a bitmap of different
184dimensions, it will be automatically rescaled to meet client's request.}
185
186\wxheading{Note}
187
188This is {\bf not} part of wxArtProvider's public API, use
189\helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap} or
190\helpref{wxArtProvider::GetIconBundle}{wxartprovidergeticonbundle} or
191\helpref{wxArtProvider::GetIcon}{wxartprovidergeticon}
192to query wxArtProvider for a resource.
193
194
195\func{wxIconBundle}{CreateIconBundle}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client}}
196
197Derived art provider classes must override this method or the CreateIconBundle method
198to create requested art resource. Note that returned icon bundles are cached by wxArtProvider
199and it is therefore not necessary to optimize CreateIconBundle for speed (e.g. you may create icon bundles
200from artwork resources here).
201
202\wxheading{Parameters}
203
204\docparam{id}{wxArtID unique identifier of the icon bundle.}
205
206\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the icon bundle).
207This only servers as a hint.}
208
209\wxheading{Note}
210
211This is {\bf not} part of wxArtProvider's public API, use
212\helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap} or
213\helpref{wxArtProvider::GetIconBundle}{wxartprovidergeticonbundle} or
214\helpref{wxArtProvider::GetIcon}{wxartprovidergeticon}
215to query wxArtProvider for a resource.
216
217\membersection{wxArtProvider::Delete}\label{wxartproviderdelete}
218
219\func{static bool}{Delete}{\param{wxArtProvider* }{provider}}
220
221Delete the given \arg{provider}.
222
223
224\membersection{wxArtProvider::GetBitmap}\label{wxartprovidergetbitmap}
225
226\func{static wxBitmap}{GetBitmap}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client = wxART\_OTHER}, \param{const wxSize\& }{size = wxDefaultSize}}
227
228Query registered providers for bitmap with given ID.
229
230\wxheading{Parameters}
231
232\docparam{id}{wxArtID unique identifier of the bitmap.}
233
234\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).}
235
236\docparam{size}{Size of the returned bitmap or {\tt wxDefaultSize} if size doesn't matter.}
237
238\wxheading{Return value}
239
240The bitmap if one of registered providers recognizes the ID or wxNullBitmap otherwise.
241
242
243\membersection{wxArtProvider::GetIconBundle}\label{wxartprovidergeticonbundle}
244
245\func{static wxIconBundle}{GetIconBundle}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client = wxART\_OTHER}}
246
247Query registered providers for icon bundle with given ID.
248
249\wxheading{Parameters}
250
251\docparam{id}{wxArtID unique identifier of the icon bundle.}
252
253\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the icon bundle).}
254
255\wxheading{Return value}
256
257The icon bundle if one of registered providers recognizes the ID or wxNullIconBundle otherwise.
258
259
260\membersection{wxArtProvider::GetIcon}\label{wxartprovidergeticon}
261
262\func{static wxIcon}{GetIcon}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client = wxART\_OTHER}, \param{const wxSize\& }{size = wxDefaultSize}}
263
264Same as \helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap}, but
265return a wxIcon object (or wxNullIcon on failure).
266
267\func{static wxSize}{GetSizeHint}{\param{const wxArtClient\& }{client}, \param{bool }{platform\_default = false}}
268
269Returns a suitable size hint for the given {\it wxArtClient}. If
270{\it platform\_default} is \true, return a size based on the current platform,
271otherwise return the size from the topmost wxArtProvider. {\it wxDefaultSize} may be
272returned if the client doesn't have a specified size, like wxART\_OTHER for example.
273
274
275\membersection{wxArtProvider::Insert}\label{wxartproviderinsert}
276
277\func{static void}{Insert}{\param{wxArtProvider* }{provider}}
278
279Register new art provider and add it to the bottom of providers stack (i.e.
280it will be queried as the last one).
281
282\wxheading{See also}
283
284\helpref{Push}{wxartproviderpush}
285
286
287\membersection{wxArtProvider::Pop}\label{wxartproviderctor}
288
289\func{static bool}{Pop}{\void}
290
291Remove latest added provider and delete it.
292
293
294\membersection{wxArtProvider::Push}\label{wxartproviderpush}
295
296\func{static void}{Push}{\param{wxArtProvider* }{provider}}
297
298Register new art provider and add it to the top of providers stack (i.e. it
299will be queried as the first provider).
300
301\wxheading{See also}
302
303\helpref{Insert}{wxartproviderinsert}
304
305
306\membersection{wxArtProvider::Remove}\label{wxartproviderremove}
307
308\func{static bool}{Remove}{\param{wxArtProvider* }{provider}}
309
310Remove a provider from the stack if it is on it. The provider is {\emph not}
311deleted, unlike when using \helpref{Delete()}{wxartproviderdelete}.
312