Types
Checkbox {.bycopy.} = object e*: Element check*: uint8 label*: cstring invoke*: proc (cp: pointer) {.cdecl.}
Code {.bycopy.} = object e*: Element vScroll*: ptr ScrollBar lines*: ptr UncheckedArray[CodeLine] font*: ptr Font lineCount*: cint focused*: cint moveScrollToFocusNextLayout*: bool content*: cstring contentBytes*: csize_t tabSize*: cint
CodeDecorateLine {.bycopy.} = object bounds*: Rectangle index*: cint ## Starting at 1! x*: cint y*: cint ## Position where additional text can be drawn. painter*: ptr Painter
CodeLine {.bycopy.} = object offset*: cint bytes*: cint
ColorPicker {.bycopy.} = object e*: Element hue*: cfloat saturation*: cfloat value*: cfloat opacity*: cfloat
Element {.bycopy.} = object flags*: uint32 ## First 16 bits are element specific. id*: uint32 parent*: ptr Element next*: ptr Element children*: ptr UncheckedArray[Element] window*: ptr Window bounds*: Rectangle clip*: Rectangle cp*: pointer ## Context pointer (for user). messageClass*: proc (element: ptr Element; message: Message; di: cint; dp: pointer): cint {.cdecl.} messageUser*: proc (element: ptr Element; message: Message; di: cint; dp: pointer): cint {.cdecl.} cClassName*: cstring
ExpandPane {.bycopy.} = object e*: Element button*: ptr Button panel*: ptr Panel expanded*: bool
FindByPoint {.bycopy.} = object x*: cint y*: cint result*: ptr Element
Font {.bycopy.} = object glyphWidth*: cint glyphHeight*: cint when defined(lFreetype): isFreeType*: bool font*: FT_Face glyphs*: array[128, FT_Bitmap] glyphsRendered*: array[128, bool] glyphOffsetsX*: array[128, cint] glyphOffsetsY*: array[128, cint]
ImageDisplay {.bycopy.} = object e*: Element bits*: ptr UncheckedArray[uint32] width*: cint height*: cint panX*: cfloat panY*: cfloat zoom*: cfloat previousWidth*: cint previousHeight*: cint previousPanPointX*: cint previousPanPointY*: cint
KeyTyped {.bycopy.} = object text*: cstring textBytes*: cint code*: cint
MDIChild {.bycopy.} = object e*: Element bounds*: Rectangle title*: cstring dragHitTest*: cint dragOffset*: Rectangle previous*: ptr MDIChild
Message = enum msgPaint, ## dp = pointer to UIPainter msgLayout, msgDestroy, msgUpdate, ## di = UI_UPDATE_... constant msgAnimate, msgScrolled, msgGetWidth, ## di = height (if known); return width msgGetHeight, ## di = width (if known); return height msgFindByPoint, ## dp = pointer to UIFindByPoint; return 1 if handled msgClientParent, ## dp = pointer to UIElement *, set it to the parent for client elements msgInputEventsStart, ## not sent to disabled elements msgLeftDown, msgLeftUp, msgMiddleDown, msgMiddleUp, msgRightDown, msgRightUp, msgKeyTyped, ## dp = pointer to UIKeyTyped; return 1 if handled msgMouseMove, msgMouseDrag, msgMouseWheel, ## di = delta; return 1 if handled msgClicked, msgGetCursor, ## return cursor code msgPressedDescendent, ## dp = pointer to child that is/contains pressed element msgInputEventsEnd, msgValueChanged, ## sent to notify that the element's value has changed msgTableGetItem, ## dp = pointer to UITableGetItem; return string length msgCodeGetMarginColor, ## di = line index (starts at 1); return color msgCodeDecorateLine, ## dp = pointer to UICodeDecorateLine msgWindowClose, ## return 1 to prevent default (process exit for UIWindow; close for UIMDIChild) msgTabSelected, ## sent to the tab that was selected (not the tab pane itself) msgWindowDropFiles, ## di = count, dp = char ** of paths msgWindowActivate, msgUser
Painter {.bycopy.} = object clip*: Rectangle bits*: ptr UncheckedArray[uint32] width*: cint height*: cint when defined(lDebug): fillCount*: cint
Rectangle {.bycopy.} = object l*: cint r*: cint t*: cint b*: cint
ScrollBar {.bycopy.} = object e*: Element maximum*: int64 page*: int64 dragOffset*: int64 position*: cdouble lastAnimateTime*: uint64 inDrag*: bool horizontal*: bool
Shortcut {.bycopy.} = object code*: cint ctrl*: bool shift*: bool alt*: bool invoke*: proc (cp: pointer) {.cdecl.} cp*: pointer
StringSelection {.bycopy.} = object carets*: array[2, cint] colorText*: uint32 colorBackground*: uint32
Table {.bycopy.} = object e*: Element vScroll*: ptr ScrollBar itemCount*: cint columns*: cstring columnWidths*: ptr cint columnCount*: cint columnHighlight*: cint
TableGetItem {.bycopy.} = object buffer*: cstring bufferBytes*: csize_t index*: cint column*: cint isSelected*: bool
Theme {.bycopy.} = object panel1*: uint32 panel2*: uint32 selected*: uint32 border*: uint32 text*: uint32 textDisabled*: uint32 textSelected*: uint32 buttonNormal*: uint32 buttonHovered*: uint32 buttonPressed*: uint32 buttonDisabled*: uint32 textboxNormal*: uint32 textboxFocused*: uint32 codeFocused*: uint32 codeBackground*: uint32 codeDefault*: uint32 codeComment*: uint32 codeString*: uint32 codeNumber*: uint32 codeOperator*: uint32 codePreprocessor*: uint32
UI {.bycopy.} = object windows*: ptr UncheckedArray[Window] animating*: ptr Element theme*: Theme parentStack*: array[16, ptr Element] parentStackCount*: cint quit*: bool dialogResult*: cstring dialogOldFocus*: ptr Element activeFont*: ptr Font when defined(lDebug): inspector*: ptr Window inspectorTable*: ptr Table inspectorTarget*: ptr Window inspectorLog*: ptr Code when defined(lFreetype): ft*: FT_Library
Window {.bycopy.} = object e*: Element dialog*: ptr Element shortcuts*: ptr UncheckedArray[Shortcut] shortcutCount*: csize_t shortcutAllocated*: csize_t scale*: cfloat bits*: ptr UncheckedArray[uint32] width*: cint height*: cint next*: ptr Window hovered*: ptr Element pressed*: ptr Element focused*: ptr Element dialogOldFocus*: ptr Element pressedButton*: cint cursorX*: cint cursorY*: cint cursorStyle*: cint textboxModifiedFlag*: bool ## \ ## Set when a textbox is modified. ## Useful for tracking whether changes to the loaded document have been saved. ctrl*: bool shift*: bool alt*: bool updateRegion*: Rectangle when defined(lDebug): lastFullFillCount*: cfloat when defined(linux): ctrlCode*: cuint shiftCode*: cuint altCode*: cuint when defined(windows): hwnd*: pointer trackingLeave*: bool
Consts
ALIGN_CENTER = 3
ALIGN_LEFT = 1
ALIGN_RIGHT = 2
BUTTON_CAN_FOCUS = 4
BUTTON_CHECKED = 32768
BUTTON_DROP_DOWN = 8
BUTTON_MENU_ITEM = 2
BUTTON_SMALL = 1
castInt = -1
CHECK_CHECKED = 1
CHECK_UNCHECKED = 0
CODE_NO_MARGIN = 1
CURSOR_ARROW = 0
CURSOR_COUNT = 15
CURSOR_HAND = 6
CURSOR_RESIZE_DOWN = 11
CURSOR_RESIZE_RIGHT = 12
CURSOR_RESIZE_UP = 7
CURSOR_SPLIT_H = 3
CURSOR_SPLIT_V = 2
CURSOR_TEXT = 1
ELEMENT_DESTROY_C = 1073741824
ELEMENT_DESTROY_DESCENDENT = 2147483648
ELEMENT_DISABLED = 4194304
- Don't receive input events.
ELEMENT_H_FILL = 131072
ELEMENT_HIDE = 536870912
ELEMENT_NON_CLIENT = 2097152
- Don't destroy in UIElementDestroyDescendents, like scroll bars.
ELEMENT_PARENT_PUSH = 524288
ELEMENT_TAB_STOP = 1048576
ELEMENT_V_FILL = 65536
ELEMENT_WINDOW = 262144
KEYCODE_0 = 48
KEYCODE_A = 97
KEYCODE_BACKSPACE = 65288
KEYCODE_DELETE = 65535
KEYCODE_DOWN = 65364
KEYCODE_END = 65367
KEYCODE_ENTER = 65293
KEYCODE_ESCAPE = 65307
KEYCODE_F1 = 65470
KEYCODE_HOME = 65360
KEYCODE_INSERT = 65379
KEYCODE_LEFT = 65361
KEYCODE_RIGHT = 65363
KEYCODE_SPACE = 32
KEYCODE_TAB = 65289
KEYCODE_UP = 65362
MENU_NO_SCROLL = 2
MENU_PLACE_ABOVE = 1
PANEL_BORDER = 256
PANEL_EXPAND = 16
PANEL_GRAY = 4
PANEL_HORIZONTAL = 1
PANEL_MEDIUM_SPACING = 32
PANEL_SCROLL = 128
PANEL_SMALL_SPACING = 64
PANEL_WHITE = 8
SIZE_BUTTON_HEIGHT = 27
SIZE_BUTTON_PADDING = 16
SIZE_CHECKBOX_BOX = 14
SIZE_GAUGE_HEIGHT = 22
SIZE_GAUGE_WIDTH = 200
SIZE_MDI_CASCADE = 30
SIZE_MDI_CHILD_TITLE = 30
SIZE_SCROLL_BAR = 16
SIZE_SLIDER_HEIGHT = 25
SIZE_SLIDER_THUMB = 15
SIZE_SLIDER_WIDTH = 200
SIZE_SPLITTER = 8
SIZE_TABLE_HEADER = 26
SIZE_TABLE_ROW = 20
SIZE_TEXTBOX_HEIGHT = 27
SIZE_TEXTBOX_WIDTH = 200
SPACER_LINE = 1
UPDATE_FOCUSED = 3
UPDATE_HOVERED = 1
UPDATE_PRESSED = 2
WINDOW_INSPECTOR = 2
WINDOW_MAXIMIZE = 8
WINDOW_MENU = 1
Procs
proc animateClock(): uint64 {.cdecl, importc: "UIAnimateClock", ...raises: [], tags: [], forbids: [].}
- In ms.
proc checkboxCreate(parent: ptr Element; flags: uint32 = 0; label: cstring; labelBytes: pointer = castInt): ptr Checkbox {.cdecl, importc: "UICheckboxCreate", ...raises: [], tags: [], forbids: [].}
proc codeCreate(parent: ptr Element; flags: uint32 = 0): ptr Code {.cdecl, importc: "UICodeCreate", ...raises: [], tags: [], forbids: [].}
proc codeFocusLine(code: ptr Code; index: cint) {.cdecl, importc: "UICodeFocusLine", ...raises: [], tags: [], forbids: [].}
- Line numbers are 1-indexed!!
proc codeHitTest(code: ptr Code; x: cint; y: cint): cint {.cdecl, importc: "UICodeHitTest", ...raises: [], tags: [], forbids: [].}
- Returns line number; negates if in margin. Returns 0 if not on a line.
proc codeInsertContent(code: ptr Code; content: cstring; byteCount: pointer = castInt; replace: bool) {.cdecl, importc: "UICodeInsertContent", ...raises: [], tags: [], forbids: [].}
proc colorPickerCreate(parent: ptr Element; flags: uint32 = 0): ptr ColorPicker {. cdecl, importc: "UIColorPickerCreate", ...raises: [], tags: [], forbids: [].}
proc colorToHSV(rgb: uint32; hue: ptr cfloat; saturation: ptr cfloat; value: ptr cfloat): bool {.cdecl, importc: "UIColorToHSV", discardable, ...raises: [], tags: [], forbids: [].}
proc colorToRGB(hue: cfloat; saturation: cfloat; value: cfloat; rgb: ptr uint32) {. cdecl, importc: "UIColorToRGB", ...raises: [], tags: [], forbids: [].}
proc dialogShow(window: ptr Window; flags: uint32 = 0; format: cstring): cstring {. varargs, cdecl, importc: "UIDialogShow", ...raises: [], tags: [], forbids: [].}
proc drawBorder(painter: ptr Painter; r: Rectangle; borderColor: uint32; borderSize: Rectangle) {.cdecl, importc: "UIDrawBorder", ...raises: [], tags: [], forbids: [].}
proc drawInvert(painter: ptr Painter; rectangle: Rectangle) {.cdecl, importc: "UIDrawInvert", ...raises: [], tags: [], forbids: [].}
proc drawRectangle(painter: ptr Painter; r: Rectangle; mainColor: uint32; borderColor: uint32; borderSize: Rectangle) {.cdecl, importc: "UIDrawRectangle", ...raises: [], tags: [], forbids: [].}
proc drawString(painter: ptr Painter; r: Rectangle; string: cstring; bytes: pointer = castInt; color: uint32; align: cint; selection: ptr StringSelection) {.cdecl, importc: "UIDrawString", ...raises: [], tags: [], forbids: [].}
proc drawStringHighlighted(painter: ptr Painter; r: Rectangle; string: cstring; bytes: pointer = castInt; tabSize: cint): cint {. cdecl, importc: "UIDrawStringHighlighted", ...raises: [], tags: [], forbids: [].}
proc drawTriangle(painter: ptr Painter; x0: cint; y0: cint; x1: cint; y1: cint; x2: cint; y2: cint; color: uint32) {.cdecl, importc: "UIDrawTriangle", ...raises: [], tags: [], forbids: [].}
proc drawTriangleOutline(painter: ptr Painter; x0: cint; y0: cint; x1: cint; y1: cint; x2: cint; y2: cint; color: uint32) {.cdecl, importc: "UIDrawTriangleOutline", ...raises: [], tags: [], forbids: [].}
proc elementAnimate(element: ptr Element; stop: bool): bool {.cdecl, importc: "UIElementAnimate", ...raises: [], tags: [], forbids: [].}
proc elementChangeParent(element: ptr Element; newParent: ptr Element; insertBefore: ptr Element) {.cdecl, importc: "UIElementChangeParent", ...raises: [], tags: [], forbids: [].}
- Set insertBefore to null to insert at the end.
proc elementCreate(bytes: csize_t; parent: ptr Element; flags: uint32 = 0; messageClass: proc (a1: ptr Element; a2: Message; a3: cint; a4: pointer): cint {. cdecl.}; cClassName: cstring): ptr Element {.cdecl, importc: "UIElementCreate", ...raises: [], tags: [], forbids: [].}
proc elementDestroy(element: ptr Element) {.cdecl, importc: "UIElementDestroy", ...raises: [], tags: [], forbids: [].}
proc elementDestroyDescendents(element: ptr Element) {.cdecl, importc: "UIElementDestroyDescendents", ...raises: [], tags: [], forbids: [].}
proc elementFindByPoint(element: ptr Element; x: cint; y: cint): ptr Element {. cdecl, importc: "UIElementFindByPoint", ...raises: [], tags: [], forbids: [].}
proc elementFocus(element: ptr Element) {.cdecl, importc: "UIElementFocus", ...raises: [], tags: [], forbids: [].}
proc elementMessage(element: ptr Element; message: Message; di: cint; dp: pointer): cint {.cdecl, importc: "UIElementMessage", ...raises: [], tags: [], forbids: [].}
proc elementMove(element: ptr Element; bounds: Rectangle; alwaysLayout: bool) {. cdecl, importc: "UIElementMove", ...raises: [], tags: [], forbids: [].}
proc elementRefresh(element: ptr Element) {.cdecl, importc: "UIElementRefresh", ...raises: [], tags: [], forbids: [].}
proc elementRepaint(element: ptr Element; region: ptr Rectangle = nil) {.cdecl, importc: "UIElementRepaint", ...raises: [], tags: [], forbids: [].}
proc elementScreenBounds(element: ptr Element): Rectangle {.cdecl, importc: "UIElementScreenBounds", ...raises: [], tags: [], forbids: [].}
- Returns bounds of element in same coordinate system as used by UIWindowCreate.
proc expandPaneCreate(parent: ptr Element; flags: uint32 = 0; label: cstring; labelBytes: pointer = castInt; panelFlags: uint32 = 0): ptr ExpandPane {. cdecl, importc: "UIExpandPaneCreate", ...raises: [], tags: [], forbids: [].}
proc fontActivate(font: ptr Font): ptr Font {.cdecl, importc: "UIFontActivate", discardable, ...raises: [], tags: [], forbids: [].}
- Returns the previously active font.
proc fontCreate(cPath: cstring; size: uint32): ptr Font {.cdecl, importc: "UIFontCreate", ...raises: [], tags: [], forbids: [].}
proc gaugeCreate(parent: ptr Element; flags: uint32 = 0): ptr Gauge {.cdecl, importc: "UIGaugeCreate", ...raises: [], tags: [], forbids: [].}
proc imageDisplayCreate(parent: ptr Element; flags: uint32 = 0; bits: ptr uint32; width: csize_t; height: csize_t; stride: csize_t): ptr ImageDisplay {.cdecl, importc: "UIImageDisplayCreate", ...raises: [], tags: [], forbids: [].}
proc imageDisplaySetContent(display: ptr ImageDisplay; bits: ptr uint32; width: csize_t; height: csize_t; stride: csize_t) {. cdecl, importc: "UIImageDisplaySetContent", ...raises: [], tags: [], forbids: [].}
proc initialise() {.cdecl, importc: "UIInitialise", ...raises: [], tags: [], forbids: [].}
proc labelCreate(parent: ptr Element; flags: uint32 = 0; label: cstring; labelBytes: pointer = castInt): ptr Label {.cdecl, importc: "UILabelCreate", ...raises: [], tags: [], forbids: [].}
proc labelSetContent(code: ptr Label; content: cstring; byteCount: pointer = castInt) {.cdecl, importc: "UILabelSetContent", ...raises: [], tags: [], forbids: [].}
proc mdiChildCreate(parent: ptr Element; flags: uint32 = 0; initialBounds: Rectangle; title: cstring; titleBytes: pointer = castInt): ptr MDIChild {.cdecl, importc: "UIMDIChildCreate", ...raises: [], tags: [], forbids: [].}
proc mdiClientCreate(parent: ptr Element; flags: uint32 = 0): ptr MDIClient {. cdecl, importc: "UIMDIClientCreate", ...raises: [], tags: [], forbids: [].}
proc measureStringHeight(): cint {.cdecl, importc: "UIMeasureStringHeight", ...raises: [], tags: [], forbids: [].}
proc measureStringWidth(string: cstring; bytes: pointer = castInt): cint {. cdecl, importc: "UIMeasureStringWidth", ...raises: [], tags: [], forbids: [].}
proc messageLoop(): cint {.cdecl, importc: "UIMessageLoop", ...raises: [], tags: [], forbids: [].}
proc panelCreate(parent: ptr Element; flags: uint32 = 0): ptr Panel {.cdecl, importc: "UIPanelCreate", ...raises: [], tags: [], forbids: [].}
proc parentPush(element: ptr Element): ptr Element {.cdecl, importc: "UIParentPush", ...raises: [], tags: [], forbids: [].}
proc rectangleAdd(a: Rectangle; b: Rectangle): Rectangle {.cdecl, importc: "UIRectangleAdd", ...raises: [], tags: [], forbids: [].}
proc rectangleBounding(a: Rectangle; b: Rectangle): Rectangle {.cdecl, importc: "UIRectangleBounding", ...raises: [], tags: [], forbids: [].}
proc rectangleContains(a: Rectangle; x: cint; y: cint): bool {.cdecl, importc: "UIRectangleContains", ...raises: [], tags: [], forbids: [].}
proc rectangleEquals(a: Rectangle; b: Rectangle): bool {.cdecl, importc: "UIRectangleEquals", ...raises: [], tags: [], forbids: [].}
proc rectangleIntersection(a: Rectangle; b: Rectangle): Rectangle {.cdecl, importc: "UIRectangleIntersection", ...raises: [], tags: [], forbids: [].}
proc rectangleTranslate(a: Rectangle; b: Rectangle): Rectangle {.cdecl, importc: "UIRectangleTranslate", ...raises: [], tags: [], forbids: [].}
proc scrollBarCreate(parent: ptr Element; flags: uint32 = 0): ptr ScrollBar {. cdecl, importc: "UIScrollBarCreate", ...raises: [], tags: [], forbids: [].}
proc sliderCreate(parent: ptr Element; flags: uint32 = 0): ptr Slider {.cdecl, importc: "UISliderCreate", ...raises: [], tags: [], forbids: [].}
proc spacerCreate(parent: ptr Element; flags: uint32 = 0; width: cint; height: cint): ptr Spacer {.cdecl, importc: "UISpacerCreate", ...raises: [], tags: [], forbids: [].}
proc splitPaneCreate(parent: ptr Element; flags: uint32 = 0; weight: cfloat): ptr SplitPane {. cdecl, importc: "UISplitPaneCreate", ...raises: [], tags: [], forbids: [].}
proc stringCopy(in: cstring; inBytes: pointer = castInt): cstring {.cdecl, importc: "UIStringCopy", ...raises: [], tags: [], forbids: [].}
proc tableCreate(parent: ptr Element; flags: uint32 = 0; columns: cstring): ptr Table {. cdecl, importc: "UITableCreate", ...raises: [], tags: [], forbids: [].}
proc tableEnsureVisible(table: ptr Table; index: cint): bool {.cdecl, importc: "UITableEnsureVisible", ...raises: [], tags: [], forbids: [].}
- Returns false if the item was already visible.
proc tableHeaderHitTest(table: ptr Table; x: cint; y: cint): cint {.cdecl, importc: "UITableHeaderHitTest", ...raises: [], tags: [], forbids: [].}
- Returns column index or -1.
proc tableHitTest(table: ptr Table; x: cint; y: cint): cint {.cdecl, importc: "UITableHitTest", ...raises: [], tags: [], forbids: [].}
- Returns item index. Returns -1 if not on an item.
proc tableResizeColumns(table: ptr Table) {.cdecl, importc: "UITableResizeColumns", ...raises: [], tags: [], forbids: [].}
proc tabPaneCreate(parent: ptr Element; flags: uint32 = 0; tabs: cstring): ptr TabPane {. cdecl, importc: "UITabPaneCreate", ...raises: [], tags: [], forbids: [].}
- separate with t, terminate with 0
proc textboxClear(textbox: ptr Textbox; sendChangedMessage: bool) {.cdecl, importc: "UITextboxClear", ...raises: [], tags: [], forbids: [].}
proc textboxCreate(parent: ptr Element; flags: uint32 = 0): ptr Textbox {.cdecl, importc: "UITextboxCreate", ...raises: [], tags: [], forbids: [].}
proc textboxMoveCaret(textbox: ptr Textbox; backward: bool; word: bool) {.cdecl, importc: "UITextboxMoveCaret", ...raises: [], tags: [], forbids: [].}
proc textboxReplace(textbox: ptr Textbox; text: cstring; bytes: pointer = castInt; sendChangedMessage: bool) {.cdecl, importc: "UITextboxReplace", ...raises: [], tags: [], forbids: [].}
proc windowCreate(owner: ptr Window; flags: uint32 = 0; cTitle: cstring; width: cint = 0; height: cint = 0): ptr Window {.cdecl, importc: "UIWindowCreate", ...raises: [], tags: [], forbids: [].}
proc windowPack(window: ptr Window; width: cint) {.cdecl, importc: "UIWindowPack", ...raises: [], tags: [], forbids: [].}
- Change the size of the window to best match its contents.
proc windowPostMessage(window: ptr Window; message: Message; dp: pointer) {. cdecl, importc: "UIWindowPostMessage", ...raises: [], tags: [], forbids: [].}
- Thread-safe.
proc windowRegisterShortcut(window: ptr Window; shortcut: Shortcut) {.cdecl, importc: "UIWindowRegisterShortcut", ...raises: [], tags: [], forbids: [].}
proc wrapPanelCreate(parent: ptr Element; flags: uint32 = 0): ptr WrapPanel {. cdecl, importc: "UIWrapPanelCreate", ...raises: [], tags: [], forbids: [].}
Templates
template KEYCODE_DIGIT(x: untyped): cint
template KEYCODE_FKEY(x: untyped): cint
template KEYCODE_LETTER(x: untyped): cint
template RECT_BOTTOM_LEFT(r: Rectangle): tuple[l, b: int]
template RECT_BOTTOM_RIGHT(r: Rectangle): tuple[r, b: int]
template RECT_HEIGHT(r: Rectangle): cint
template RECT_TOP_LEFT(r: Rectangle): tuple[l, t: int]
template RECT_TOTAL_H(r: Rectangle): cint
template RECT_TOTAL_V(r: Rectangle): cint
template RECT_VALID(r: Rectangle): bool
template RECT_WIDTH(r: Rectangle): cint