wIcon

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

Superclass:wGdiObject
Seealso:wDC wPredefined wIconImage

Types

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

Procs

proc getSize(self: wIcon): wSize {...}{.validate, property, inline, raises: [], tags: [].}
Gets the size of the icon in pixels.
proc getWidth(self: wIcon): int {...}{.validate, property, inline, raises: [], tags: [].}
Gets the width of the icon in pixels.
proc getHeight(self: wIcon): int {...}{.validate, property, 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) {...}{.validate,
    raises: [], tags: [].}
Initializer.
proc Icon(iconImage: wIconImage; size = wDefaultSize): wIcon {...}{.inline, raises: [],
    tags: [].}
Creates an icon from a wIconImage object.
proc init(self: wIcon; bmp: wBitmap; size = wDefaultSize) {...}{.validate, inline, raises: [],
    tags: [].}
Initializer.
proc Icon(bmp: wBitmap; size = wDefaultSize): wIcon {...}{.inline, raises: [], tags: [].}
Creates an icon from the given wBitmap object.
proc init(self: wIcon; image: wImage; size = wDefaultSize) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Icon(image: wImage; size = wDefaultSize): wIcon {...}{.inline, raises: [], tags: [].}
Creates an icon from the given wImage object.
proc init(self: wIcon; data: pointer; length: int; size = wDefaultSize) {...}{.validate, inline,
    raises: [], tags: [].}
Initializer.
proc Icon(data: pointer; length: int; size = wDefaultSize): wIcon {...}{.inline, raises: [],
    tags: [].}
Creates an icon from binary data of .ico or .cur file.
proc init(self: wIcon; str: string; size = wDefaultSize) {...}{.validate, inline, raises: [],
    tags: [].}
Initializer.
proc Icon(str: string; size = wDefaultSize): wIcon {...}{.inline, raises: [], tags: [].}

Creates 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 init(self: wIcon; hIcon: HICON; copy = true; shared = false) {...}{.validate, raises: [],
    tags: [].}
Initializer.
proc Icon(hIcon: HICON; copy = true; shared = false): wIcon {...}{.inline, raises: [], tags: [].}
Creates an icon from Windows icon handle. If copy is false, this only wrap it to wIcon object. It means the handle will be destroyed by wIcon when it is destroyed. So if you wrap a shared icon handle into wIcon, you must set shared = true to avoid the handle being destroyed.
proc init(self: wIcon; icon: wIcon) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Icon(icon: wIcon): wIcon {...}{.inline, raises: [], tags: [].}
Creates an icon from a wIcon object, aka. copy constructors.
proc init(self: wIcon; cursor: wCursor) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Icon(cursor: wCursor): wIcon {...}{.inline, raises: [], tags: [].}
Creates an icon from a wCursor object
proc init(self: wIcon; filename: string; index: int; size = wDefaultSize) {...}{.validate,
    inline, raises: [], tags: [].}
Initializer.
proc Icon(filename: string; index: int; size = wDefaultSize): wIcon {...}{.inline, raises: [],
    tags: [].}

Creates 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.

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.