wIcon

An icon is a small rectangular bitmap usually used for denoting a minimized application.

Superclass:wGdiObject
Seealso:wDC wIconImage

Types

wIconError = object of wGdiObjectError
  
An error raised when wIcon creation failed.

Procs

proc getSize(self: wIcon): wSize {...}{.inline, raises: [], tags: [].}
Gets the size of the icon in pixels.
proc getWidth(self: wIcon): int {...}{.inline, raises: [], tags: [].}
Gets the width of the icon in pixels.
proc getHeight(self: wIcon): int {...}{.inline, raises: [], tags: [].}
Gets the height of the icon in pixels.
proc final(self: wIcon) {...}{.raises: [], tags: [].}
Default finalizer for wIcon.
proc init(self: wIcon; iconImage: wIconImage; size = wDefaultSize) {...}{.
    raises: [NilAccessError, NilAccessError, Exception, wIconError],
    tags: [RootEffect].}
Initializes an icon from a wIconImage object.
proc Icon(iconImage: wIconImage; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError], tags: [RootEffect].}
Constructor.
proc init(self: wIcon; bmp: wBitmap; size = wDefaultSize) {...}{.inline,
    raises: [NilAccessError, NilAccessError, Exception, wIconError],
    tags: [RootEffect].}
Initializes an icon from the given wBitmap object.
proc Icon(bmp: wBitmap; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError], tags: [RootEffect].}
Constructor.
proc init(self: wIcon; image: wImage; size = wDefaultSize) {...}{.
    raises: [NilAccessError, Exception, NilAccessError, wIconError],
    tags: [RootEffect].}
Initializes an icon from the given wImage object.
proc Icon(image: wImage; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError], tags: [RootEffect].}
Constructor.
proc init(self: wIcon; data: pointer; length: int; size = wDefaultSize) {...}{.inline,
    raises: [NilAccessError, NilAccessError, Exception, wIconError],
    tags: [RootEffect].}
Initializes an icon from binary data of .ico or .cur file.
proc Icon(data: pointer; length: int; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError], tags: [RootEffect].}
Constructor.
proc init(self: wIcon; str: string; size = wDefaultSize) {...}{.inline,
    raises: [NilAccessError, Exception, wIconError],
    tags: [RootEffect, ReadIOEffect].}

Initializes an icon from a file. The file should be in format of .ico, .cur, 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 or .cur file.

For Windows PE file (.exe or .dll), you should use 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.

If size is wDefaultSize, it uses the SM_CXICON/SM_CXCURSOR system metric value as default value.

proc Icon(str: string; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError],
    tags: [RootEffect, ReadIOEffect].}
Constructor.
proc init(self: wIcon; hIcon: HICON; copy = true; shared = false) {...}{.raises: [wIconError],
    tags: [].}
Initializes an icon from system icon handle. If copy is false, the function only wrap the handle to wIcon object. If shared is false, the handle will be destroyed together with wIcon object by the GC. Otherwise, the caller is responsible for destroying it.
proc Icon(hIcon: HICON; copy = true; shared = false): wIcon {...}{.inline, discardable,
    raises: [wIconError], tags: [].}
Constructor.
proc init(self: wIcon; icon: wIcon) {...}{.raises: [NilAccessError, wIconError], tags: [].}
Initializes an icon from a wIcon object, aka. copy.
proc Icon(icon: wIcon): wIcon {...}{.inline, discardable,
                            raises: [NilAccessError, wIconError], tags: [].}
Constructor.
proc init(self: wIcon; cursor: wCursor) {...}{.raises: [NilAccessError, wIconError], tags: [].}
Initializes an icon from a wCursor object.
proc Icon(cursor: wCursor): wIcon {...}{.inline, discardable,
                                raises: [NilAccessError, wIconError], tags: [].}
Constructor.
proc init(self: wIcon; filename: string; index: int; size = wDefaultSize) {...}{.inline,
    raises: [NilAccessError, Exception, wIconError],
    tags: [RootEffect, ReadIOEffect].}

Initializes an icon from a Windows PE file (.exe or .dll, etc). Use zero-based index to specified the resource position, and negative value to specified the resource identifier. Empty filename to specified the current executable file.

If size is wDefaultSize, it uses the SM_CXICON/SM_CXCURSOR system metric value as default value.

proc Icon(filename: string; index: int; size = wDefaultSize): wIcon {...}{.inline, discardable,
    raises: [NilAccessError, Exception, wIconError],
    tags: [RootEffect, ReadIOEffect].}
Constructor.

Methods

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