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.
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 initialisation 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.
Bitmap, "Image
DC#draw_icon, Cursor
This is the recommended constructor for icons in wxRuby
Icon.new(%(arg-type)String% name, Integer bitmap_type, Integer desiredWidth = -1, Integer desiredHeight = -1)Loads an icon from a file or resource.
These are not currently available in wxRuby:
Icon.new(%(arg-type)% data, Integer type, Integer width, Integer height, Integer depth = -1)Creates an icon from the given data, which can be of arbitrary type.
Integer height Integer depth = 1)Creates an icon from an array of bits.
Icon.new(%(arg-type)Integer% width, Integer height, Integer depth = -1)Creates a new icon.
Icon.new(%(arg-type)char% bits) Icon.new(%(arg-type)char% bits)Creates an icon from XPM data.
BITMAP_TYPE_ICO | Load a Windows icon file. |
BITMAP_TYPE_ICO_RESOURCE | Load a Windows icon from the resource database. |
BITMAP_TYPE_GIF | Load a GIF bitmap file. |
BITMAP_TYPE_XBM | Load an X bitmap file. |
BITMAP_TYPE_XPM | Load an XPM bitmap file. |
The validity of these flags depends on the platform and Widgets
configuration. If all possible Widgets settings are used, the Windows
platform supports ICO file, ICO resource, XPM data, XPM file and PNG
file. Under GTK, the available formats are BMP file, XPM data, XPM file,
and PNG file. For cross-platform reliability, ensure that the second
argument specifying the type is given.
Creates a new Icon from the bitmap bmp. Under MS Windows and OS X the bitmap
must have mask colour set.
Gets the colour depth of the icon. A value of 1 indicates a
monochrome icon.
Gets the height of the icon in pixels.
Gets the width of the icon in pixels.
Loads an icon from a file or resource.
BITMAP_TYPE_ICO | Load a Windows icon file. |
BITMAP_TYPE_ICO_RESOURCE | Load a Windows icon from the resource database. |
BITMAP_TYPE_GIF | Load a GIF bitmap file. |
BITMAP_TYPE_XBM | Load an X bitmap file. |
BITMAP_TYPE_XPM | Load an XPM bitmap file. |
The validity of these flags depends on the platform and Widgets configuration.
true if the operation succeeded, false otherwise.
Returns true if icon data is present.
Saves an icon in the named file.
BITMAP_TYPE_ICO | Save a Windows icon file. |
BITMAP_TYPE_XPM | Save an XPM bitmap file. |
The validity of these flags depends on the platform and Widgets configuration.
true if the operation succeeded, false otherwise.
Depending on how Widgets has been configured, not all formats may be available.
Sets the depth member (does not affect the icon data).
Sets the height member (does not affect the icon data).
Sets the width member (does not affect the icon data).
Assignment operator. This operator does not copy any data, but instead
passes a pointer to the data in icon and increments a reference
counter. It is a fast operation.
Returns ‘this’ object.
Equality operator. This operator tests whether the internal data pointers are
equal (a fast test).
Returns true if the icons were effectively equal, false otherwise.
Inequality operator. This operator tests whether the internal data pointers are
unequal (a fast test).
Returns true if the icons were unequal, false otherwise.
[This page automatically generated from the Textile source at 2023-06-13 21:31:31 +0000]