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::PushProvider
}{wxartproviderpushprovider
}:
19 class MyProvider : public wxArtProvider
22 wxBitmap CreateBitmap(const wxArtID& id,
23 const wxArtClient& client,
28 wxArtProvider::PushProvider(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
37 \membersection{Identifying art resources
}\label{artprovideridentifying
}
39 Every bitmap is known to wxArtProvider under an unique ID that is used by when
40 requesting a resource from it. The ID is represented by wxArtID type and can
41 have one of these predefined values (you can see bitmaps represented by these
42 constants 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
52 \item wxART
\_GO\_FORWARD
55 \item wxART
\_GO\_TO\_PARENT
57 \item wxART
\_FILE\_OPEN
61 \item wxART
\_REPORT\_VIEW
62 \item wxART
\_LIST\_VIEW
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
73 \item wxART
\_INFORMATION
74 \item wxART
\_MISSING\_IMAGE
77 Additionally, any string recognized by custom art providers registered using
78 \helpref{PushProvider
}{wxartproviderpushprovider
} may be used.
82 When running under GTK+
2, GTK+ stock item IDs (e.g.
{\tt "gtk-cdrom"
}) may
83 be used as well. Additionally, if wxGTK was compiled against GTK+ >=
2.4, then
84 it is also possible to load icons from current icon theme by specifying their
85 name (without extension and directory components). Icon themes recognized
87 \urlref{freedesktop.org Icon Themes specification
}{http://freedesktop.org/Standards/icon-theme-spec
}. Note that themes are not guaranteed to contain all
88 icons, so wxArtProvider may return
{\tt wxNullBitmap
} or
{\tt wxNullIcon
}.
89 Default theme is typically installed in
{\tt /usr/share/icons/hicolor
}.
91 \membersection{Clients
}\label{artproviderclients
}
93 Client is the entity that calls wxArtProvider's GetBitmap or GetIcon
94 function. It is represented by wxClientID type and can have one of these
96 \begin{itemize
}\itemsep=
0pt
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)
106 Client ID servers as a hint to wxArtProvider that is supposed to help it to
107 choose the best looking bitmap. For example it is often desirable to use
108 slightly different icons in menus and toolbars even though they represent the
109 same action (e.g.
{\tt wx
\_ART\_FILE\_OPEN}). Remember that this is really
110 only a hint for wxArtProvider -- it is common that
111 \helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
}
112 returns identical bitmap for different
{\it client
} values!
116 See the
\helpref{artprov
}{sampleartprovider
} sample for an example of wxArtProvider usage.
118 \wxheading{Derived from
}
120 \helpref{wxObject
}{wxobject
}
122 \wxheading{Include files
}
126 \latexignore{\rtfignore{\wxheading{Members
}}}
128 \membersection{wxArtProvider::CreateBitmap
}\label{wxartprovidercreatebitmap
}
130 \func{wxBitmap
}{CreateBitmap
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client
},
\param{const wxSize\&
}{size
}}
132 Derived art provider classes must override this method to create requested
133 art resource. Note that returned bitmaps are cached by wxArtProvider and it is therefore
134 not necessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects
137 \wxheading{Parameters
}
139 \docparam{id
}{wxArtID unique identifier of the bitmap.
}
141 \docparam{client
}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
142 This only servers as a hint.
}
144 \docparam{size
}{Preferred size of the bitmap. The function may return a bitmap of different
145 dimensions, it will be automatically rescaled to meet client's request.
}
149 This is
{\bf not
} part of wxArtProvider's public API, use
150 \helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
} or
151 \helpref{wxArtProvider::GetIcon
}{wxartprovidergeticon
}
152 to query wxArtProvider for a resource.
154 \membersection{wxArtProvider::GetBitmap
}\label{wxartprovidergetbitmap
}
156 \func{static wxBitmap
}{GetBitmap
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client = wxART
\_OTHER},
\param{const wxSize\&
}{size = wxDefaultSize
}}
158 Query registered providers for bitmap with given ID.
160 \wxheading{Parameters
}
162 \docparam{id
}{wxArtID unique identifier of the bitmap.
}
164 \docparam{client
}{wxArtClient identifier of the client (i.e. who is asking for the bitmap).
}
166 \docparam{size
}{Size of the returned bitmap or
{\tt wxDefaultSize
} if size doesn't matter.
}
168 \wxheading{Return value
}
170 The bitmap if one of registered providers recognizes the ID or wxNullBitmap otherwise.
172 \membersection{wxArtProvider::GetIcon
}\label{wxartprovidergeticon
}
174 \func{static wxIcon
}{GetIcon
}{\param{const wxArtID\&
}{id
},
\param{const wxArtClient\&
}{client = wxART
\_OTHER},
\param{const wxSize\&
}{size = wxDefaultSize
}}
176 Same as
\helpref{wxArtProvider::GetBitmap
}{wxartprovidergetbitmap
}, but
177 return a wxIcon object (or wxNullIcon on failure).
179 \func{static wxSize
}{GetSizeHint
}{\param{const wxArtClient\&
}{client
},
\param{bool
}{platform_default = false
}}
181 Returns a suitable size hint for the given
{\it wxArtClient
}. If
182 {\it platform_default
} is
\true, return a size based on the current platform,
183 otherwise return the size from the topmost wxArtProvider.
{\it wxDefaultSize
} may be
184 returned if the client doesn't have a specified size, like wxART_OTHER for example.
186 \membersection{wxArtProvider::PopProvider
}\label{wxartproviderctor
}
188 \func{static bool
}{PopProvider
}{\void}
190 Remove latest added provider and delete it.
192 \membersection{wxArtProvider::PushProvider
}\label{wxartproviderpushprovider
}
194 \func{static void
}{PushProvider
}{\param{wxArtProvider*
}{provider
}}
196 Register new art provider (add it to the top of providers stack).
198 \membersection{wxArtProvider::RemoveProvider
}\label{wxartproviderremoveprovider
}
200 \func{static bool
}{RemoveProvider
}{\param{wxArtProvider*
}{provider
}}
202 Remove a provider from the stack. The provider must have been added previously
203 and is
{\it not
} deleted.