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