| 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 | @since 2.9.0 |
| 38 | */ |
| 39 | wxIconBundle(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); |
| 40 | |
| 41 | /** |
| 42 | Initializes the bundle with a single icon. |
| 43 | */ |
| 44 | wxIconBundle(const wxIcon& icon); |
| 45 | |
| 46 | /** |
| 47 | Copy constructor. |
| 48 | */ |
| 49 | wxIconBundle(const wxIconBundle& ic); |
| 50 | |
| 51 | /** |
| 52 | Destructor. |
| 53 | */ |
| 54 | virtual ~wxIconBundle(); |
| 55 | |
| 56 | /** |
| 57 | Adds all the icons contained in the file to the bundle; if the |
| 58 | collection already contains icons with the same width and height, they |
| 59 | are replaced by the new ones. |
| 60 | */ |
| 61 | void AddIcon(const wxString& file, wxBitmapType type = wxBITMAP_TYPE_ANY); |
| 62 | |
| 63 | /** |
| 64 | Adds all the icons contained in the stream to the bundle; if the |
| 65 | collection already contains icons with the same width and height, they |
| 66 | are replaced by the new ones. |
| 67 | |
| 68 | @since 2.9.0 |
| 69 | */ |
| 70 | void AddIcon(wxInputStream& stream, wxBitmapType type = wxBITMAP_TYPE_ANY); |
| 71 | |
| 72 | /** |
| 73 | Adds the icon to the collection; if the collection already |
| 74 | contains an icon with the same width and height, it is |
| 75 | replaced by the new one. |
| 76 | */ |
| 77 | void AddIcon(const wxIcon& icon); |
| 78 | |
| 79 | /** |
| 80 | Returns the icon with the given size; if no such icon exists, returns |
| 81 | the icon with size @c wxSYS_ICON_X and @c wxSYS_ICON_Y; if no such icon |
| 82 | exists, returns the first icon in the bundle. |
| 83 | |
| 84 | If size = wxDefaultSize, returns the icon with size @c wxSYS_ICON_X and |
| 85 | @c wxSYS_ICON_Y. |
| 86 | */ |
| 87 | wxIcon GetIcon(const wxSize& size) const; |
| 88 | |
| 89 | /** |
| 90 | Same as @code GetIcon( wxSize( size, size ) ) @endcode. |
| 91 | */ |
| 92 | wxIcon GetIcon(wxCoord size = wxDefaultCoord) const; |
| 93 | |
| 94 | /** |
| 95 | Returns the icon with exactly the given size or ::wxNullIcon if this |
| 96 | size is not available. |
| 97 | */ |
| 98 | wxIcon GetIconOfExactSize(const wxSize& size) const; |
| 99 | |
| 100 | /** |
| 101 | Returns @true if the bundle doesn't contain any icons, @false otherwise |
| 102 | (in which case a call to GetIcon() with default parameter should return |
| 103 | a valid icon). |
| 104 | */ |
| 105 | bool IsEmpty() const; |
| 106 | |
| 107 | /** |
| 108 | Assignment operator, using @ref overview_refcount "reference counting". |
| 109 | */ |
| 110 | wxIconBundle& operator=(const wxIconBundle& ic); |
| 111 | |
| 112 | /** |
| 113 | Equality operator. This returns @true if two icon bundles are equal. |
| 114 | */ |
| 115 | bool operator ==(const wxIconBundle& ic); |
| 116 | |
| 117 | /** |
| 118 | Inequality operator. This returns true if two icon bundles are not equal. |
| 119 | */ |
| 120 | bool operator !=(const wxIconBundle& ic); |
| 121 | }; |
| 122 | |
| 123 | |
| 124 | /** |
| 125 | An empty wxIconBundle. |
| 126 | */ |
| 127 | wxIconBundle wxNullIconBundle; |
| 128 | |
| 129 | |