X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12f5e1e78fe906050ff2fee9529476db332633f0..939fdcf6b767cd8beec43c46e43f576fed530e1a:/interface/wx/artprov.h?ds=sidebyside diff --git a/interface/wx/artprov.h b/interface/wx/artprov.h index 6ce90114e1..b8a0a742d3 100644 --- a/interface/wx/artprov.h +++ b/interface/wx/artprov.h @@ -6,6 +6,17 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +/** + This type identifies the client of the art objects requested to wxArtProvider. +*/ +typedef wxString wxArtClient; + +/** + This type identifies a specific art object which can be requested to wxArtProvider. +*/ +typedef wxString wxArtID; + + /** @class wxArtProvider @@ -45,16 +56,12 @@ code and use platform native icons as provided by wxArtProvider::GetBitmap or wxArtProvider::GetIcon. - @todo IS THIS NB TRUE? - (@note this is not yet really possible as of wxWidgets 2.3.3, the set of wxArtProvider - bitmaps is too small). - - @section wxartprovider_identify Identifying art resources + @section artprovider_identify Identifying art resources Every bitmap and icon bundle are known to wxArtProvider under an unique ID that is used 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 @ref page_samples_artprovider): + constants in the @ref page_samples_artprov):
@@ -116,7 +123,15 @@ @note When running under GTK+ 2, GTK+ stock item IDs (e.g. @c "gtk-cdrom") may be used - as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then it is also + as well: + @code + #ifdef __WXGTK__ + wxBitmap bmp = wxArtProvider::GetBitmap("gtk-cdrom", wxART_MENU); + #endif + @endcode + For a list of the GTK+ stock items please refer to the GTK+ documentation page + http://library.gnome.org/devel/gtk/stable/gtk-Stock-Items.html. + 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 freedesktop.org Icon Themes specification @@ -126,9 +141,9 @@ The default theme is typically installed in @c /usr/share/icons/hicolor. - @section wxartprovider_clients Clients + @section artprovider_clients Clients - Client is the entity that calls wxArtProvider's GetBitmap or GetIcon function. + The @e 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: @li wxART_TOOLBAR @@ -141,7 +156,7 @@ @li wxART_OTHER (used for all requests that don't fit into any of the categories above) - Client ID servers as a hint to wxArtProvider that is supposed to help it to + Client ID serve 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. wxART_FILE_OPEN). Remember that this is really only a @@ -151,7 +166,7 @@ @library{wxcore} @category{misc,data} - @see the @ref page_samples_artprovider for an example of wxArtProvider usage. + @see the @ref page_samples_artprov for an example of wxArtProvider usage. */ class wxArtProvider : public wxObject { @@ -193,11 +208,29 @@ public: const wxSize& size = wxDefaultSize); /** - Returns a suitable size hint for the given @e wxArtClient. If - @a platform_default is @true, return a size based on the current platform, - otherwise return the size from the topmost wxArtProvider. @e wxDefaultSize may - be returned if the client doesn't have a specified size, like wxART_OTHER for - example. + Returns native icon size for use specified by @a client hint. + + If the platform has no commonly used default for this use or if + @a client is not recognized, returns wxDefaultSize. + + @note In some cases, a platform may have @em several appropriate + native sizes (for example, wxART_FRAME_ICON for frame icons). + In that case, this method returns only one of them, picked + reasonably. + + @since 2.9.0 + */ + static wxSize GetNativeSizeHint(const wxArtClient& client); + + /** + Returns a suitable size hint for the given @e wxArtClient. + + If @a platform_default is @true, return a size based on the current + platform using GetNativeSizeHint(), otherwise return the size from the + topmost wxArtProvider. @e wxDefaultSize may be returned if the client + doesn't have a specified size, like wxART_OTHER for example. + + @see GetNativeSizeHint() */ static wxSize GetSizeHint(const wxArtClient& client, bool platform_default = false); @@ -218,10 +251,21 @@ public: const wxArtClient& client = wxART_OTHER); /** - Register new art provider and add it to the bottom of providers stack - (i.e. it will be queried as the last one). + Returns true if the platform uses native icons provider that should + take precedence over any customizations. - @see Push() + This is true for any platform that has user-customizable icon themes, + currently only wxGTK. + + A typical use for this method is to decide whether a custom art provider + should be plugged in using Push() or PushBack(). + + @since 2.9.0 + */ + static bool HasNativeProvider(); + + /** + @deprecated Use PushBack() instead. */ static void Insert(wxArtProvider* provider); @@ -234,10 +278,21 @@ public: Register new art provider and add it to the top of providers stack (i.e. it will be queried as the first provider). - @see Insert() + @see PushBack() */ static void Push(wxArtProvider* provider); + /** + Register new art provider and add it to the bottom of providers stack. + In other words, it will be queried as the last one, after all others, + including the default provider. + + @see Push() + + @since 2.9.0 + */ + static void PushBack(wxArtProvider* provider); + /** Remove a provider from the stack if it is on it. The provider is not deleted, unlike when using Delete(). |