Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ui.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

import ui/rawui

export rawui.Align

type
Widget* = ref object of RootRef ## abstract Widget base class.

Expand Down Expand Up @@ -44,6 +46,19 @@ template intCallback(name, supertyp, basetyp, on) {.dirty.} =
let widget = cast[basetyp](data)
if widget.on != nil: widget.on(widget.value)

# ------------------- Grid ------------------------
type
Grid* = ref object of Widget
impl*: ptr rawui.Grid

proc add*[SomeWidget: Widget](t: Grid; c: SomeWidget, left: cint, top: cint, xspan: cint, yspan: cint, hexpand: cint, halign: Align, vexpand: cint, valign: Align) =
gridAppend t.impl, c.impl, left, top, xspan, yspan, hexpand, halign, vexpand, valign

proc newGrid*(padded = false): Grid =
newFinal(result)
result.impl = rawui.newGrid()
result.impl.gridSetPadded(padded.cint)

# ------------------- Button --------------------------------------
type
Button* = ref object of Widget
Expand Down