X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc2171bd4c660b8554dae2a1cbf34ff09f3032a6..21d6b09b108dd8f4710cf260ee9f344b6bbad704:/docs/latex/wx/artprov.tex?ds=sidebyside diff --git a/docs/latex/wx/artprov.tex b/docs/latex/wx/artprov.tex index 8443208a9b..16a804837e 100644 --- a/docs/latex/wx/artprov.tex +++ b/docs/latex/wx/artprov.tex @@ -6,11 +6,11 @@ \section{\class{wxArtProvider}}\label{wxartprovider} wxArtProvider class is used to customize the look of wxWidgets application. -When wxWidgets need to display an icon or a bitmap (e.g. in the standard file -dialog), it does not use hard-coded resource but asks wxArtProvider for it -instead. This way the users can plug in own wxArtProvider class and easily -replace standard art with his/her own version. It is easy thing to do: all -that is needed is to derive a class from wxArtProvider, override it's +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::PushProvider}{wxartproviderpushprovider}: @@ -29,13 +29,12 @@ provider with \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 +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} +\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 @@ -75,7 +74,21 @@ constants in the \helpref{artprov}{sampleartprovider} sample): \item wxART\_MISSING\_IMAGE \end{itemize} -\membersection{Clients} +Additionally, any string recognized by custom art providers registered using +\helpref{PushProvider}{wxartproviderpushprovider} 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 @@ -83,6 +96,7 @@ 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 @@ -117,7 +131,7 @@ See the \helpref{artprov}{sampleartprovider} sample for an example of wxArtProvi 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 neccessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects +not necessary to optimize CreateBitmap for speed (e.g. you may create wxBitmap objects from XPMs here). \wxheading{Parameters} @@ -127,7 +141,7 @@ from XPMs here). \docparam{client}{wxArtClient identifier of the client (i.e. who is asking for the bitmap). This only servers as a hint.} -\docparam{size}{Prefered size of the bitmap. The function may return a bitmap of different +\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} @@ -162,7 +176,14 @@ The bitmap if one of registered providers recognizes the ID or wxNullBitmap othe Same as \helpref{wxArtProvider::GetBitmap}{wxartprovidergetbitmap}, but return a wxIcon object (or wxNullIcon on failure). -\membersection{wxArtProvider::PopProvider}\label{wxartproviderpopprovider} +\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::PopProvider}\label{wxartproviderctor} \func{static bool}{PopProvider}{\void}