]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: iconbndl.h | |
e54c96f1 | 3 | // Purpose: interface of wxIconBundle |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxIconBundle | |
7c913512 | 11 | |
427c415b FM |
12 | This class contains multiple copies of an icon in different sizes. |
13 | It is typically used in wxDialog::SetIcons and wxTopLevelWindow::SetIcons. | |
7c913512 | 14 | |
23324ae1 | 15 | @library{wxcore} |
427c415b | 16 | @category{gdi} |
7c913512 | 17 | |
23324ae1 | 18 | @stdobjects |
65874118 | 19 | ::wxNullIconBundle |
23324ae1 FM |
20 | */ |
21 | class wxIconBundle : public wxGDIObject | |
22 | { | |
23 | public: | |
23324ae1 | 24 | /** |
427c415b | 25 | Default ctor. |
23324ae1 FM |
26 | */ |
27 | wxIconBundle(); | |
427c415b FM |
28 | |
29 | /** | |
30 | Initializes the bundle with the icon(s) found in the file. | |
31 | */ | |
cee875e3 VS |
32 | wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); |
33 | ||
34 | /** | |
35 | Initializes the bundle with the icon(s) found in the stream. | |
36 | ||
50b1e15e VZ |
37 | Notice that the @a stream must be seekable, at least if it contains |
38 | more than one icon. The stream pointer is positioned after the last | |
39 | icon read from the stream when this function returns. | |
40 | ||
cee875e3 VS |
41 | @since 2.9.0 |
42 | */ | |
43 | wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); | |
427c415b FM |
44 | |
45 | /** | |
46 | Initializes the bundle with a single icon. | |
47 | */ | |
7c913512 | 48 | wxIconBundle(const wxIcon& icon); |
427c415b FM |
49 | |
50 | /** | |
51 | Copy constructor. | |
52 | */ | |
7c913512 | 53 | wxIconBundle(const wxIconBundle& ic); |
23324ae1 FM |
54 | |
55 | /** | |
56 | Destructor. | |
57 | */ | |
adaaa686 | 58 | virtual ~wxIconBundle(); |
23324ae1 | 59 | |
427c415b | 60 | /** |
cee875e3 VS |
61 | Adds all the icons contained in the file to the bundle; if the |
62 | collection already contains icons with the same width and height, they | |
63 | are replaced by the new ones. | |
64 | */ | |
65 | void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); | |
66 | ||
67 | /** | |
68 | Adds all the icons contained in the stream to the bundle; if the | |
69 | collection already contains icons with the same width and height, they | |
70 | are replaced by the new ones. | |
71 | ||
50b1e15e VZ |
72 | Notice that, as well as in the constructor loading the icon bundle from |
73 | stream, the @a stream must be seekable, at least if more than one icon | |
74 | is to be loaded from it. | |
75 | ||
cee875e3 | 76 | @since 2.9.0 |
427c415b | 77 | */ |
cee875e3 | 78 | void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); |
427c415b | 79 | |
23324ae1 FM |
80 | /** |
81 | Adds the icon to the collection; if the collection already | |
82 | contains an icon with the same width and height, it is | |
83 | replaced by the new one. | |
84 | */ | |
7c913512 | 85 | void AddIcon(const wxIcon& icon); |
23324ae1 | 86 | |
23324ae1 | 87 | /** |
427c415b FM |
88 | Returns the icon with the given size; if no such icon exists, returns |
89 | the icon with size @c wxSYS_ICON_X and @c wxSYS_ICON_Y; if no such icon | |
90 | exists, returns the first icon in the bundle. | |
91 | ||
92 | If size = wxDefaultSize, returns the icon with size @c wxSYS_ICON_X and | |
93 | @c wxSYS_ICON_Y. | |
23324ae1 | 94 | */ |
328f5751 | 95 | wxIcon GetIcon(const wxSize& size) const; |
427c415b FM |
96 | |
97 | /** | |
98 | Same as @code GetIcon( wxSize( size, size ) ) @endcode. | |
99 | */ | |
a44f3b5a | 100 | wxIcon GetIcon(wxCoord size = wxDefaultCoord) const; |
23324ae1 FM |
101 | |
102 | /** | |
427c415b | 103 | Returns the icon with exactly the given size or ::wxNullIcon if this |
23324ae1 FM |
104 | size is not available. |
105 | */ | |
328f5751 | 106 | wxIcon GetIconOfExactSize(const wxSize& size) const; |
23324ae1 | 107 | |
6f9921e1 RD |
108 | /** |
109 | return the number of available icons | |
110 | */ | |
111 | size_t GetIconCount() const; | |
112 | ||
113 | /** | |
114 | return the icon at index (must be < GetIconCount()) | |
115 | */ | |
116 | wxIcon GetIconByIndex(size_t n) const; | |
117 | ||
23324ae1 | 118 | /** |
427c415b FM |
119 | Returns @true if the bundle doesn't contain any icons, @false otherwise |
120 | (in which case a call to GetIcon() with default parameter should return | |
121 | a valid icon). | |
23324ae1 | 122 | */ |
328f5751 | 123 | bool IsEmpty() const; |
23324ae1 FM |
124 | |
125 | /** | |
427c415b | 126 | Assignment operator, using @ref overview_refcount "reference counting". |
23324ae1 | 127 | */ |
43c48e1e | 128 | wxIconBundle& operator=(const wxIconBundle& ic); |
23324ae1 | 129 | |
23324ae1 | 130 | }; |
e54c96f1 FM |
131 | |
132 | ||
133 | /** | |
65874118 | 134 | An empty wxIconBundle. |
e54c96f1 FM |
135 | */ |
136 | wxIconBundle wxNullIconBundle; | |
137 | ||
138 |