]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/iconbndl.h
Define INVALID_FILE_ATTRIBUTES in filename.cpp too.
[wxWidgets.git] / interface / wx / iconbndl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: iconbndl.h
3 // Purpose: interface of wxIconBundle
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxIconBundle
11
12 This class contains multiple copies of an icon in different sizes.
13 It is typically used in wxDialog::SetIcons and wxTopLevelWindow::SetIcons.
14
15 @library{wxcore}
16 @category{gdi}
17
18 @stdobjects
19 ::wxNullIconBundle
20 */
21 class wxIconBundle : public wxGDIObject
22 {
23 public:
24 /**
25 Default ctor.
26 */
27 wxIconBundle();
28
29 /**
30 Initializes the bundle with the icon(s) found in the file.
31 */
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
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
41 @since 2.9.0
42 */
43 wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
44
45 /**
46 Initializes the bundle with a single icon.
47 */
48 wxIconBundle(const wxIcon& icon);
49
50 /**
51 Copy constructor.
52 */
53 wxIconBundle(const wxIconBundle& ic);
54
55 /**
56 Destructor.
57 */
58 virtual ~wxIconBundle();
59
60 /**
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
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
76 @since 2.9.0
77 */
78 void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY);
79
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 */
85 void AddIcon(const wxIcon& icon);
86
87 /**
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.
94 */
95 wxIcon GetIcon(const wxSize& size) const;
96
97 /**
98 Same as @code GetIcon( wxSize( size, size ) ) @endcode.
99 */
100 wxIcon GetIcon(wxCoord size = wxDefaultCoord) const;
101
102 /**
103 Returns the icon with exactly the given size or ::wxNullIcon if this
104 size is not available.
105 */
106 wxIcon GetIconOfExactSize(const wxSize& size) const;
107
108 /**
109 Returns @true if the bundle doesn't contain any icons, @false otherwise
110 (in which case a call to GetIcon() with default parameter should return
111 a valid icon).
112 */
113 bool IsEmpty() const;
114
115 /**
116 Assignment operator, using @ref overview_refcount "reference counting".
117 */
118 wxIconBundle& operator=(const wxIconBundle& ic);
119
120 /**
121 Equality operator. This returns @true if two icon bundles are equal.
122 */
123 bool operator ==(const wxIconBundle& ic);
124
125 /**
126 Inequality operator. This returns true if two icon bundles are not equal.
127 */
128 bool operator !=(const wxIconBundle& ic);
129 };
130
131
132 /**
133 An empty wxIconBundle.
134 */
135 wxIconBundle wxNullIconBundle;
136
137