]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/artprov.tex
fixed status bar positioning to work both with and without sizers (patch 1199639...
[wxWidgets.git] / docs / latex / wx / artprov.tex
CommitLineData
f4fcc291
JS
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
fc2171bd 8wxArtProvider class is used to customize the look of wxWidgets application.
25057aba
JS
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 its
e7300ec6
VS
14\helpref{CreateBitmap}{wxartprovidercreatebitmap} method and register the
15provider with
16\helpref{wxArtProvider::PushProvider}{wxartproviderpushprovider}:
17
18\begin{verbatim}
19 class MyProvider : public wxArtProvider
20 {
21 protected:
22 wxBitmap CreateBitmap(const wxArtID& id,
23 const wxArtClient& client,
24 const wxSize size)
25 { ... }
26 };
27 ...
28 wxArtProvider::PushProvider(new MyProvider);
29\end{verbatim}
30
31There's another way of taking advantage of this class: you can use it in your code and use
dceb1c09 32platform native icons as provided by \helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap} or
e7300ec6 33\helpref{wxArtProvider::GetIcon}{wxartprovidergeticon} (NB: this is not yet really
fc2171bd 34possible as of wxWidgets 2.3.3, the set of wxArtProvider bitmaps is too
e7300ec6
VS
35small).
36
f510b7b2 37\membersection{Identifying art resources}\label{artprovideridentifying}
e7300ec6
VS
38
39Every bitmap is known to wxArtProvider under an unique ID that is used by when
40requesting a resource from it. The ID is represented by wxArtID type and can
41have one of these predefined values (you can see bitmaps represented by these
42constants in the \helpref{artprov}{sampleartprovider} sample):
43\begin{itemize}\itemsep=0pt
44\item wxART\_ADD\_BOOKMARK
45\item wxART\_DEL\_BOOKMARK
46\item wxART\_HELP\_SIDE\_PANEL
47\item wxART\_HELP\_SETTINGS
48\item wxART\_HELP\_BOOK
49\item wxART\_HELP\_FOLDER
50\item wxART\_HELP\_PAGE
51\item wxART\_GO\_BACK
52\item wxART\_GO\_FORWARD
53\item wxART\_GO\_UP
54\item wxART\_GO\_DOWN
55\item wxART\_GO\_TO\_PARENT
56\item wxART\_GO\_HOME
57\item wxART\_FILE\_OPEN
58\item wxART\_PRINT
59\item wxART\_HELP
60\item wxART\_TIP
61\item wxART\_REPORT\_VIEW
62\item wxART\_LIST\_VIEW
63\item wxART\_NEW\_DIR
64\item wxART\_FOLDER
65\item wxART\_GO\_DIR\_UP
66\item wxART\_EXECUTABLE\_FILE
67\item wxART\_NORMAL\_FILE
68\item wxART\_TICK\_MARK
69\item wxART\_CROSS\_MARK
70\item wxART\_ERROR
71\item wxART\_QUESTION
72\item wxART\_WARNING
73\item wxART\_INFORMATION
214bdb93 74\item wxART\_MISSING\_IMAGE
e7300ec6
VS
75\end{itemize}
76
7bebedd8 77Additionally, any string recognized by custom art providers registered using
b5ab476a
VS
78\helpref{PushProvider}{wxartproviderpushprovider} may be used.
79
80\wxheading{GTK+ Note}
81
82When running under GTK+ 2, GTK+ stock item IDs (e.g. {\tt "gtk-cdrom"}) may
83be used as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then
84it is also possible to load icons from current icon theme by specifying their
85name (without extension and directory components). Icon themes recognized
86by GTK+ follow the
87\urlref{freedesktop.org Icon Themes specification}{http://freedesktop.org/Standards/icon-theme-spec}. Note that themes are not guaranteed to contain all
88icons, so wxArtProvider may return {\tt wxNullBitmap} or {\tt wxNullIcon}.
89Default theme is typically installed in {\tt /usr/share/icons/hicolor}.
7bebedd8 90
f510b7b2 91\membersection{Clients}\label{artproviderclients}
e7300ec6
VS
92
93Client is the entity that calls wxArtProvider's GetBitmap or GetIcon
94function. It is represented by wxClientID type and can have one of these
95values:
96\begin{itemize}\itemsep=0pt
97\item wxART\_TOOLBAR
98\item wxART\_MENU
b5cf8234 99\item wxART\_BUTTON
e7300ec6
VS
100\item wxART\_FRAME\_ICON
101\item wxART\_CMN\_DIALOG
102\item wxART\_HELP\_BROWSER
103\item wxART\_MESSAGE\_BOX
104\item wxART\_OTHER (used for all requests that don't fit into any of the categories above)
105\end{itemize}
106Client ID servers as a hint to wxArtProvider that is supposed to help it to
107choose the best looking bitmap. For example it is often desirable to use
108slightly different icons in menus and toolbars even though they represent the
109same action (e.g. {\tt wx\_ART\_FILE\_OPEN}). Remember that this is really
110only a hint for wxArtProvider -- it is common that
111\helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap}
112returns identical bitmap for different {\it client} values!
113
114\wxheading{See also}
115
116See the \helpref{artprov}{sampleartprovider} sample for an example of wxArtProvider usage.
f4fcc291
JS
117
118\wxheading{Derived from}
119
120\helpref{wxObject}{wxobject}
121
122\wxheading{Include files}
123
124<wx/artprov.h>
125
e7300ec6 126\latexignore{\rtfignore{\wxheading{Members}}}
f4fcc291 127
e7300ec6 128\membersection{wxArtProvider::CreateBitmap}\label{wxartprovidercreatebitmap}
f4fcc291 129
e7300ec6 130\func{wxBitmap}{CreateBitmap}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client}, \param{const wxSize\& }{size}}
f4fcc291 131
e7300ec6
VS
132Derived art provider classes must override this method to create requested
133art resource. Note that returned bitmaps are cached by wxArtProvider and it is therefore
dbd94b75 134not necessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects
e7300ec6 135from XPMs here).
f4fcc291 136
e7300ec6 137\wxheading{Parameters}
f4fcc291 138
e7300ec6 139\docparam{id}{wxArtID unique identifier of the bitmap.}
f4fcc291 140
e7300ec6
VS
141\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
142This only servers as a hint.}
143
dbd94b75 144\docparam{size}{Preferred size of the bitmap. The function may return a bitmap of different
e7300ec6 145dimensions, it will be automatically rescaled to meet client's request.}
f4fcc291 146
e7300ec6 147\wxheading{Note}
f4fcc291 148
e7300ec6
VS
149This is {\bf not} part of wxArtProvider's public API, use
150\helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap} or
151\helpref{wxArtProvider::GetIcon}{wxartprovidergeticon}
152to query wxArtProvider for a resource.
f4fcc291
JS
153
154\membersection{wxArtProvider::GetBitmap}\label{wxartprovidergetbitmap}
155
e7300ec6
VS
156\func{static wxBitmap}{GetBitmap}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client = wxART\_OTHER}, \param{const wxSize\& }{size = wxDefaultSize}}
157
158Query registered providers for bitmap with given ID.
159
160\wxheading{Parameters}
161
162\docparam{id}{wxArtID unique identifier of the bitmap.}
163
164\docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).}
165
166\docparam{size}{Size of the returned bitmap or {\tt wxDefaultSize} if size doesn't matter.}
167
168\wxheading{Return value}
f4fcc291 169
e7300ec6 170The bitmap if one of registered providers recognizes the ID or wxNullBitmap otherwise.
f4fcc291
JS
171
172\membersection{wxArtProvider::GetIcon}\label{wxartprovidergeticon}
173
e7300ec6 174\func{static wxIcon}{GetIcon}{\param{const wxArtID\& }{id}, \param{const wxArtClient\& }{client = wxART\_OTHER}, \param{const wxSize\& }{size = wxDefaultSize}}
f4fcc291 175
e7300ec6
VS
176Same as \helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap}, but
177return a wxIcon object (or wxNullIcon on failure).
f4fcc291 178
40ca9449 179\func{static wxSize}{GetSizeHint}{\param{const wxArtClient\& }{client}, \param{bool }{platform\_default = false}}
b737ad10 180
e53a95bc 181Returns a suitable size hint for the given {\it wxArtClient}. If
40ca9449 182{\it platform\_default} is \true, return a size based on the current platform,
e53a95bc 183otherwise return the size from the topmost wxArtProvider. {\it wxDefaultSize} may be
40ca9449 184returned if the client doesn't have a specified size, like wxART\_OTHER for example.
b737ad10 185
f510b7b2 186\membersection{wxArtProvider::PopProvider}\label{wxartproviderctor}
f4fcc291 187
e7300ec6 188\func{static bool}{PopProvider}{\void}
f4fcc291
JS
189
190Remove latest added provider and delete it.
191
192\membersection{wxArtProvider::PushProvider}\label{wxartproviderpushprovider}
193
e7300ec6 194\func{static void}{PushProvider}{\param{wxArtProvider* }{provider}}
f4fcc291 195
e7300ec6 196Register new art provider (add it to the top of providers stack).
f4fcc291
JS
197
198\membersection{wxArtProvider::RemoveProvider}\label{wxartproviderremoveprovider}
199
e7300ec6 200\func{static bool}{RemoveProvider}{\param{wxArtProvider* }{provider}}
f4fcc291 201
e7300ec6
VS
202Remove a provider from the stack. The provider must have been added previously
203and is {\it not} deleted.
f4fcc291 204