An icon is a small rectangular bitmap usually used for denoting a minimized application.
It differs from a Bitmap in always having a mask associated with it for transparent drawing. On some platforms, icons and bitmaps are implemented identically, since there is no real distinction between a Bitmap with a mask and an icon; and there is no specific icon format on some platforms (X-based applications usually standardize on XPMs for small bitmaps and icons). However, some platforms (such as Windows) make the distinction, so a separate class is provided.
Note
It is usually desirable to associate a pertinent icon with a frame. Icons can also be used for other purposes, for example with TreeCtrl and ListCtrl. Icons have different formats on different platforms therefore separate icons will usually be created for the different environments. Platform-specific methods for creating a Icon structure are catered for, and this is an occasion where conditional compilation will probably be required. Note that a new icon must be created for every time the icon is to be used for a new window. In Windows, the icon will not be reloaded if it has already been used. An icon allocated to a frame will be deleted when the frame is deleted. For more information please see Bitmaps and Icons.
See also
Bitmaps and Icons, Supported Bitmap File Formats, DC.DrawIcon , Cursor
__init__ | Default constructor. |
CopyFromBitmap | Copies bmp bitmap to this icon. |
GetDepth | Gets the colour depth of the icon. |
GetHandle | |
GetHeight | Gets the height of the icon in pixels. |
GetWidth | Gets the width of the icon in pixels. |
IsOk | Returns True if icon data is present. |
LoadFile | Loads an icon from a file or resource. |
SetDepth | Sets the depth member (does not affect the icon data). |
SetHandle | |
SetHeight | Sets the height member (does not affect the icon data). |
SetWidth | Sets the width member (does not affect the icon data). |
__nonzero__ |
Depth | See GetDepth and SetDepth |
Handle | See GetHandle and SetHandle |
Height | See GetHeight and SetHeight |
Width | See GetWidth and SetWidth |
An icon is a small rectangular bitmap usually used for denoting a minimized application.
Possible constructors:
Icon()
Icon(icon)
Icon(name, type=BITMAP_TYPE_ANY, desiredWidth=-1, desiredHeight=-1)
Icon(loc)
Overloaded Implementations:
__init__ (self)
Default constructor.
Constructs an icon object with no data; an assignment or another member function such as LoadFile must be called subsequently.
__init__ (self, icon)
Copy constructor.
Parameters: | icon (Icon) – |
---|
__init__ (self, name, type=BITMAP_TYPE_ANY, desiredWidth=-1, desiredHeight=-1)
Loads an icon from a file or resource.
Parameters: |
|
---|
See also
__init__ (self, loc)
Loads an icon from the specified location.
Parameters: | loc (IconLocation) – |
---|
Copies bmp bitmap to this icon.
Under MS Windows the bitmap must have mask colour set.
Parameters: | bmp (Bitmap) – |
---|
See also
Gets the colour depth of the icon.
A value of 1 indicates a monochrome icon.
Return type: | int |
---|
Return type: | long |
---|
Returns True if icon data is present.
Return type: | bool |
---|
Loads an icon from a file or resource.
Parameters: |
|
---|---|
Return type: | bool |
Returns: | True if the operation succeeded, False otherwise. |
Sets the depth member (does not affect the icon data).
Parameters: | depth (int) – Icon depth. |
---|
Sets the height member (does not affect the icon data).
Parameters: | height (int) – Icon height in pixels. |
---|
Sets the width member (does not affect the icon data).
Parameters: | width (int) – Icon width in pixels. |
---|
Return type: | int |
---|