wx.IconBundle¶
This class contains multiple copies of an icon in different sizes.
It is typically used in wx.Dialog.SetIcons
and wx.TopLevelWindow.SetIcons
.
Class Hierarchy¶
Methods Summary¶
Default constructor. |
|
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. |
|
Returns the icon with the given size. |
|
return the icon at index (must be < |
|
return the number of available icons |
|
Returns the icon with exactly the given size or |
|
Returns |
Properties Summary¶
See |
|
See |
Class API¶
- class wx.IconBundle(GDIObject)¶
Possible constructors:
IconBundle() -> None IconBundle(file, type=BITMAP_TYPE_ANY) -> None IconBundle(stream, type=BITMAP_TYPE_ANY) -> None IconBundle(icon) -> None IconBundle(ic) -> None
This class contains multiple copies of an icon in different sizes.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Default constructor.
- Return type:
None
__init__ (self, file, type=BITMAP_TYPE_ANY)
Initializes the bundle with the icon(s) found in the file.
- Parameters:
file (string)
type (BitmapType)
- Return type:
None
__init__ (self, stream, type=BITMAP_TYPE_ANY)
Initializes the bundle with the icon(s) found in the stream.
Notice that the 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.
- Parameters:
stream (wx.InputStream)
type (BitmapType)
- Return type:
None
Added in version 2.9.0.
__init__ (self, icon)
Initializes the bundle with a single icon.
- Parameters:
icon (wx.Icon)
- Return type:
None
__init__ (self, ic)
Copy constructor.
- Parameters:
ic (wx.IconBundle)
- Return type:
None
- AddIcon(self, *args, **kw)¶
-
AddIcon (self, file, type=BITMAP_TYPE_ANY)
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.
- Parameters:
file (string)
type (BitmapType)
- Return type:
None
AddIcon (self, stream, type=BITMAP_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 stream must be seekable, at least if more than one icon is to be loaded from it.
- Parameters:
stream (wx.InputStream)
type (BitmapType)
- Return type:
None
Added in version 2.9.0.
AddIcon (self, icon)
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.
- Parameters:
icon (wx.Icon)
- Return type:
None
- GetIcon(self, *args, **kw)¶
-
GetIcon (self, size, flags=FALLBACK_SYSTEM)
Returns the icon with the given size.
If size is
wx.DefaultSize
, it is interpreted as the standard system icon size, i.e. the size returned bywx.SystemSettings.GetMetric
forSYS_ICON_X
andSYS_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
wx.IconBundle.FALLBACK_NONE
is given, the function returns an invalid icon. Ifwx.IconBundle.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 either, butwx.IconBundle.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 flags parameter is available only since wxWidgets 2.9.4.
GetIcon (self, size=DefaultCoord, flags=FALLBACK_SYSTEM)
Same as.
GetIcon(wx.Size(size, size))
- Parameters:
size (int)
flags (int)
- Return type:
- GetIconByIndex(self, n)¶
return the icon at index (must be <
GetIconCount
)- Parameters:
n (int)
- Return type:
- GetIconCount(self)¶
return the number of available icons
- Return type:
int
- GetIconOfExactSize(self, size)¶
Returns the icon with exactly the given size or
wx.NullIcon
if this size is not available.
- IsEmpty(self)¶
Returns
True
if the bundle doesn’t contain any icons,False
otherwise (in which case a call toGetIcon
with default parameter should return a valid icon).- Return type:
bool
Properties¶
- IconCount¶
See
GetIconCount