wWindow

    Dark Mode

wWindow is the base for all windows and represents any visible object on screen.

Superclass:wResizable
Subclasses:wFrame wPanel wControl wDialog
Seealso:wEvent
Styles:
StylesDescription
wBorderSimpleDisplays a thin border around the window.
wBorderSunkenDisplays a sunken border.
wBorderRaisedDisplays a raised border.
wBorderStaticDisplays a border suitable for a static control.
wBorderDoubleDisplays a double border.
wTransparentWindowThe window is transparent.
wDoubleBufferedThe window is double-buffered.
wVScrollUse this style to enable a vertical scrollbar.
wHScrollUse this style to enable a horizontal scrollbar.
wClipChildrenUse this style to eliminate flicker caused by the background being repainted, then children being painted over them.
wClipSiblingsUse this style to cuts the sibling window.
wHideTaskbarUse this style to hide the taskbar item (top-level window only).
wInvisibleThe window is initially invisible (child window is visible by default).
wPopupThe window is a pop-up window (WS_POPUP).
wPopupWindowThe window is a pop-up window (WS_POPUPWINDOW).
Events:

Types

wWindowError = object of wError
  
An error raised when wWindow creation failed.

Consts

wBorderSimple = 0x00800000
wBorderSunken = 2199023255552'i64
wBorderRaised = 1099511627776'i64
wBorderStatic = 562949953421312'i64
wBorderDouble = 4294967296'i64
wTransparentWindow = 137438953472'i64
wDoubleBuffered = 144115188075855872'i64
wVScroll = 0x00200000
wHScroll = 0x00100000
wClipChildren = 0x02000000
wClipSiblings = 0x04000000
wHideTaskbar = 1152921504606846976'i64
wInvisible = 2305843009213693952'i64
wPopup = 2147483648
wPopupWindow = 2156396544
wShowHide = 0
wShowNormal = 1
wShowMinimized = 2
wShowMaximized = 3
wShowMaximize = 3
wShowNoActivate = 4
wShow = 5
wShowMinimize = 6
wShowMinNoactive = 7
wShowShowNa = 8
wShowRestore = 9
wShowDefault = 10
wShowForceMinimize = 11
wModShift = 0x00000004
wModCtrl = 0x00000002
wModAlt = 0x00000001
wModWin = 0x00000008
wModNoRepeat = 0x00004000
wPopMenuRecurse = 0x00000001
wPopMenuTopAlign = 0x00000000
wPopMenuBottomAlign = 0x00000020
wPopMenuCenterAlign = 0x00000010
wPopMenuReturnId = 0x00000100

Procs

proc getMargin(self: wWindow): wDirection {...}{.inline, raises: [], tags: [].}
Gets the margin setting of the window. Margin is the extra space around the client area..
proc setMarginX(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the x-axis margin..
proc setMarginY(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the y-axis margin.
proc setMargin(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the window margins to the same value.
proc setMargin(self: wWindow; margin: wDirection) {...}{.inline, raises: [], tags: [].}
Sets the window margins.
proc setMarginLeft(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the left margin
proc setMarginUp(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the up margin
proc setMarginRight(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the right margin
proc setMarginDown(self: wWindow; margin: int) {...}{.inline, raises: [], tags: [].}
Sets the down margin
proc close(self: wWindow) {...}{.inline, raises: [], tags: [].}
This function simply generates a wEvent_Close whose handler usually tries to close the window.
proc delete(self: wWindow) {...}{.inline, raises: [], tags: [].}
Destroys the window.
proc destroy(self: wWindow) {...}{.inline, raises: [], tags: [].}
Destroys the window. The same as delete().
proc move(self: wWindow; x: int; y: int) {...}{.raises: [Exception], tags: [RootEffect].}
Moves the window to the given position. Using wDefault to indicate not to change.
proc move(self: wWindow; pos: wPoint) {...}{.inline, raises: [Exception], tags: [RootEffect].}
Moves the window to the given position. Using wDefault to indicate not to change.
proc setPosition(self: wWindow; pos: wPoint) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Moves the window to the specified position. The same as move(). Using wDefault to indicate not to change.
proc setPosition(self: wWindow; x: int; y: int) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Moves the window to the specified position. The same as move(). Using wDefault to indicate not to change.
proc lift(self: wWindow) {...}{.inline, raises: [], tags: [].}
Raises the window to the top of the Z-order.
proc lower(self: wWindow) {...}{.inline, raises: [], tags: [].}
Lowers the window to the bottom of the Z-order.
proc cover(self: wWindow; win: wWindow) {...}{.inline, raises: [wNilAccess], tags: [].}
Adjusts the Z-order to cover the specified window.
proc setSize(self: wWindow; width: int; height: int) {...}{.raises: [], tags: [].}
Sets the size of the window in pixels. Using wDefault to indicate not to change.
proc setSize(self: wWindow; x: int; y: int; width: int; height: int) {...}{.raises: [Exception],
    tags: [RootEffect].}
Sets the size of the window in pixels. Using wDefault to indicate not to change.
proc setSize(self: wWindow; size: wSize) {...}{.inline, raises: [], tags: [].}
Sets the size of the window in pixels. Using wDefault to indicate not to change.
proc setSize(self: wWindow; point: wPoint; size: wSize) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Sets the size of the window in pixels. Using wDefault to indicate not to change.
proc setSize(self: wWindow; rect: wRect) {...}{.inline, raises: [Exception],
                                      tags: [RootEffect].}
Sets the size of the window in pixels. Using wDefault to indicate not to change.
proc getSize(self: wWindow): wSize {...}{.inline, raises: [], tags: [].}
Returns the size of the entire window in pixels.
proc getRect(self: wWindow): wRect {...}{.raises: [Exception], tags: [RootEffect].}
Returns the position and size of the window as a wRect object.
proc getPosition(self: wWindow): wPoint {...}{.raises: [Exception], tags: [RootEffect].}
Gets the position of the window in pixels.
proc getClientMargins(self: wWindow): tuple[left, top, right, bottom: int] {...}{.
    raises: [Exception], tags: [RootEffect].}
Returns client margin of all the direction.
proc fit(self: wWindow) {...}{.inline, raises: [Exception], tags: [RootEffect].}
Sizes the window to fit its best size.
proc suit(self: wWindow) {...}{.inline, raises: [Exception], tags: [RootEffect].}
Sizes the window to suit its default size.
proc setClientSize(self: wWindow; size: wSize) {...}{.raises: [Exception],
    tags: [RootEffect].}
This sets the size of the window client area in pixels.
proc setClientSize(self: wWindow; width: int; height: int) {...}{.raises: [Exception],
    tags: [RootEffect].}
This sets the size of the window client area in pixels.
proc contain(self: wWindow; windows: varargs[wWindow, wWindow]) {...}{.
    raises: [wNilAccess, Exception], tags: [RootEffect].}
Sizes the window to contain all the specified windows. Basically used by staticbox control.
proc setMinSize(self: wWindow; size: wSize) {...}{.raises: [], tags: [].}
Sets the minimum size of the window.
proc setMinSize(self: wWindow; x: int; y: int) {...}{.inline, raises: [], tags: [].}
Sets the minimum size of the window.
proc getMinSize(self: wWindow): wSize {...}{.inline, raises: [], tags: [].}
Returns the minimum size of the window.
proc setMaxSize(self: wWindow; size: wSize) {...}{.raises: [], tags: [].}
Sets the maximum size of the window.
proc setMaxSize(self: wWindow; x: int; y: int) {...}{.inline, raises: [], tags: [].}
Sets the maximum size of the window.
proc getMaxSize(self: wWindow): wSize {...}{.inline, raises: [], tags: [].}
Returns the maximum size of the window.
proc setMinClientSize(self: wWindow; size: wSize) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Sets the minimum client size of the window.
proc setMinClientSize(self: wWindow; x: int; y: int) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Sets the minimum client size of the window.
proc setMaxClientSize(self: wWindow; size: wSize) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Sets the maximum client size of the window
proc setMaxClientSize(self: wWindow; x: int; y: int) {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Sets the maximum client size of the window
proc screenToClient(self: wWindow; pos: wPoint): wPoint {...}{.raises: [Exception],
    tags: [RootEffect].}
Converts from screen to client window coordinates.
proc clientToScreen(self: wWindow; pos: wPoint): wPoint {...}{.raises: [Exception],
    tags: [RootEffect].}
Converts to screen coordinates from coordinates relative to this window.
proc getDpi(self: wWindow): int {...}{.raises: [], tags: [RootEffect].}
Returns the dpi value for the window. This function use GetDpiForWindow() api (requires win 10) to get the current dpi if possible.
proc getDpiScaleRatio(self: wWindow): float {...}{.inline, raises: [], tags: [RootEffect].}
Returns the dpi scale ratio for the window.
proc dpiScale(self: wWindow; value: int): int {...}{.inline, raises: [], tags: [RootEffect].}
Returns the relative value according to current dpi setting.
proc dpiScale(self: wWindow; value: float): float {...}{.inline, raises: [],
    tags: [RootEffect].}
Returns the relative value according to current dpi setting.
proc getWindowStyle(self: wWindow): wStyle {...}{.raises: [], tags: [].}
Gets the wNim's window style. It simply combine of windows' style and exstyle.
proc setWindowStyle(self: wWindow; style: wStyle) {...}{.raises: [], tags: [].}
Sets the style of the window.
proc addWindowStyle(self: wWindow; style: wStyle) {...}{.inline, raises: [], tags: [].}
Add the specified style but don't change other styles.
proc clearWindowStyle(self: wWindow; style: wStyle) {...}{.inline, raises: [], tags: [].}
Clear the specified style but don't change other styles.
proc refresh(self: wWindow; eraseBackground = true) {...}{.inline, raises: [], tags: [].}
Redraws the contents of the window.
proc refresh(self: wWindow; eraseBackground = true; rect: wRect) {...}{.inline, raises: [],
    tags: [].}
Redraws the contents of the given rectangle: only the area inside it will be repainted.
proc show(self: wWindow; cmd: int) {...}{.inline, raises: [], tags: [].}
Shows the window using specified command.
proc hide(self: wWindow) {...}{.inline, raises: [], tags: [].}
Hides the window.
proc showCaret(self: wWindow; flag = true) {...}{.inline, raises: [], tags: [].}
Show or hide the caret. Hiding is cumulative. If your application hide caret five times, it must also show caret five times before the caret reappears.
proc isShownOnScreen(self: wWindow): bool {...}{.inline, raises: [], tags: [].}
Returns true if the window is physically visible on the screen. i.e. it is shown and all its parents up to the toplevel window are shown as well.
proc isShown(self: wWindow): bool {...}{.inline, gcsafe, raises: [], tags: [].}
Returns true if the window is shown, false if it has been hidden.
proc isMouseInWindow(self: wWindow): bool {...}{.raises: [], tags: [].}
Check whether the mouse pointer is inside the window.
proc setRedraw(self: wWindow; flag = true) {...}{.inline, raises: [], tags: [].}
Allows a window to be redrawn or prevents it from being redrawn.
proc enable(self: wWindow; flag = true) {...}{.inline, raises: [], tags: [].}
Enable or disable the window for user input.
proc disable(self: wWindow) {...}{.inline, raises: [], tags: [].}
Disables the window.
proc isEnabled(self: wWindow): bool {...}{.inline, raises: [], tags: [].}
Returns true if the window is enabled.
proc setFocus(self: wWindow) {...}{.raises: [], tags: [].}
This sets the window to receive keyboard input.
proc isFocusable(self: wWindow): bool {...}{.inline, raises: [], tags: [].}
Can this window itself have focus?
proc hasFocus(self: wWindow): bool {...}{.raises: [], tags: [].}
Returns true if the window or it's child window has the focus.
proc disableFocus(self: wWindow; flag = true) {...}{.raises: [Exception], tags: [RootEffect].}
Disable (or reenable) focus to a window.
proc captureMouse(self: wWindow) {...}{.inline, raises: [], tags: [].}
Directs all mouse input to this window.
proc releaseMouse(self: wWindow) {...}{.inline, raises: [], tags: [].}
Releases mouse input captured with CaptureMouse().
proc hasCapture(self: wWindow): bool {...}{.inline, raises: [], tags: [].}
Returns true if this window has the current mouse capture.
proc getHandle(self: wWindow): HANDLE {...}{.inline, raises: [], tags: [].}
Returns the system HWND of this window.
proc getParent(self: wWindow): wWindow {...}{.inline, raises: [], tags: [].}
Returns the parent of the window.
proc getForegroundColor(self: wWindow): wColor {...}{.inline, raises: [], tags: [].}
Returns the foreground color of the window.
proc getBackgroundColor(self: wWindow): wColor {...}{.inline, raises: [], tags: [].}
Returns the background color of the window.
proc getFont(self: wWindow): wFont {...}{.inline, raises: [], tags: [].}
Returns the font for this window.
proc getStatusBar(self: wWindow): wStatusBar {...}{.inline, raises: [], tags: [].}
Returns the status bar currently associated with the window.
proc getToolBar(self: wWindow; index = 0): wToolBar {...}{.inline, raises: [], tags: [].}
Returns the toolbar of specified index currently associated with the window.
proc getToolBars(self: wWindow): seq[wToolBar] {...}{.inline, raises: [], tags: [].}
Returns the toolbars currently associated with the window.
proc getId(self: wWindow): wCommandID {...}{.inline, raises: [], tags: [].}
Returns the identifier of the window.
proc getTitle(self: wWindow): string {...}{.raises: [], tags: [].}
Returns the title of the window.
proc getLabel(self: wWindow): string {...}{.inline, raises: [], tags: [].}
Returns the label of the window. The same as getTitle().
proc getChildren(self: wWindow): seq[wWindow] {...}{.inline, raises: [], tags: [].}
Returns a seq of the window's children.
proc getTopParent(self: wWindow): wWindow {...}{.raises: [], tags: [].}
Returns the first top level parent of the given window.
proc getNextSibling(self: wWindow): wWindow {...}{.raises: [], tags: [].}
Returns the next window after this one among the parent's children.
proc getPrevSibling(self: wWindow): wWindow {...}{.raises: [], tags: [].}
Returns the previous window before this one among the parent's children.
proc isDescendant(self: wWindow; win: wWindow): bool {...}{.raises: [wNilAccess], tags: [].}
Check if the specified window is a descendant of this one.
proc isTopLevel(self: wWindow): bool {...}{.raises: [], tags: [].}
Returns true if the given window is a top-level one.
proc setParent(self: wWindow; parent: wWindow): bool {...}{.discardable,
    raises: [wNilAccess], tags: [].}
Set the window's parent, i.e. the window will be removed from its current parent window and then re-inserted into another. Warning: this is a dangerous action and some control may work incorrectly after changing the parent.
proc reparent(self: wWindow; parent: wWindow): bool {...}{.inline, discardable,
    raises: [wNilAccess], tags: [].}
Reparents the window. The same as setParent().
proc setId(self: wWindow; id: wCommandID) {...}{.inline, raises: [], tags: [].}
Sets the identifier of the window.
proc setTitle(self: wWindow; title: string) {...}{.inline, raises: [], tags: [].}
Sets the window's title.
proc setLabel(self: wWindow; label: string) {...}{.inline, raises: [], tags: [].}
Sets the window's label. The same as setTitle().
proc getData(self: wWindow): int {...}{.inline, raises: [], tags: [].}
Returns the data associated with the window.
proc setData(self: wWindow; data: int) {...}{.raises: [], tags: [].}
Sets the window associated data.
proc setTransparent(self: wWindow; alpha: range[0 .. 255]) {...}{.raises: [], tags: [].}
Set the window to be translucent. A value of 0 sets the window to be fully transparent.
proc getTransparent(self: wWindow): int {...}{.raises: [], tags: [].}
Get the alpha value of a transparent window. Return -1 if failed.
proc setAcceleratorTable(self: wWindow; accel: wAcceleratorTable) {...}{.inline,
    raises: [wNilAccess], tags: [RootEffect].}
Sets the accelerator table for this window.
proc getAcceleratorTable(self: wWindow): wAcceleratorTable {...}{.inline, raises: [],
    tags: [].}
Gets the accelerator table for this window.
proc setCursor(self: wWindow; cursor: wCursor) {...}{.inline, raises: [wNilAccess],
    tags: [RootEffect].}
Sets the window's cursor. The cursor may be wNilCursor, in which case the window cursor will be reset. Notice that the window cursor also sets it for the children of the window implicitly. Set children's cursor to wDefaultCursor can restore the children's default cursor. For example, if you change a frame's cursor, the textctrl in the frame will uses the cursor too. To avoid it, you can set textctrl's cursor to wDefaultCursor.
proc getCursor(self: wWindow): wCursor {...}{.inline, raises: [], tags: [].}
Return the cursor associated with this window.
proc setScrollbar(self: wWindow; orientation: int; position: Natural;
                 pageSize: Positive; range: Positive) {...}{.raises: [], tags: [].}
Sets the scrollbar properties of a built-in scrollbar . Orientation should be wHorizontal or wVertical
proc showScrollBar(self: wWindow; orientation: int; flag = true) {...}{.inline, raises: [],
    tags: [].}
Shows the built-in scrollbar.
proc enableScrollBar(self: wWindow; orientation: int; flag = true) {...}{.inline, raises: [],
    tags: [].}
Enable or disable the built-in scrollbar.
proc setScrollPos(self: wWindow; orientation: int; position: int) {...}{.raises: [], tags: [].}
Sets the position of the scrollbar.
proc getScrollRange(self: wWindow; orientation: int): int {...}{.inline, raises: [], tags: [].}
Returns the built-in scrollbar range.
proc getPageSize(self: wWindow; orientation: int): int {...}{.inline, raises: [], tags: [].}
Returns the built-in scrollbar page size.
proc getScrollPos(self: wWindow; orientation: int): int {...}{.inline, raises: [], tags: [].}
Returns the built-in scrollbar position.
proc hasScrollbar(self: wWindow; orientation: int): bool {...}{.raises: [], tags: [].}
Returns true if this window currently has a scroll bar for this orientation.
proc scrollLines(self: wWindow; lines: int = 1) {...}{.raises: [], tags: [].}
Scrolls the window by the given number of lines down (if lines is positive) or up.
proc scrollPages(self: wWindow; pages: int = 1) {...}{.raises: [], tags: [].}
Scrolls the window by the given number of pages down (if pages is positive) or up.
proc center(self: wWindow; direction = wBoth) {...}{.raises: [Exception], tags: [RootEffect].}
Centers the window. direction is a bitwise combination of wHorizontal and wVertical.
proc activate(self: wWindow) {...}{.raises: [], tags: [].}
Activates the window.
proc popupMenu(self: wWindow; menu: wMenu; pos: wPoint = wDefaultPoint; flag = 0): wCommandID {...}{.
    discardable, raises: [wNilAccess, Exception], tags: [RootEffect].}
Pops up the given menu at the specified coordinates. flag is a bitlist of the following:
FlagDescription
wPopMenuRecurseDisplay a menu when another menu is already displayed.
wPopMenuTopAlignTop side of menu is aligned with the coordinate specified by the y parameter.
wPopMenuBottomAlignBottom side of menu is aligned with the coordinate specified by the y parameter.
wPopMenuCenterAlignCenters the menu vertically relative to the coordinate specified by the y parameter.
wPopMenuReturnIdNot generates wEvent_Menu event but returns the wCommandID or 0 if an error occurs.
proc popupMenu(self: wWindow; menu: wMenu; x: int; y: int; flag = 0): wCommandID {...}{.inline,
    discardable, raises: [wNilAccess, Exception], tags: [RootEffect].}
Pops up the given menu at the specified coordinates.
proc startTimer(self: wWindow; seconds: float; id = 1) {...}{.inline, raises: [], tags: [].}
Start a timer. It generates wEvent_Timer event to the window. In the event handler, use event.timerId to get the timer id.
proc stopTimer(self: wWindow; id = 1) {...}{.inline, raises: [], tags: [].}
Stop the timer.
proc registerHotKey(self: wWindow; id: int; modifiers: int; keyCode: int): bool {...}{.inline,
    discardable, raises: [], tags: [RootEffect].}
Registers a system wide hotkey. Every time the user presses the hotkey registered here, this window will receive a wEvent_HotKey event. Modifiers is a bitwise combination of wModShift, wModCtrl, wModAlt, wModWin, and wModNoRepeat (Windows 7 later).
proc registerHotKey(self: wWindow; id: int;
                   hotkey: tuple[modifiers: int, keyCode: int]): bool {...}{.inline,
    discardable, raises: [], tags: [RootEffect].}
Registers a system wide hotkey.
proc unregisterHotKey(self: wWindow; id: int): bool {...}{.inline, discardable, raises: [],
    tags: [].}
Unregisters a system wide hotkey.
proc setDoubleBuffered(self: wWindow; on = true) {...}{.raises: [], tags: [].}
Turn on or off double buffering of the window.
proc getDoubleBuffered(self: wWindow): bool {...}{.raises: [], tags: [].}
Returns true if the window contents is double-buffered by the system
proc processEvent(self: wWindow; event: wEvent): bool {...}{.discardable, raises: [],
    tags: [RootEffect].}
Processes an event: searching event tables and calling event handler. Returned true if a suitable event handler function was executed and it did not call wEvent.skip().
proc queueEvent(self: wWindow; event: wEvent) {...}{.inline, raises: [wNilAccess], tags: [].}
Queue event for a later processing.
proc queueMessage(self: wWindow; msg: UINT; wParam: wWparam = 0; lParam: wLparam = 0) {...}{.
    inline, raises: [], tags: [].}
Queue message for a later processing.
proc sendMessage(self: wWindow; msg: UINT; wParam: wWparam = 0; lParam: wLparam = 0) {...}{.
    inline, raises: [], tags: [].}
Send specified message to a window.
proc processMessage(self: wWindow; msg: UINT; wParam: wWparam = 0; lParam: wLparam = 0): bool {...}{.
    inline, discardable, raises: [Exception], tags: [RootEffect].}
Create an event object of specified message and then call processEvent() to process it. Returned true if a suitable event handler function was executed and it did not call wEvent.skip().
proc connect(self: wWindow; msg: UINT; handler: wEventProc; userData: int = 0): wEventConnection {...}{.
    discardable, raises: [], tags: [RootEffect].}
Connects the given event type with the event handler defined as "proc (event: wEvent)".
proc connect(self: wWindow; msg: UINT; handler: wEventNeatProc; userData: int = 0): wEventConnection {...}{.
    discardable, raises: [], tags: [RootEffect].}
Connects the given event type with the event handler defined as "proc ()".
proc connect(self: wWindow; msg: UINT; id: wCommandID; handler: wEventProc;
            userData: int = 0): wEventConnection {...}{.discardable, raises: [],
    tags: [RootEffect].}
Connects the given event type and specified ID with the event handler defined as "proc (event: wEvent)".
proc connect(self: wWindow; msg: UINT; id: wCommandID; handler: wEventNeatProc;
            userData: int = 0): wEventConnection {...}{.discardable, raises: [],
    tags: [RootEffect].}
Connects the given event type and specified ID with the event handler defined as "proc ()".
proc connect(self: wWindow; id: wCommandID; handler: wEventProc; userData: int = 0): wEventConnection {...}{.
    discardable, raises: [], tags: [RootEffect].}
Connects the specified ID with the event handler defined as "proc (event: wEvent)".
proc connect(self: wWindow; id: wCommandID; handler: wEventNeatProc; userData: int = 0): wEventConnection {...}{.
    discardable, raises: [], tags: [RootEffect].}
Connects the specified ID with the event handler defined as "proc ()".
proc disconnect(self: wWindow; msg: UINT; limit = -1) {...}{.raises: [], tags: [RootEffect].}
Disconnects the given event type from the event handler.
proc disconnect(self: wWindow; msg: UINT; id: wCommandID; limit = -1) {...}{.raises: [],
    tags: [RootEffect].}
Disconnects the given event type and specified ID from the event handler.
proc disconnect(self: wWindow; id: wCommandID; limit = -1) {...}{.raises: [],
    tags: [RootEffect].}
Disconnects the specified ID from the event handler.
proc disconnect(self: wWindow; msg: UINT; handler: wEventProc) {...}{.raises: [Exception],
    tags: [RootEffect].}
Disconnects the specified handler proc from the event handler.
proc disconnect(self: wWindow; msg: UINT; handler: wEventNeatProc) {...}{.
    raises: [Exception], tags: [RootEffect].}
Disconnects the specified handler proc from the event handler.
proc disconnect(self: wWindow; connection: wEventConnection) {...}{.raises: [],
    tags: [RootEffect].}
Disconnects the specified token that returned by connect().
proc `.`(self: wWindow; msg: UINT; handler: wEventProc): wEventConnection {...}{.inline,
    discardable, raises: [], tags: [RootEffect].}
Symbol alias for connect.
proc `.`(self: wWindow; msg: UINT; handler: wEventNeatProc): wEventConnection {...}{.inline,
    discardable, raises: [], tags: [RootEffect].}
Symbol alias for connect.
proc `.`(self: wWindow; id: wCommandID; handler: wEventProc): wEventConnection {...}{.inline,
    discardable, raises: [], tags: [RootEffect].}
Symbol alias for connect.
proc `.`(self: wWindow; id: wCommandID; handler: wEventNeatProc): wEventConnection {...}{.
    inline, discardable, raises: [], tags: [RootEffect].}
Symbol alias for connect.
proc setDraggable(self: wWindow; flag = true; inClient = true) {...}{.
    raises: [Exception, wCursorError], tags: [RootEffect].}
Allow a window to be moved by dragging. If the window is a top-level window, this means to allow dragging by it's client area. In this case, inClient is ignored, and no wEvent_Dragging event will be triggered. Otherwise, When a child window is dragging by user, it receive wEvent_Dragging event. If inClient is true, the window is limited to move inside client area of it's parent.
proc setSizingBorder(self: wWindow; direction: wDirection) {...}{.
    raises: [Exception, wCursorError], tags: [RootEffect].}
Allow a child window to be changed size using the mouse. When a window is sizing by user, it receive wEvent_Sizing event.
proc setDropTarget(self: wWindow; flag = true) {...}{.raises: [], tags: [].}
Register the window as a drop target, or revoke it. The window will recieve wDragDropEvent during a drag-and-drop operation.
proc getToolTip(self: wWindow): string {...}{.raises: [], tags: [].}
Get the text of the associated tooltip or empty string if none.
proc setToolTip(self: wWindow; tip: string) {...}{.raises: [], tags: [RootEffect].}
Attach a tooltip to the window.
proc unsetToolTip(self: wWindow) {...}{.inline, raises: [], tags: [RootEffect].}
Unset any existing tooltip.
proc setToolTip(self: wWindow; maxWidth = wDefault; autoPop = wDefault; delay = wDefault;
               reshow = wDefault) {...}{.raises: [], tags: [].}
Sets the parameters of the associated tooltip. -1 to restore the default.
proc setShape(self: wWindow; region: wRegion) {...}{.raises: [], tags: [].}
Set the shape of the window to the given region. Nil to clear it.
proc init(self: wWindow; hWnd: HWND) {...}{.raises: [wWindowError, wCursorError, IndexDefect,
    wFontError, Exception], tags: [RootEffect].}
Initializes a wWindow by subclassing the hWnd.
proc Window(hWnd: HWND): wWindow {...}{.inline, discardable, raises: [wWindowError,
    wCursorError, IndexDefect, wFontError, Exception], tags: [RootEffect].}
Constructor.
proc init(self: wWindow; parent: wWindow = nil; id: wCommandID = 0; pos = wDefaultPoint;
         size = wDefaultSize; style: wStyle = 0; className = "wWindow") {...}{.inline, raises: [
    wWindowError, wCursorError, wBrushError, Exception, IndexDefect, wFontError,
    wNilAccess], tags: [RootEffect].}
Initializes a window.
proc Window(parent: wWindow = nil; id: wCommandID = 0; pos = wDefaultPoint;
           size = wDefaultSize; style: wStyle = 0; className = "wWindow"): wWindow {...}{.
    inline, discardable, raises: [wWindowError, wCursorError, wBrushError, Exception,
                               IndexDefect, wFontError, wNilAccess],
    tags: [RootEffect].}
Constructor.

Methods

method getClientSize(self: wWindow): wSize {...}{.raises: [Exception], tags: [RootEffect].}
Returns the size of the window 'client area' in pixels.
method getClientAreaOrigin(self: wWindow): wPoint {...}{.base, raises: [Exception],
    tags: [RootEffect].}
Gets the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...).
method release(self: wWindow) {...}{.base, inline, raises: [], tags: [].}
Release all the resources during destroying. Used internally.
method getClientMargin(self: wWindow; direction: int): int {...}{.raises: [Exception],
    tags: [RootEffect].}
Returns the client margin of the specified direction. This function basically exists for wNim's layout DSL.
method getDefaultSize(self: wWindow): wSize {...}{.inline, raises: [Exception],
    tags: [RootEffect].}
Returns the system suggested size of a window (usually used for GUI controls).
method getBestSize(self: wWindow): wSize {...}{.raises: [Exception], tags: [RootEffect].}
Returns the best acceptable minimal size for the window (usually used for GUI controls).
method show(self: wWindow; flag = true) {...}{.base, inline, raises: [], tags: [].}
Shows or hides the window.
method setForegroundColor(self: wWindow; color: wColor) {...}{.base, inline, raises: [],
    tags: [].}
Sets the foreground color of the window.
method setBackgroundColor(self: wWindow; color: wColor) {...}{.base, raises: [wBrushError],
    tags: [RootEffect].}
Sets the background color of the window, -1 means transparent.
method setFont(self: wWindow; font: wFont) {...}{.base, raises: [wNilAccess], tags: [].}
Sets the font for this window.

Iterators

iterator children(self: wWindow): wWindow {...}{.raises: [], tags: [].}
Iterates over each window's child.
iterator siblings(self: wWindow): wWindow {...}{.raises: [], tags: [].}
Iterates over each window's sibling.

Macros

macro dpiAutoScale(self: wWindow; body: untyped): untyped
A macro to convert all int literal and float literal by dpiScale(). For example:
frame.dpiAutoScale:
  frame.minSize = (300, 200)
  frame.size = (350, 200)