2 % automatically generated by HelpGen $Revision$ from
3 % artprov.h at 08/Apr/02 17:44:57
6 \section{\class{wxArtProvider
}}\label{wxartprovider
}
8 wxArtProvider class is used to customize the look of wxWidgets application.
9 When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file
10 dialog), it does not use a hard-coded resource but asks wxArtProvider for it
11 instead. This way users can plug in their own wxArtProvider class and easily
12 replace standard art with their own version. All
13 that is needed is to derive a class from wxArtProvider, override its
14 \helpref{CreateBitmap
}{wxartprovidercreatebitmap
} method and register the
16 \helpref{wxArtProvider::Push
}{wxartproviderpush
}:
19 class MyProvider : public wxArtProvider
22 wxBitmap CreateBitmap(const wxArtID& id,
23 const wxArtClient& client,
28 wxArtProvider::Push(new MyProvider);
31 There's another way of taking advantage of this class: you can use it in your code and use
32 platform native icons as provided by
\helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
} or
33 \helpref{wxArtProvider::GetIcon
}{wxartprovidergeticon
} (NB: this is not yet really
34 possible as of wxWidgets
2.3.3, the set of wxArtProvider bitmaps is too
38 \membersection{Identifying art resources
}\label{artprovideridentifying
}
40 Every bitmap is known to wxArtProvider under an unique ID that is used by when
41 requesting a resource from it. The ID is represented by wxArtID type and can
42 have one of these predefined values (you can see bitmaps represented by these
43 constants in the
\helpref{artprov
}{sampleartprovider
} sample):
44 \begin{itemize
}\itemsep=
0pt
49 \item wxART
\_INFORMATION
50 \item wxART
\_ADD\_BOOKMARK
51 \item wxART
\_DEL\_BOOKMARK
52 \item wxART
\_HELP\_SIDE\_PANEL
53 \item wxART
\_HELP\_SETTINGS
54 \item wxART
\_HELP\_BOOK
55 \item wxART
\_HELP\_FOLDER
56 \item wxART
\_HELP\_PAGE
58 \item wxART
\_GO\_FORWARD
61 \item wxART
\_GO\_TO\_PARENT
66 \item wxART
\_REPORT\_VIEW
67 \item wxART
\_LIST\_VIEW
70 \item wxART
\_FOLDER\_OPEN
71 \item wxART
\_GO\_DIR\_UP
72 \item wxART
\_EXECUTABLE\_FILE
73 \item wxART
\_NORMAL\_FILE
74 \item wxART
\_TICK\_MARK
75 \item wxART
\_CROSS\_MARK
76 \item wxART
\_MISSING\_IMAGE
78 \item wxART
\_FILE\_OPEN
79 \item wxART
\_FILE\_SAVE
80 \item wxART
\_FILE\_SAVE\_AS
89 \item wxART
\_FIND\_AND\_REPLACE
93 \item wxART
\_REMOVABLE
97 Additionally, any string recognized by custom art providers registered using
98 \helpref{Push
}{wxartproviderpush
} may be used.
100 \wxheading{GTK+ Note
}
102 When running under GTK+
2, GTK+ stock item IDs (e.g.
{\tt "gtk-cdrom"
}) may
103 be used as well. Additionally, if wxGTK was compiled against GTK+ >=
2.4, then
104 it is also possible to load icons from current icon theme by specifying their
105 name (without extension and directory components). Icon themes recognized
107 \urlref{freedesktop.org Icon Themes specification
}{http://freedesktop.org/Standards/icon-theme-spec
}. Note that themes are not guaranteed to contain all
108 icons, so wxArtProvider may return
{\tt wxNullBitmap
} or
{\tt wxNullIcon
}.
109 Default theme is typically installed in
{\tt /usr/share/icons/hicolor
}.
112 \membersection{Clients
}\label{artproviderclients
}
114 Client is the entity that calls wxArtProvider's GetBitmap or GetIcon
115 function. It is represented by wxClientID type and can have one of these
117 \begin{itemize
}\itemsep=
0pt
121 \item wxART
\_FRAME\_ICON
122 \item wxART
\_CMN\_DIALOG
123 \item wxART
\_HELP\_BROWSER
124 \item wxART
\_MESSAGE\_BOX
125 \item wxART
\_OTHER (used for all requests that don't fit into any of the categories above)
127 Client ID servers as a hint to wxArtProvider that is supposed to help it to
128 choose the best looking bitmap. For example it is often desirable to use
129 slightly different icons in menus and toolbars even though they represent the
130 same action (e.g.
{\tt wx
\_ART\_FILE\_OPEN}). Remember that this is really
131 only a hint for wxArtProvider -- it is common that
132 \helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
}
133 returns identical bitmap for different
{\it client
} values!
137 See the
\helpref{artprov
}{sampleartprovider
} sample for an example of wxArtProvider usage.
139 \wxheading{Derived from
}
141 \helpref{wxObject
}{wxobject
}
143 \wxheading{Include files
}
147 \latexignore{\rtfignore{\wxheading{Members
}}}
150 \membersection{wxArtProvider::
\destruct{wxArtProvider
}}\label{wxartproviderdtor
}
152 \func{}{\destruct{wxArtProvider
}}{\void}
154 The destructor automatically removes the provider from the provider stack used
155 by
\helpref{GetBitmap
}{wxartprovidergetbitmap
}.
158 \membersection{wxArtProvider::CreateBitmap
}\label{wxartprovidercreatebitmap
}
160 \func{wxBitmap
}{CreateBitmap
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client
},
\param{const wxSize\&
}{size
}}
162 Derived art provider classes must override this method to create requested
163 art resource. Note that returned bitmaps are cached by wxArtProvider and it is therefore
164 not necessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects
167 \wxheading{Parameters
}
169 \docparam{id
}{wxArtID unique identifier of the bitmap.
}
171 \docparam{client
}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
172 This only servers as a hint.
}
174 \docparam{size
}{Preferred size of the bitmap. The function may return a bitmap of different
175 dimensions, it will be automatically rescaled to meet client's request.
}
179 This is
{\bf not
} part of wxArtProvider's public API, use
180 \helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
} or
181 \helpref{wxArtProvider::GetIcon
}{wxartprovidergeticon
}
182 to query wxArtProvider for a resource.
185 \membersection{wxArtProvider::Delete
}\label{wxartproviderdelete
}
187 \func{static bool
}{Delete
}{\param{wxArtProvider*
}{provider
}}
189 Delete the given
\arg{provider
}.
192 \membersection{wxArtProvider::GetBitmap
}\label{wxartprovidergetbitmap
}
194 \func{static wxBitmap
}{GetBitmap
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client = wxART
\_OTHER},
\param{const wxSize\&
}{size = wxDefaultSize
}}
196 Query registered providers for bitmap with given ID.
198 \wxheading{Parameters
}
200 \docparam{id
}{wxArtID unique identifier of the bitmap.
}
202 \docparam{client
}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
}
204 \docparam{size
}{Size of the returned bitmap or
{\tt wxDefaultSize
} if size doesn't matter.
}
206 \wxheading{Return value
}
208 The bitmap if one of registered providers recognizes the ID or wxNullBitmap otherwise.
211 \membersection{wxArtProvider::GetIcon
}\label{wxartprovidergeticon
}
213 \func{static wxIcon
}{GetIcon
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client = wxART
\_OTHER},
\param{const wxSize\&
}{size = wxDefaultSize
}}
215 Same as
\helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
}, but
216 return a wxIcon object (or wxNullIcon on failure).
218 \func{static wxSize
}{GetSizeHint
}{\param{const wxArtClient\&
}{client
},
\param{bool
}{platform
\_default = false
}}
220 Returns a suitable size hint for the given
{\it wxArtClient
}. If
221 {\it platform
\_default} is
\true, return a size based on the current platform,
222 otherwise return the size from the topmost wxArtProvider.
{\it wxDefaultSize
} may be
223 returned if the client doesn't have a specified size, like wxART
\_OTHER for example.
226 \membersection{wxArtProvider::Insert
}\label{wxartproviderinsert
}
228 \func{static void
}{Insert
}{\param{wxArtProvider*
}{provider
}}
230 Register new art provider and add it to the bottom of providers stack (i.e.
231 it will be queried as the last one).
235 \helpref{Push
}{wxartproviderpush
}
238 \membersection{wxArtProvider::Pop
}\label{wxartproviderctor
}
240 \func{static bool
}{Pop
}{\void}
242 Remove latest added provider and delete it.
245 \membersection{wxArtProvider::Push
}\label{wxartproviderpush
}
247 \func{static void
}{Push
}{\param{wxArtProvider*
}{provider
}}
249 Register new art provider and add it to the top of providers stack (i.e. it
250 will be queried as the first provider).
254 \helpref{Insert
}{wxartproviderinsert
}
257 \membersection{wxArtProvider::Remove
}\label{wxartproviderremove
}
259 \func{static bool
}{Remove
}{\param{wxArtProvider*
}{provider
}}
261 Remove a provider from the stack if it is on it. The provider is
{\emph not
}
262 deleted, unlike when using
\helpref{Delete()
}{wxartproviderdelete
}.