- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.cursor_icon.CursorOrIcon Class Reference

The smjg.libs.sdwf.cursor_icon.CursorOrIcon class is the abstract base class from which the MouseCursor and Icon classes are derived. More...

Inheritance diagram for smjg.libs.sdwf.cursor_icon.CursorOrIcon:

List of all members.

## Properties
typedef colourBitmap | colorBitmap
HANDLE | handle ()
| The Windows handle of this cursor or icon.
ICONINFO | info ()
| The specification of this icon as a Windows `ICONINFO` structure.
Bitmap | maskBitmap ()
| The bitmask of the cursor or icon.
Bitmap | colourBitmap ()
| The colour image of the cursor or icon.
RectDim | dim ()
| The dimensions of the cursor or icon.
int | width ()
| The width of the cursor or icon.
int | height ()
| The width of the cursor or icon.
Point | hotspot ()
| The coordinates of the cursor's hotspot.
abstract CursorOrIcon | dup ()
| Creates a copy of the cursor or icon.
abstract CursorOrIcon | resize (int width, int height, bool monochrome=false, bool fromResource=true)
| Creates a resized image of the cursor or icon.
abstract CursorOrIcon | resize (RectDim dim, bool monochrome=false, bool fromResource=true)
| Creates a resized image of the cursor or icon.
## Operators
final int | opEquals (Object o)
| Determines whether this CursorOrIcon is equal to another object.
final int | opEquals (CursorOrIcon c)
| Determines whether this CursorOrIcon is equal to another CursorOrIcon.
| this (HANDLE h, bool autoDelete, bool fromResource, uint imageType)
| Constructs a CursorOrIcon to wrap the given handle.
| this (inout ICONINFO info, bit autoDelete, uint imageType)
| Constructs a CursorOrIcon from the given specification.
| this (CursorOrIcon orig, int width, int height, uint flags)

## Detailed Description

The smjg.libs.sdwf.cursor_icon.CursorOrIcon class is the abstract base class from which the MouseCursor and Icon classes are derived.

Because mouse cursors and icons are very similar in the way Windows handles them, this base class exists to encapsulate operations that are common to both.

Since:
  0.51

## Member Typedef Documentation

typedef colourBitmap smjg.libs.sdwf.cursor_icon.CursorOrIcon.colorBitmap

## Constructor & Destructor Documentation

smjg.libs.sdwf.cursor_icon.CursorOrIcon.this | ( | HANDLE | h,
|  | bool | autoDelete,
|  | bool | fromResource,
|  | uint | imageType |
| ) |  |  | `[protected]`

Constructs a CursorOrIcon to wrap the given handle.

Parameters:

  | h | Windows handle of the cursor or icon to be wrapped.
  | autoDelete | whether the Windows handle should be automatically deleted when the SDWF object is garbage collected. This will generally be true for application-created objects and false for stock objects.
  | imageType | 1 if it's an icon; 2 if it's a cursor

Status:
  test

smjg.libs.sdwf.cursor_icon.CursorOrIcon.this | ( | inout ICONINFO | info,
|  | bit | autoDelete,
|  | uint | imageType |
| ) |  |  | `[protected]`

Constructs a CursorOrIcon from the given specification.

Parameters:

  | info | a structure specifying the characteristics and image of the cursor or icon.
  | autoDelete | whether the Windows handle should be automatically deleted when the SDWF object is garbage collected. This will generally be true for application-created objects and false for stock objects and those loaded from resources.
  | imageType | 1 if it's an icon; 2 if it's a cursor.

Status:
  test

smjg.libs.sdwf.cursor_icon.CursorOrIcon.this | ( | CursorOrIcon | orig,
|  | int | width,
|  | int | height,
|  | uint | flags |
| ) |  |  | `[protected]`

## Member Function Documentation

HANDLE smjg.libs.sdwf.cursor_icon.CursorOrIcon.handle | ( |  | ) |

The Windows handle of this cursor or icon.

ICONINFO smjg.libs.sdwf.cursor_icon.CursorOrIcon.info | ( |  | ) |

The specification of this icon as a Windows `ICONINFO` structure.

Bitmap smjg.libs.sdwf.cursor_icon.CursorOrIcon.maskBitmap | ( |  | ) |

The bitmask of the cursor or icon.

For a monochrome image, the upper half is the AND bitmask and the lower half is the XOR bitmask.

      AND bit     XOR bit     Resulting colour
      0           0           Black
      0           1           White
      1           0           Transparent
      1           1           Inverse

For a colour image, this bitmap is only the AND bitmask, and the colourBitmap property gives the XOR bitmask.

Note:
  This is a separate copy of the bitmap from that which was used to create the cursor or icon. However, repeated accesses of this property will return the same copy.

Status:
  done

Bitmap smjg.libs.sdwf.cursor_icon.CursorOrIcon.colourBitmap | ( |  | ) |

The colour image of the cursor or icon.

This is the XOR bitmask of a colour cursor or icon. In layperson's terms, it's the image on a black background.

For a monochrome cursor or icon, this member will be null.

Note:
  This is a separate copy of the bitmap from that which was used to create the cursor or icon. However, repeated accesses of this property will return the same copy.

Status:
  done

RectDim smjg.libs.sdwf.cursor_icon.CursorOrIcon.dim | ( |  | ) |

The dimensions of the cursor or icon.

Usually this will be equal to the system icon or cursor size.

Status:
  test

int smjg.libs.sdwf.cursor_icon.CursorOrIcon.width | ( |  | ) |

The width of the cursor or icon.

int smjg.libs.sdwf.cursor_icon.CursorOrIcon.height | ( |  | ) |

The width of the cursor or icon.

Point smjg.libs.sdwf.cursor_icon.CursorOrIcon.hotspot | ( |  | ) |

The coordinates of the cursor's hotspot.

Reimplemented in smjg.libs.sdwf.cursor_icon.MouseCursor.

abstract CursorOrIcon smjg.libs.sdwf.cursor_icon.CursorOrIcon.dup | ( |  | ) | `[pure virtual]`

Creates a copy of the cursor or icon.

Implemented in smjg.libs.sdwf.cursor_icon.MouseCursor, and smjg.libs.sdwf.cursor_icon.Icon.

abstract CursorOrIcon smjg.libs.sdwf.cursor_icon.CursorOrIcon.resize | ( | int | width,
|  | int | height,
|  | bool | monochrome = `false`,
|  | bool | fromResource = `true` |
| ) |  |  | `[pure virtual]`

Creates a resized image of the cursor or icon.

Parameters:

  | width | the new width in pixels.
  | height | the new height in pixels.
  | monochrome | whether to convert the image to monochrome.
  | fromResource | whether to reload the resource (if applicable) and look for an image of the desired size.

Status:
  test

Implemented in smjg.libs.sdwf.cursor_icon.MouseCursor, and smjg.libs.sdwf.cursor_icon.Icon.

abstract CursorOrIcon smjg.libs.sdwf.cursor_icon.CursorOrIcon.resize | ( | RectDim | dim,
|  | bool | monochrome = `false`,
|  | bool | fromResource = `true` |
| ) |  |  | `[pure virtual]`

Creates a resized image of the cursor or icon.

Parameters:

  | dim | the new dimensions in pixels.
  | monochrome | whether to convert the image to monochrome.
  | fromResource | whether to reload the resource (if applicable) and look for an image of the desired size.

Status:
  test

Implemented in smjg.libs.sdwf.cursor_icon.MouseCursor, and smjg.libs.sdwf.cursor_icon.Icon.

final int smjg.libs.sdwf.cursor_icon.CursorOrIcon.opEquals | ( | Object | o | ) |

Determines whether this CursorOrIcon is equal to another object.

final int smjg.libs.sdwf.cursor_icon.CursorOrIcon.opEquals | ( | CursorOrIcon | c | ) |

Determines whether this CursorOrIcon is equal to another CursorOrIcon.

Two CursorOrIcon objects are equal iff they have the same handle, i.e. they represent a single copy of a cursor or icon.

The documentation for this class was generated from the following file:

- cursor_icon.d