1wxArtProvider(3) Erlang Module Definition wxArtProvider(3)
2
3
4
6 wxArtProvider - Functions for wxArtProvider class
7
9 wxArtProvider class is used to customize the look of wxWidgets applica‐
10 tion.
11
12 When wxWidgets needs to display an icon or a bitmap (e.g. in the stan‐
13 dard file dialog), it does not use a hard-coded resource but asks
14 wxArtProvider for it instead. This way users can plug in their own
15 wxArtProvider class and easily replace standard art with their own ver‐
16 sion.
17
18 All that is needed is to derive a class from wxArtProvider, override
19 either its wxArtProvider::CreateBitmap() (not implemented in wx) and/or
20 its wxArtProvider::CreateIconBundle() (not implemented in wx) methods
21 and register the provider with wxArtProvider::Push() (not implemented
22 in wx):
23
24 If you need bitmap images (of the same artwork) that should be dis‐
25 played at different sizes you should probably consider overriding
26 wxArtProvider::CreateIconBundle (not implemented in wx) and supplying
27 icon bundles that contain different bitmap sizes.
28
29 There's another way of taking advantage of this class: you can use it
30 in your code and use platform native icons as provided by getBitmap/2
31 or getIcon/2.
32
33 Identifying art resources
34
35 Every bitmap and icon bundle are known to wxArtProvider under an unique
36 ID that is used when requesting a resource from it. The ID is repre‐
37 sented by the ?wxArtID type and can have one of these predefined values
38 (you can see bitmaps represented by these constants in the page_sam‐
39 ples_artprov):
40
41 Additionally, any string recognized by custom art providers registered
42 using wxArtProvider::Push (not implemented in wx) may be used.
43
44 Note: When running under GTK+ 2, GTK+ stock item IDs (e.g. "gtk-cdrom")
45 may be used as well: For a list of the GTK+ stock items please refer to
46 the GTK+ documentation page. It is also possible to load icons from the
47 current icon theme by specifying their name (without extension and di‐
48 rectory components). Icon themes recognized by GTK+ follow the
49 freedesktop.org Icon Themes specification. Note that themes are not
50 guaranteed to contain all icons, so wxArtProvider may return ?wxNull‐
51 Bitmap or ?wxNullIcon. The default theme is typically installed in
52 /usr/share/icons/hicolor.
53
54 Clients
55
56 The client is the entity that calls wxArtProvider's getBitmap/2 or
57 getIcon/2 function. It is represented by wxClientID type and can have
58 one of these values:
59
60 Client ID serve as a hint to wxArtProvider that is supposed to help it
61 to choose the best looking bitmap. For example it is often desirable to
62 use slightly different icons in menus and toolbars even though they
63 represent the same action (e.g. wxART_FILE_OPEN). Remember that this is
64 really only a hint for wxArtProvider - it is common that getBitmap/2
65 returns identical bitmap for different client values!
66
67 See: Examples, wxArtProvider, usage; stock ID list
68
69 wxWidgets docs: wxArtProvider
70
72 wxArtProvider() = wx:wx_object()
73
75 getBitmap(Id) -> wxBitmap:wxBitmap()
76
77 Types:
78
79 Id = unicode:chardata()
80
81 getBitmap(Id, Options :: [Option]) -> wxBitmap:wxBitmap()
82
83 Types:
84
85 Id = unicode:chardata()
86 Option =
87 {client, unicode:chardata()} |
88 {size, {W :: integer(), H :: integer()}}
89
90 Query registered providers for bitmap with given ID.
91
92 Return: The bitmap if one of registered providers recognizes the
93 ID or wxNullBitmap otherwise.
94
95 getIcon(Id) -> wxIcon:wxIcon()
96
97 Types:
98
99 Id = unicode:chardata()
100
101 getIcon(Id, Options :: [Option]) -> wxIcon:wxIcon()
102
103 Types:
104
105 Id = unicode:chardata()
106 Option =
107 {client, unicode:chardata()} |
108 {size, {W :: integer(), H :: integer()}}
109
110 Same as getBitmap/2, but return a wxIcon object (or ?wxNullIcon
111 on failure).
112
113
114
115wxWidgets team. wx 2.2.1 wxArtProvider(3)