2002-04-08 12:46:27 -04:00
%
% automatically generated by HelpGen $Revision$ from
% artprov.h at 08/Apr/02 17:44:57
%
\section { \class { wxArtProvider} } \label { wxartprovider}
2004-05-04 04:27:20 -04:00
wxArtProvider class is used to customize the look of wxWidgets application.
2005-02-06 14:17:35 -05:00
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
2002-04-16 19:06:47 -04:00
\helpref { CreateBitmap} { wxartprovidercreatebitmap} method and register the
provider with
2006-09-23 16:16:18 -04:00
\helpref { wxArtProvider::Push} { wxartproviderpush} :
2002-04-16 19:06:47 -04:00
\begin { verbatim}
class MyProvider : public wxArtProvider
{
protected:
wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize size)
{ ... }
} ;
...
2006-09-23 16:16:18 -04:00
wxArtProvider::Push(new MyProvider);
2002-04-16 19:06:47 -04:00
\end { verbatim}
There's another way of taking advantage of this class: you can use it in your code and use
2005-02-11 15:08:51 -05:00
platform native icons as provided by \helpref { wxArtProvider::GetBitmap} { wxartprovidergetbitmap} or
2002-04-16 19:06:47 -04:00
\helpref { wxArtProvider::GetIcon} { wxartprovidergeticon} (NB: this is not yet really
2004-05-04 04:27:20 -04:00
possible as of wxWidgets 2.3.3, the set of wxArtProvider bitmaps is too
2002-04-16 19:06:47 -04:00
small).
2006-09-23 16:16:18 -04:00
2004-10-04 11:13:52 -04:00
\membersection { Identifying art resources} \label { artprovideridentifying}
2002-04-16 19:06:47 -04:00
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
2007-03-30 14:53:45 -04:00
\item wxART\_ ERROR
\item wxART\_ QUESTION
\item wxART\_ WARNING
\item wxART\_ INFORMATION
\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\_ PRINT
\item wxART\_ HELP
\item wxART\_ TIP
\item wxART\_ REPORT\_ VIEW
\item wxART\_ LIST\_ VIEW
\item wxART\_ NEW\_ DIR
\item wxART\_ FOLDER
\item wxART\_ FOLDER\_ OPEN
\item wxART\_ GO\_ DIR\_ UP
\item wxART\_ EXECUTABLE\_ FILE
\item wxART\_ NORMAL\_ FILE
\item wxART\_ TICK\_ MARK
\item wxART\_ CROSS\_ MARK
\item wxART\_ MISSING\_ IMAGE
\item wxART\_ NEW
\item wxART\_ FILE\_ OPEN
\item wxART\_ FILE\_ SAVE
\item wxART\_ FILE\_ SAVE\_ AS
\item wxART\_ DELETE
\item wxART\_ COPY
\item wxART\_ CUT
\item wxART\_ PASTE
\item wxART\_ UNDO
\item wxART\_ REDO
\item wxART\_ QUIT
\item wxART\_ FIND
\item wxART\_ FIND\_ AND\_ REPLACE
\item wxART\_ HARDDISK
\item wxART\_ FLOPPY
\item wxART\_ CDROM
\item wxART\_ REMOVABLE
2002-04-16 19:06:47 -04:00
\end { itemize}
2006-09-23 16:16:18 -04:00
Additionally, any string recognized by custom art providers registered using
\helpref { Push} { wxartproviderpush} may be used.
2004-08-30 18:31:41 -04:00
\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} .
2004-08-22 15:23:53 -04:00
2006-09-23 16:16:18 -04:00
2004-10-04 11:13:52 -04:00
\membersection { Clients} \label { artproviderclients}
2002-04-16 19:06:47 -04:00
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
2004-08-22 14:56:55 -04:00
\item wxART\_ BUTTON
2002-04-16 19:06:47 -04:00
\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.
2002-04-08 12:46:27 -04:00
\wxheading { Derived from}
\helpref { wxObject} { wxobject}
\wxheading { Include files}
<wx/artprov.h>
2002-04-16 19:06:47 -04:00
\latexignore { \rtfignore { \wxheading { Members} } }
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
\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} .
2002-04-16 19:06:47 -04:00
\membersection { wxArtProvider::CreateBitmap} \label { wxartprovidercreatebitmap}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
\func { wxBitmap} { CreateBitmap} { \param { const wxArtID\& } { id} , \param { const wxArtClient\& } { client} , \param { const wxSize\& } { size} }
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
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
2004-10-22 15:15:35 -04:00
not necessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects
2002-04-16 19:06:47 -04:00
from XPMs here).
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
\wxheading { Parameters}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
\docparam { id} { wxArtID unique identifier of the bitmap.}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
\docparam { client} { wxArtClient identifier of the client (i.e. who is asking for the bitmap).
This only servers as a hint.}
2004-10-22 15:15:35 -04:00
\docparam { size} { Preferred size of the bitmap. The function may return a bitmap of different
2002-04-16 19:06:47 -04:00
dimensions, it will be automatically rescaled to meet client's request.}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
\wxheading { Note}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
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.
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
\membersection { wxArtProvider::Delete} \label { wxartproviderdelete}
\func { static bool} { Delete} { \param { wxArtProvider* } { provider} }
Delete the given \arg { provider} .
2002-04-08 12:46:27 -04:00
\membersection { wxArtProvider::GetBitmap} \label { wxartprovidergetbitmap}
2002-04-16 19:06:47 -04:00
\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}
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
The bitmap if one of registered providers recognizes the ID or wxNullBitmap otherwise.
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
2002-04-08 12:46:27 -04:00
\membersection { wxArtProvider::GetIcon} \label { wxartprovidergeticon}
2002-04-16 19:06:47 -04:00
\func { static wxIcon} { GetIcon} { \param { const wxArtID\& } { id} , \param { const wxArtClient\& } { client = wxART\_ OTHER} , \param { const wxSize\& } { size = wxDefaultSize} }
2002-04-08 12:46:27 -04:00
2002-04-16 19:06:47 -04:00
Same as \helpref { wxArtProvider::GetBitmap} { wxartprovidergetbitmap} , but
return a wxIcon object (or wxNullIcon on failure).
2002-04-08 12:46:27 -04:00
2005-04-08 15:11:58 -04:00
\func { static wxSize} { GetSizeHint} { \param { const wxArtClient\& } { client} , \param { bool } { platform\_ default = false} }
2005-03-04 13:33:57 -05:00
2005-03-12 05:33:00 -05:00
Returns a suitable size hint for the given { \it wxArtClient} . If
2005-04-08 15:11:58 -04:00
{ \it platform\_ default} is \true , return a size based on the current platform,
2005-03-12 05:33:00 -05:00
otherwise return the size from the topmost wxArtProvider. { \it wxDefaultSize} may be
2005-04-08 15:11:58 -04:00
returned if the client doesn't have a specified size, like wxART\_ OTHER for example.
2005-03-04 13:33:57 -05:00
2006-08-31 13:00:13 -04:00
2006-09-23 16:16:18 -04:00
\membersection { wxArtProvider::Insert} \label { wxartproviderinsert}
\func { static void} { Insert} { \param { wxArtProvider* } { provider} }
2006-08-31 13:00:13 -04:00
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}
2006-09-23 16:16:18 -04:00
\helpref { Push} { wxartproviderpush}
2006-08-31 13:00:13 -04:00
2006-09-23 16:16:18 -04:00
\membersection { wxArtProvider::Pop} \label { wxartproviderctor}
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
\func { static bool} { Pop} { \void }
2002-04-08 12:46:27 -04:00
Remove latest added provider and delete it.
2006-09-23 16:16:18 -04:00
\membersection { wxArtProvider::Push} \label { wxartproviderpush}
\func { static void} { Push} { \param { wxArtProvider* } { provider} }
2002-04-08 12:46:27 -04:00
2006-08-31 13:00:13 -04:00
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}
2006-09-23 16:16:18 -04:00
\helpref { Insert} { wxartproviderinsert}
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
\membersection { wxArtProvider::Remove} \label { wxartproviderremove}
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
\func { static bool} { Remove} { \param { wxArtProvider* } { provider} }
2002-04-08 12:46:27 -04:00
2006-09-23 16:16:18 -04:00
Remove a provider from the stack if it is on it. The provider is { \emph not}
deleted, unlike when using \helpref { Delete()} { wxartproviderdelete} .
2002-04-08 12:46:27 -04:00