wxArtProvider class is used to customize the look of wxWidgets application.
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 either its wxArtProvider::CreateBitmap() and/or its wxArtProvider::CreateIconBundle() methods and register the provider with wxArtProvider::Push():
{
protected:
{ ... }
};
...
wxArtProvider::Push(new MyProvider);
If you need bitmap images (of the same artwork) that should be displayed at different sizes you should probably consider overriding wxArtProvider::CreateIconBundle and supplying icon bundles that contain different bitmap sizes.
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 wxArtProvider::GetBitmap or wxArtProvider::GetIcon.
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 the wxArtID type and can have one of these predefined values (you can see bitmaps represented by these constants in the Art Provider Sample):
wxART_ERROR
wxART_QUESTION
wxART_WARNING
wxART_INFORMATION
wxART_ADD_BOOKMARK
wxART_DEL_BOOKMARK
wxART_HELP_SIDE_PANEL
wxART_HELP_SETTINGS
wxART_HELP_BOOK
wxART_HELP_FOLDER
wxART_HELP_PAGE
wxART_GO_BACK
wxART_GO_FORWARD
wxART_GO_UP
wxART_GO_DOWN
wxART_GO_TO_PARENT
wxART_GO_HOME
wxART_GOTO_FIRST (since 2.9.2)
|
wxART_GOTO_LAST (since 2.9.2)
wxART_PRINT
wxART_HELP
wxART_TIP
wxART_REPORT_VIEW
wxART_LIST_VIEW
wxART_NEW_DIR
wxART_FOLDER
wxART_FOLDER_OPEN
wxART_GO_DIR_UP
wxART_EXECUTABLE_FILE
wxART_NORMAL_FILE
wxART_TICK_MARK
wxART_CROSS_MARK
wxART_MISSING_IMAGE
wxART_NEW
wxART_FILE_OPEN
wxART_FILE_SAVE
|
wxART_FILE_SAVE_AS
wxART_DELETE
wxART_COPY
wxART_CUT
wxART_PASTE
wxART_UNDO
wxART_REDO
wxART_PLUS (since 2.9.2)
wxART_MINUS (since 2.9.2)
wxART_CLOSE
wxART_QUIT
wxART_FIND
wxART_FIND_AND_REPLACE
wxART_HARDDISK
wxART_FLOPPY
wxART_CDROM
wxART_REMOVABLE
|
Additionally, any string recognized by custom art providers registered using wxArtProvider::Push may be used.
- Note
- When running under GTK+ 2, GTK+ stock item IDs (e.g.
"gtk-cdrom"
) may be used as well: For a list of the GTK+ stock items please refer to the GTK+ documentation page. It is also possible to load icons from the current icon theme by specifying their name (without extension and directory components). Icon themes recognized by GTK+ follow the freedesktop.org Icon Themes specification. Note that themes are not guaranteed to contain all icons, so wxArtProvider may return wxNullBitmap or wxNullIcon. The default theme is typically installed in /usr/share/icons/hicolor
.
Clients
The 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:
wxART_TOOLBAR
wxART_MENU
wxART_BUTTON
wxART_FRAME_ICON
wxART_CMN_DIALOG
wxART_HELP_BROWSER
wxART_MESSAGE_BOX
wxART_OTHER
(used for all requests that don't fit into any of the categories above)
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 hint for wxArtProvider – it is common that wxArtProvider::GetBitmap returns identical bitmap for different client values!
- See Also
- Art Provider Sample for an example of wxArtProvider usage; stock ID list
|
virtual | ~wxArtProvider () |
| The destructor automatically removes the provider from the provider stack used by GetBitmap().
|
|
| wxObject () |
| Default ctor; initializes to NULL the internal reference data.
|
|
| wxObject (const wxObject &other) |
| Copy ctor.
|
|
virtual | ~wxObject () |
| Destructor.
|
|
virtual wxClassInfo * | GetClassInfo () const |
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
|
|
wxObjectRefData * | GetRefData () const |
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
|
|
bool | IsKindOf (const wxClassInfo *info) const |
| Determines whether this class is a subclass of (or the same class as) the given class.
|
|
bool | IsSameAs (const wxObject &obj) const |
| Returns true if this object has the same data pointer as obj.
|
|
void | Ref (const wxObject &clone) |
| Makes this object refer to the data in clone.
|
|
void | SetRefData (wxObjectRefData *data) |
| Sets the wxObject::m_refData pointer.
|
|
void | UnRef () |
| Decrements the reference count in the associated data, and if it is zero, deletes the data.
|
|
void | UnShare () |
| This is the same of AllocExclusive() but this method is public.
|
|
void | operator delete (void *buf) |
| The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
|
|
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
| The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
|
|