]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/iconbndl.h
Implement setFont on the iOS port of wxStaticText.
[wxWidgets.git] / interface / wx / iconbndl.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: iconbndl.h
e54c96f1 3// Purpose: interface of wxIconBundle
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxIconBundle
7c913512 10
427c415b
FM
11 This class contains multiple copies of an icon in different sizes.
12 It is typically used in wxDialog::SetIcons and wxTopLevelWindow::SetIcons.
7c913512 13
23324ae1 14 @library{wxcore}
427c415b 15 @category{gdi}
7c913512 16
23324ae1 17 @stdobjects
65874118 18 ::wxNullIconBundle
23324ae1
FM
19*/
20class wxIconBundle : public wxGDIObject
21{
22public:
d928f019
VZ
23 /**
24 The elements of this enum determine what happens if GetIcon() doesn't
25 find the icon of exactly the requested size.
26
27 @since 2.9.4
28 */
29 enum
30 {
31 /// Return invalid icon if exact size is not found.
32 FALLBACK_NONE = 0,
33
34 /// Return the icon of the system icon size if exact size is not found.
35 /// May be combined with other non-NONE enum elements to determine what
36 /// happens if the system icon size is not found neither.
37 FALLBACK_SYSTEM = 1,
38
39 /// Return the icon of closest larger size or, if there is no icon of
40 /// larger size in the bundle, the closest icon of smaller size.
41 FALLBACK_NEAREST_LARGER = 2
42 };
43
44
23324ae1 45 /**
427c415b 46 Default ctor.
23324ae1
FM
47 */
48 wxIconBundle();
427c415b
FM
49
50 /**
51 Initializes the bundle with the icon(s) found in the file.
52 */
cee875e3
VS
53 wxIconBundle(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
54
55 /**
56 Initializes the bundle with the icon(s) found in the stream.
57
50b1e15e
VZ
58 Notice that the @a stream must be seekable, at least if it contains
59 more than one icon. The stream pointer is positioned after the last
60 icon read from the stream when this function returns.
61
cee875e3
VS
62 @since 2.9.0
63 */
64 wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
427c415b
FM
65
66 /**
67 Initializes the bundle with a single icon.
68 */
7c913512 69 wxIconBundle(const wxIcon& icon);
427c415b
FM
70
71 /**
72 Copy constructor.
73 */
7c913512 74 wxIconBundle(const wxIconBundle& ic);
23324ae1
FM
75
76 /**
77 Destructor.
78 */
adaaa686 79 virtual ~wxIconBundle();
23324ae1 80
427c415b 81 /**
cee875e3
VS
82 Adds all the icons contained in the file to the bundle; if the
83 collection already contains icons with the same width and height, they
84 are replaced by the new ones.
85 */
86 void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY);
87
88 /**
89 Adds all the icons contained in the stream to the bundle; if the
90 collection already contains icons with the same width and height, they
91 are replaced by the new ones.
92
50b1e15e
VZ
93 Notice that, as well as in the constructor loading the icon bundle from
94 stream, the @a stream must be seekable, at least if more than one icon
95 is to be loaded from it.
96
cee875e3 97 @since 2.9.0
427c415b 98 */
cee875e3 99 void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
427c415b 100
23324ae1
FM
101 /**
102 Adds the icon to the collection; if the collection already
103 contains an icon with the same width and height, it is
104 replaced by the new one.
105 */
7c913512 106 void AddIcon(const wxIcon& icon);
23324ae1 107
23324ae1 108 /**
d928f019
VZ
109 Returns the icon with the given size.
110
111 If @a size is ::wxDefaultSize, it is interpreted as the standard system
112 icon size, i.e. the size returned by wxSystemSettings::GetMetric() for
113 @c wxSYS_ICON_X and @c wxSYS_ICON_Y.
114
115 If the bundle contains an icon with exactly the requested size, it's
116 always returned. Otherwise, the behaviour depends on the flags. If only
8c6471af
SL
117 wxIconBundle::FALLBACK_NONE is given, the function returns an invalid
118 icon. If wxIconBundle::FALLBACK_SYSTEM is given, it tries to find the
119 icon of standard system size, regardless of the size passed as
120 parameter. Otherwise, or if the icon system size is not found neither,
121 but wxIconBundle::FALLBACK_NEAREST_LARGER flag is specified, the
122 function returns the smallest icon of the size larger than the
123 requested one or, if this fails too, just the icon closest to the
124 specified size.
427c415b 125
d928f019 126 The @a flags parameter is available only since wxWidgets 2.9.4.
23324ae1 127 */
d928f019 128 wxIcon GetIcon(const wxSize& size, int flags = FALLBACK_SYSTEM) const;
427c415b
FM
129
130 /**
131 Same as @code GetIcon( wxSize( size, size ) ) @endcode.
132 */
d928f019
VZ
133 wxIcon GetIcon(wxCoord size = wxDefaultCoord,
134 int flags = FALLBACK_SYSTEM) const;
23324ae1
FM
135
136 /**
427c415b 137 Returns the icon with exactly the given size or ::wxNullIcon if this
23324ae1
FM
138 size is not available.
139 */
328f5751 140 wxIcon GetIconOfExactSize(const wxSize& size) const;
23324ae1 141
6f9921e1
RD
142 /**
143 return the number of available icons
144 */
145 size_t GetIconCount() const;
146
147 /**
148 return the icon at index (must be < GetIconCount())
149 */
150 wxIcon GetIconByIndex(size_t n) const;
151
23324ae1 152 /**
427c415b
FM
153 Returns @true if the bundle doesn't contain any icons, @false otherwise
154 (in which case a call to GetIcon() with default parameter should return
155 a valid icon).
23324ae1 156 */
328f5751 157 bool IsEmpty() const;
23324ae1
FM
158
159 /**
427c415b 160 Assignment operator, using @ref overview_refcount "reference counting".
23324ae1 161 */
43c48e1e 162 wxIconBundle& operator=(const wxIconBundle& ic);
23324ae1 163
23324ae1 164};
e54c96f1
FM
165
166
167/**
65874118 168 An empty wxIconBundle.
e54c96f1
FM
169*/
170wxIconBundle wxNullIconBundle;
171
172