wCursor

A cursor is a small bitmap usually used for denoting where the mouse pointer is. There are two special predefined cursor: wNilCursor and wDefaultCursor. See wWindow.setCursor() for details.

Superclass:wGdiObject
Seealso:wDC wPredefined wIconImage
Enum:
wStockCursorDescription
wCursorArrowStandard arrow
wCursorIbeamI-beam
wCursorWaitHourglass
wCursorCrossCrosshair
wCursorUpArrowVertical arrow
wCursorSizeNwseDouble-pointed arrow pointing northwest and southeast
wCursorSizeNeswDouble-pointed arrow pointing northeast and southwest
wCursorSizeWeDouble-pointed arrow pointing west and east
wCursorSizeNsDouble-pointed arrow pointing north and south
wCursorSizeAllFour-pointed arrow pointing north, south, east, and west
wCursorNoSlashed circle
wCursorHandHand
wCursorAppStartingStandard arrow and small hourglass
wCursorHelpArrow and question mark

Types

wStockCursor = enum
  wCursorArrow = 32512, wCursorIbeam = 32513, wCursorWait = 32514, wCursorCross = 32515,
  wCursorUpArrow = 32516, wCursorSize = 32640, wCursorIcon = 32641,
  wCursorSizeNwse = 32642, wCursorSizeNesw = 32643, wCursorSizeWe = 32644,
  wCursorSizeNs = 32645, wCursorSizeAll = 32646, wCursorNo = 32648, wCursorHand = 32649,
  wCursorAppStarting = 32650, wCursorHelp = 32651
wCursorError = object of wGdiObjectError
  
An error raised when wCursor creation failed.

Procs

proc getHotspot(self: wCursor): wPoint {...}{.validate, property, raises: [], tags: [].}
Returns the coordinates of the cursor hotspot.
proc getSize(self: wCursor): wSize {...}{.validate, property, raises: [], tags: [].}
Returns the size of the cursor.
proc getWidth(self: wCursor): int {...}{.validate, property, inline, raises: [], tags: [].}
Gets the width of the cursor in pixels.
proc getHeight(self: wCursor): int {...}{.validate, property, inline, raises: [], tags: [].}
Gets the height of the cursor in pixels.
proc final(self: wCursor) {...}{.raises: [], tags: [].}
Default finalizer for wCursor.
proc init(self: wCursor; hCursor: HCURSOR; copy = true; shared = false;
         hotspot = wDefaultPoint) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Cursor(hCursor: HCURSOR; copy = true; shared = false; hotspot = wDefaultPoint): wCursor {...}{.
    inline, raises: [], tags: [].}
Creates a cursor from Windows cursor handle. If copy is false, this only wrap it to wCursor object. It means the handle will be destroyed by wCursor when it is destroyed. So if you wrap a shared cursor handle into wCursor, you must set shared = true to avoid the handle being destroyed.
proc init(self: wCursor; id: wStockCursor) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Cursor(id: wStockCursor): wCursor {...}{.inline, raises: [], tags: [].}
Creates a cursor using a cursor identifier.
proc init(self: wCursor; iconImage: wIconImage; size = wDefaultSize;
         hotspot = wDefaultPoint) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Cursor(iconImage: wIconImage; size = wDefaultSize; hotspot = wDefaultPoint): wCursor {...}{.
    inline, raises: [], tags: [].}
Creates a cursor from an icon image. If hotspot is wDefaultPoint, it use the hotspot stored in wIconImage object. If it is wDefaultPoint too, the creation failed.
proc init(self: wCursor; icon: wIcon; hotspot: wPoint) {...}{.validate, inline, raises: [],
    tags: [].}
Initializer.
proc Cursor(icon: wIcon; hotspot: wPoint): wCursor {...}{.inline, raises: [], tags: [].}
Creates a cursor from the given wIcon object and hotspot.
proc init(self: wCursor; image: wImage; hotspot: wPoint) {...}{.validate, inline, raises: [],
    tags: [].}
Initializer.
proc Cursor(image: wImage; hotspot: wPoint): wCursor {...}{.inline, raises: [], tags: [].}
Creates a cursor from the given wImage object and hotspot.
proc init(self: wCursor; bmp: wBitmap; hotspot: wPoint) {...}{.validate, inline, raises: [],
    tags: [].}
Initializer.
proc Cursor(bmp: wBitmap; hotspot: wPoint): wCursor {...}{.inline, raises: [], tags: [].}
Creates a cursor from the given wBitmap object and hotspot.
proc init(self: wCursor; cursor: wCursor; hotspot = wDefaultPoint) {...}{.validate, inline,
    raises: [], tags: [].}
Initializer.
proc Cursor(cursor: wCursor; hotspot = wDefaultPoint): wCursor {...}{.inline, raises: [],
    tags: [].}
Copy constructor. Hotspot can be changed if needed.
proc init(self: wCursor; data: pointer; length: int; size = wDefaultSize;
         hotspot = wDefaultPoint) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Cursor(data: pointer; length: int; size = wDefaultSize; hotspot = wDefaultPoint): wCursor {...}{.
    inline, raises: [], tags: [].}
Creates a cursor from binary data of .ico, .cur, or .ani file.
proc init(self: wCursor; str: string; size = wDefaultSize; hotspot = wDefaultPoint) {...}{.
    validate, raises: [], tags: [].}
Initializer.
proc Cursor(str: string; size = wDefaultSize; hotspot = wDefaultPoint): wCursor {...}{.inline,
    raises: [], tags: [].}

Creates a cursor from a file. The file should be in format of .ico, .cur, .ani, or Windows PE file (.exe or .dll, etc). If str is not a valid file path, it will be regarded as the binary data of .ico, .cur, or .ani file.

For Windows PE file (.exe or .dll), it allows string like "shell32.dll,-10" to specifies the icon index or "shell32.dll:-1001" to to specifies the cursor index. Use zero-based index to specified the resource position, and negative value to specified the resource identifier. Empty filename (e.g. ",-1") to specified the current executable file.

Methods

method delete(self: wCursor) {...}{.raises: [], tags: [].}
Nim's garbage collector will delete this object by default. However, sometimes you maybe want do that by yourself.