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