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