X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f510b7b2f386afe6c3705c2cdbc9208435984dac..9379c0d752144826342fa2688a77aa5cccea3d9b:/docs/latex/wx/artprov.tex?ds=sidebyside diff --git a/docs/latex/wx/artprov.tex b/docs/latex/wx/artprov.tex index 6e48e3b6e2..8c2b6d4aaf 100644 --- a/docs/latex/wx/artprov.tex +++ b/docs/latex/wx/artprov.tex @@ -6,14 +6,14 @@ \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}: +\helpref{wxArtProvider::Push}{wxartproviderpush}: \begin{verbatim} class MyProvider : public wxArtProvider @@ -25,16 +25,16 @@ provider with { ... } }; ... - wxArtProvider::PushProvider(new MyProvider); + 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 +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 @@ -75,8 +75,8 @@ constants in the \helpref{artprov}{sampleartprovider} sample): \item wxART\_MISSING\_IMAGE \end{itemize} -Additionally, any string recognized by custom art providers registered using -\helpref{PushProvider}{wxartproviderpushprovider} may be used. +Additionally, any string recognized by custom art providers registered using +\helpref{Push}{wxartproviderpush} may be used. \wxheading{GTK+ Note} @@ -89,6 +89,7 @@ by GTK+ follow the 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 @@ -126,13 +127,22 @@ See the \helpref{artprov}{sampleartprovider} sample for an example of wxArtProvi \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 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} @@ -142,7 +152,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} @@ -152,6 +162,14 @@ This is {\bf not} part of wxArtProvider's public API, use \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}} @@ -170,6 +188,7 @@ Query registered providers for bitmap with given ID. 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}} @@ -177,22 +196,49 @@ 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{wxartproviderctor} +\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. -\func{static bool}{PopProvider}{\void} + +\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::PushProvider}\label{wxartproviderpushprovider} -\func{static void}{PushProvider}{\param{wxArtProvider* }{provider}} +\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} -Register new art provider (add it to the top of providers stack). -\membersection{wxArtProvider::RemoveProvider}\label{wxartproviderremoveprovider} +\membersection{wxArtProvider::Remove}\label{wxartproviderremove} -\func{static bool}{RemoveProvider}{\param{wxArtProvider* }{provider}} +\func{static bool}{Remove}{\param{wxArtProvider* }{provider}} -Remove a provider from the stack. The provider must have been added previously -and is {\it not} deleted. +Remove a provider from the stack if it is on it. The provider is {\emph not} +deleted, unlike when using \helpref{Delete()}{wxartproviderdelete}.