renderable BaseWidget
The base widget of all widgets. Supports redrawing the entire Application
by calling <WidgetName>State.app.redraw()
sensitive: bool = true
If the widget is interactivesizeRequest: tuple[x, y: int] = (-1, -1)
Requested widget size. A value of -1 means that the natural size of the widget will be used.tooltip: string = ""
The widget's tooltip is shown on hover
margin: int
margin: Margin
style: StyleClass
style: varargs[StyleClass]
style: HashSet[StyleClass]
renderable BaseWindow of BaseWidget
- All fields from BaseWidget
defaultSize: tuple[width, height: int] = (800, 600)
Initial size of the windowfullscreened: bool
iconName: string
resizable: bool = true
- close:
proc ()
Called when the window is closed
renderable Window of BaseWindow
- All fields from BaseWindow
title: string
titlebar: Widget
Custom widget set as the titlebar of the windowchild: Widget
-
All adders from BaseWindow
-
add
Adds a child to the window. Each window may only have one child. -
addTitlebar
Sets a custom titlebar for the window
Window:
Label(text = "Hello, world")
renderable Box of BaseWidget
A Box arranges its child widgets along one dimension.
- All fields from BaseWidget
orient: Orient
Orientation of the Box and its containing elements. May be one of OrientX (to orient horizontally) or OrientY (to orient vertically)spacing: int
Spacing between the children of the Boxchildren: seq[BoxChild[Widget]]
-
All adders from BaseWidget
-
add
Adds a child to the Box. When expand is true, the child grows to fill up the remaining space in the Box. ThehAlign
andvAlign
properties allow you to set the horizontal and vertical alignment of the child within its allocated area. They may be one ofAlignFill
,AlignStart
,AlignEnd
orAlignCenter
.expand = true
hAlign = AlignFill
vAlign = AlignFill
Box:
orient = OrientX
Label(text = "Label")
Button(text = "Button") {.expand: false.}
Box:
orient = OrientY
margin = 12
spacing = 6
for it in 0 ..< 5:
Label(text = "Label " & $it)
HeaderBar {.addTitlebar.}:
Box {.addLeft.}:
style = [BoxLinked]
for it in 0 ..< 5:
Button {.expand: false.}:
text = "Button " & $it
proc clicked() =
echo it
renderable CenterBox of BaseWidget
- All fields from BaseWidget
startWidget: Widget
centerWidget: Widget
endWidget: Widget
baselinePosition: BaselinePosition = BaselineCenter
shrinkCenterLast: bool = false
Since:GtkMinor >= 12
orient: Orient = OrientX
- All adders from BaseWidget
addStart
addEnd
add
renderable Overlay of BaseWidget
- All fields from BaseWidget
child: Widget
overlays: seq[AlignedChild[Widget]]
- All adders from BaseWidget
add
addOverlay
hAlign = AlignFill
vAlign = AlignFill
renderable EmojiChooser of BaseWidget
- All fields from BaseWidget
- emojiPicked:
proc (emoji: string)
renderable Label of BaseWidget
The default widget to display text.
Supports rendering Pango Markup
if useMarkup
is enabled.
- All fields from BaseWidget
text: string
Text displayed by the labelxAlign: float = 0.5
Horizontal alignment of the text within the widgetyAlign: float = 0.5
Vertical alignment of the text within the widgetellipsize: EllipsizeMode
Determines whether to ellipsise the text in case space is insufficient to render all of it. May be one ofEllipsizeNone
,EllipsizeStart
,EllipsizeMiddle
orEllipsizeEnd
wrap: bool = false
Enables/Disable wrapping of textuseMarkup: bool = false
Determines whether to interpret the given text as Pango Markup
Label:
text = "Hello, world!"
xAlign = 0.0
ellipsize = EllipsizeEnd
Label:
text = "Test ".repeat(50)
wrap = true
Label:
text = "<b>Bold</b>, <i>Italic</i>, <span font=\"20\">Font Size</span>"
useMarkup = true
renderable EditableLabel of BaseWidget
- All fields from BaseWidget
text: string = ""
editing: bool = false
Determines whether the edit view (editing = false) or the "read" view (editing = true) is being shownenableUndo: bool = true
alignment: float = 0.0
- changed:
proc (text: string)
Fired every timetext
changes. - editStateChanged:
proc (newEditState: bool)
Fired every timeediting
changes.
renderable Icon of BaseWidget
- All fields from BaseWidget
name: string
See recommended_tools.md for a list of icons.pixelSize: int = -1
Determines the size of the icon
Icon:
name = "list-add-symbolic"
Icon:
name = "object-select-symbolic"
pixelSize = 100
renderable Picture of BaseWidget
- All fields from BaseWidget
pixbuf: Pixbuf
contentFit: ContentFit = ContentContain
Requires GTK 4.8 or higher to fully work, compile with-d:gtkminor=8
to enable
renderable Button of BaseWidget
- All fields from BaseWidget
child: Widget
shortcut: string
Keyboard shortcut
text: string
icon: string
Sets the icon of the Button (see recommended_tools.md for a list of icons)
- clicked:
proc ()
- All adders from BaseWidget
add
Button:
icon = "list-add-symbolic"
style = [ButtonSuggested]
proc clicked() =
echo "clicked"
Button:
text = "Delete"
style = [ButtonDestructive]
Button:
text = "Inactive Button"
sensitive = false
Button:
text = "Copy"
shortcut = "<Ctrl>C"
proc clicked() =
app.writeClipboard("Hello, world!")
renderable HeaderBar of BaseWidget
- All fields from BaseWidget
title: BoxChild[Widget]
showTitleButtons: bool = true
decorationLayout: Option[string] = none(string)
left: seq[Widget]
right: seq[Widget]
windowControls: DecorationLayout
windowControls: Option[DecorationLayout]
-
All adders from BaseWidget
-
addTitle
Adds a custom title widget to the HeaderBar. When expand is true, it grows to fill up the remaining space in the headerbar. ThehAlign
andvAlign
properties allow you to set the horizontal and vertical alignment of the child within its allocated area. They may be one ofAlignFill
,AlignStart
,AlignEnd
orAlignCenter
.expand = false
hAlign = AlignFill
vAlign = AlignFill
-
addLeft
Adds a widget to the left side of the HeaderBar. -
addRight
Adds a widget to the right side of the HeaderBar.
Window:
title = "Title"
HeaderBar {.addTitlebar.}:
Button {.addLeft.}:
icon = "list-add-symbolic"
Button {.addRight.}:
icon = "open-menu-symbolic"
renderable ScrolledWindow of BaseWidget
- All fields from BaseWidget
child: Widget
propagateNaturalWidth: bool = false
propagateNaturalHeight: bool = false
- edgeOvershot:
proc (edge: Edge)
Called when the user attempts to scroll past limits of the scrollbar - edgeReached:
proc (edge: Edge)
Called when the user reaches the limits of the scrollbar
- All adders from BaseWidget
add
renderable Entry of BaseWidget
- All fields from BaseWidget
text: string
placeholder: string
Shown when the Entry is empty.width: int = -1
maxWidth: int = -1
xAlign: float = 0.0
visibility: bool = true
invisibleChar: Rune = '*'.Rune
- changed:
proc (text: string)
Called when the text in the Entry changed - activate:
proc ()
Called when the user presses enter/return
Entry:
text = app.text
proc changed(text: string) =
app.text = text
Entry:
text = app.query
placeholder = "Search..."
proc changed(query: string) =
app.query = query
proc activate() =
## Runs when enter is pressed
echo app.query
Entry:
placeholder = "Password"
visibility = false
invisibleChar = '*'.Rune
renderable Spinner of BaseWidget
- All fields from BaseWidget
spinning: bool
renderable SpinButton of BaseWidget
Entry for entering numeric values
- All fields from BaseWidget
digits: uint = 1
Number of digitsclimbRate: float = 0.1
wrap: bool
When the maximum (minimum) value is reached, the SpinButton will wrap around to the minimum (maximum) value.min: float = 0.0
Lower boundmax: float = 100.0
Upper boundstepIncrement: float = 0.1
pageIncrement: float = 1
pageSize: float = 0
value: float
- valueChanged:
proc (value: float)
SpinButton:
value = app.value
proc valueChanged(value: float) =
app.value = value
renderable Paned of BaseWidget
- All fields from BaseWidget
orient: Orient
Orientation of the panesinitialPosition: int
Initial position of the separator in pixelsfirst: PanedChild[Widget]
second: PanedChild[Widget]
- All adders from BaseWidget
add
resize = true
shrink = false
Paned:
initialPosition = 200
Box(orient = OrientY) {.resize: false.}:
Label(text = "Sidebar")
Box(orient = OrientY) {.resize: true.}:
Label(text = "Content")
renderable CustomWidget of BaseWidget
- All fields from BaseWidget
focusable: bool
- mousePressed:
proc (event: ButtonEvent): bool
- mouseReleased:
proc (event: ButtonEvent): bool
- mouseMoved:
proc (event: MotionEvent): bool
- scroll:
proc (event: ScrollEvent): bool
- keyPressed:
proc (event: KeyEvent): bool
- keyReleased:
proc (event: KeyEvent): bool
renderable DrawingArea of CustomWidget
Allows you to render 2d scenes using cairo.
The owlkettle/cairo
module provides bindings for cairo.
- All fields from CustomWidget
- draw:
proc (ctx: CairoContext; size: (int, int)): bool
Called when the widget is rendered. Redraws the application if the callback returns true.
DrawingArea:
## You need to import the owlkettle/cairo module in order to use CairoContext
proc draw(ctx: CairoContext; size: tuple[width, height: int]): bool =
ctx.rectangle(100, 100, 300, 200)
ctx.source = (0.0, 0.0, 0.0)
ctx.stroke()
renderable GlArea of CustomWidget
Allows you to render 3d scenes using OpenGL.
- All fields from CustomWidget
useEs: bool = false
requiredVersion: tuple[major, minor: int] = (4, 3)
hasDepthBuffer: bool = true
hasStencilBuffer: bool = false
- setup:
proc (size: (int, int)): bool
Called after the OpenGL Context is initialized. Redraws the application if the callback returns true. - render:
proc (size: (int, int)): bool
Called when the widget is rendered. Your rendering code should be executed here. Redraws the application if the callback returns true.
renderable ColorButton of BaseWidget
- All fields from BaseWidget
color: tuple[r, g, b, a: float] = (0.0, 0.0, 0.0, 1.0)
Red, Geen, Blue, Alpha as floating point numbers in the range [0.0, 1.0]useAlpha: bool = false
- changed:
proc (color: tuple[r, g, b, a: float])
renderable Switch of BaseWidget
- All fields from BaseWidget
state: bool
- changed:
proc (state: bool)
Switch:
state = app.state
proc changed(state: bool) =
app.state = state
renderable ToggleButton of Button
- All fields from Button
state: bool
- changed:
proc (state: bool)
ToggleButton:
text = "Current State: " & $app.state
state = app.state
proc changed(state: bool) =
app.state = state
renderable LinkButton of Button
A clickable link.
- All fields from Button
uri: string
visited: bool
renderable CheckButton of BaseWidget
- All fields from BaseWidget
state: bool
- changed:
proc (state: bool)
CheckButton:
state = app.state
proc changed(state: bool) =
app.state = state
renderable RadioGroup of BaseWidget
A list of options selectable using radio buttons.
- All fields from BaseWidget
spacing: int = 3
Spacing between the rowsrowSpacing: int = 6
Spacing between the radio button andorient: Orient = OrientY
Orientation of the listchildren: seq[Widget]
selected: int
Currently selected index, may be smaller or larger than the number of children to represent no option being selected
- select:
proc (index: int)
- All adders from BaseWidget
add
RadioGroup:
selected = app.selected
proc select(index: int) =
app.selected = index
Label(text = "Option 0", xAlign = 0)
Label(text = "Option 1", xAlign = 0)
Label(text = "Option 2", xAlign = 0)
renderable BasePopover of BaseWidget
- All fields from BaseWidget
hasArrow: bool = true
offset: tuple[x, y: int] = (0, 0)
position: PopoverPosition = PopoverBottom
renderable Popover of BasePopover
- All fields from BasePopover
child: Widget
- All adders from BasePopover
add
renderable PopoverMenu of BasePopover
A popover with multiple pages. It is usually used to create a menu with nested submenus.
- All fields from BasePopover
pages: Table[string, Widget]
-
All adders from BasePopover
-
add
Adds a page to the popover menu.name = "main"
renderable MenuButton of BaseWidget
- All fields from BaseWidget
child: Widget
popover: Widget
text: string
icon: string
Sets the icon of the MenuButton. Typicallyopen-menu
is used. See recommended_tools.md for a list of icons.
- All adders from BaseWidget
addChild
add
MenuButton {.addRight.}:
icon = "open-menu"
PopoverMenu:
Box:
Label(text = "My Menu")
renderable ModelButton of BaseWidget
- All fields from BaseWidget
text: string
icon: string
The icon of the ModelButton (see recommended_tools.md for a list of icons)shortcut: string
menuName: string
- clicked:
proc ()
PopoverMenu:
Box:
orient = OrientY
for it in 0 ..< 10:
ModelButton:
text = "Menu Entry " & $it
proc clicked() =
echo "Clicked " & $it
renderable SearchEntry of BaseWidget
- All fields from BaseWidget
text: string
searchDelay: uint = 100
Determines the minimum time after asearchChanged
event occurred before the next can be emitted. Since:GtkMinor >= 8
placeholderText: string = "Search"
Since:GtkMinor >= 10
- activate:
proc ()
Triggered when the user "activated" the search e.g. by hitting "enter" key while SearchEntry is in focus. - nextMatch:
proc ()
Triggered when the user hits the "next entry" keybinding while the search entry is in focus, which is Ctrl-g by default. - previousMatch:
proc ()
Triggered when the user hits the "previous entry" keybinding while the search entry is in focus, which is Ctrl-Shift-g by default. - changed:
proc (searchString: string)
Triggered when the user types in the SearchEntry. - stopSearch:
proc ()
Triggered when the user "stops" a search, e.g. by hitting the "Esc" key while SearchEntry is in focus.
renderable Separator of BaseWidget
A separator line.
- All fields from BaseWidget
orient: Orient
renderable TextView of BaseWidget
A text editor with support for formatted text.
- All fields from BaseWidget
buffer: TextBuffer
The buffer containing the displayed text.monospace: bool = false
cursorVisible: bool = true
editable: bool = true
acceptsTab: bool = true
indent: int = 0
wrapMode: WrapMode = WrapNone
textMargin: Margin
renderable ListBoxRow of BaseWidget
A row in a ListBox
.
- All fields from BaseWidget
child: Widget
- activate:
proc ()
- All adders from BaseWidget
add
ListBox:
for it in 0 ..< 10:
ListBoxRow {.addRow.}:
proc activate() =
echo it
Label(text = $it)
renderable ListBox of BaseWidget
- All fields from BaseWidget
rows: seq[Widget]
selectionMode: SelectionMode
selected: HashSet[int]
Indices of the currently selected rows
- select:
proc (rows: HashSet[int])
Called when the selection changed.rows
contains the indices of the newly selected rows.
-
All adders from BaseWidget
-
addRow
Adds a row to the list. The added child widget must be aListBoxRow
. -
add
ListBox:
for it in 0 ..< 10:
Label(text = $it)
renderable FlowBoxChild of BaseWidget
- All fields from BaseWidget
child: Widget
- All adders from BaseWidget
add
FlowBox:
columns = 1 .. 5
for it in 0 ..< 10:
FlowBoxChild {.addChild.}:
Label(text = $it)
renderable FlowBox of BaseWidget
- All fields from BaseWidget
homogeneous: bool
rowSpacing: int
columnSpacing: int
columns: HSlice[int, int] = 1 .. 5
selectionMode: SelectionMode
children: seq[Widget]
- All adders from BaseWidget
addChild
add
FlowBox:
columns = 1 .. 5
for it in 0 ..< 10:
Label(text = $it)
renderable Frame of BaseWidget
- All fields from BaseWidget
label: string
align: tuple[x, y: float] = (0.0, 0.0)
child: Widget
- All adders from BaseWidget
add
Frame:
label = "Frame Title"
align = (0.2, 0.0)
Label:
text = "Content"
renderable DropDown of BaseWidget
A drop down that allows the user to select an item from a list of items.
- All fields from BaseWidget
items: seq[string]
selected: int
Index of the currently selected itemenableSearch: bool
showArrow: bool = true
- select:
proc (item: int)
DropDown:
items = @["Option 1", "Option 2", "Option 3"]
selected = app.selectedItem
proc select(itemIndex: int) =
app.selectedItem = itemIndex
renderable Grid of BaseWidget
A grid layout.
- All fields from BaseWidget
children: seq[GridChild[Widget]]
rowSpacing: int
Spacing between the rows of the gridcolumnSpacing: int
Spacing between the columns of the gridrowHomogeneous: bool
Whether all rows should have the same widthcolumnHomogeneous: bool
Whether all columns should have the same height
spacing: int
Sets the spacing between the rows and columns of the grid.homogeneous: bool
-
All adders from BaseWidget
-
add
Adds a child at the given location to the grid. The location of the child within the grid can be set using thex
,y
,width
andheight
properties. ThehAlign
andvAlign
properties allow you to set the horizontal and vertical alignment of the child within its allocated area. They may be one ofAlignFill
,AlignStart
,AlignEnd
orAlignCenter
.x = 0
y = 0
width = 1
height = 1
hExpand = false
vExpand = false
hAlign = AlignFill
vAlign = AlignFill
Grid:
spacing = 6
margin = 12
Button {.x: 1, y: 1, hExpand: true, vExpand: true.}:
text = "A"
Button {.x: 2, y: 1.}:
text = "B"
Button {.x: 1, y: 2, width: 2, hAlign: AlignCenter.}:
text = "C"
renderable Fixed of BaseWidget
A layout where children are placed at fixed positions.
- All fields from BaseWidget
children: seq[FixedChild[Widget]]
-
All adders from BaseWidget
-
add
Adds a child at the given positionx = 0.0
y = 0.0
Fixed:
Label(text = "Fixed Layout") {.x: 200, y: 100.}
renderable ContextMenu
Adds a context menu to a widget. Context menus are shown when the user right clicks the widget.
child: Widget
menu: Widget
controller: GtkEventController = GtkEventController(nil)
add
addMenu
ContextMenu:
Label:
text = "Right click here"
PopoverMenu {.addMenu.}:
hasArrow = false
Box(orient = OrientY):
for it in 0 ..< 3:
ModelButton:
text = "Menu Entry " & $it
renderable LevelBar of BaseWidget
- All fields from BaseWidget
value: float = 0.0
min: float = 0.0
max: float = 1.0
inverted: bool = false
mode: LevelBarMode = LevelBarContinuous
orient: Orient = OrientX
LevelBar:
value = 0.2
min = 0
max = 1
LevelBar:
value = 2
max = 10
orient = OrientY
mode = LevelBarDiscrete
renderable Calendar of BaseWidget
Displays a calendar
- All fields from BaseWidget
date: DateTime
markedDays: seq[int] = @[]
showDayNames: bool = true
showHeading: bool = true
showWeekNumbers: bool = true
- daySelected:
proc (date: DateTime)
- nextMonth:
proc (date: DateTime)
- prevMonth:
proc (date: DateTime)
- nextYear:
proc (date: DateTime)
- prevYear:
proc (date: DateTime)
Calendar:
date = app.date
proc select(date: DateTime) =
## Shortcut for handling all calendar events (daySelected,
## nextMonth, prevMonth, nextYear, prevYear)
app.date = date
renderable DialogButton
A button which closes the currently open dialog and sends a response to the caller.
This widget can only be used with the addButton
adder of Dialog
or BuiltinDialog
.
text: string
response: DialogResponse
res: DialogResponseKind
style: varargs[StyleClass]
Applies CSS classes to the button. There are some pre-defined classes available:ButtonSuggested
,ButtonDestructive
,ButtonFlat
,ButtonPill
orButtonCircular
. You can also use custom CSS classes usingStyleClass("my-class")
. Consult the GTK4 documentation for guidance on what to use.style: HashSet[StyleClass]
Applies CSS classes to the button.style: StyleClass
Applies CSS classes to the button.
renderable Dialog of Window
A window which can contain DialogButton
widgets in its header bar.
- All fields from Window
buttons: seq[DialogButton]
- All adders from Window
addButton
Dialog:
title = "My Dialog"
defaultSize = (300, 200)
DialogButton {.addButton.}:
text = "Ok"
res = DialogAccept
DialogButton {.addButton.}:
text = "Cancel"
res = DialogCancel
Label(text = "Hello, world!")
renderable BuiltinDialog of BaseWidget
Base widget for builtin dialogs.
If you want to create a custom dialog, you should use Window
or Dialog
instead.
- All fields from BaseWidget
title: string
buttons: seq[DialogButton]
- All adders from BaseWidget
addButton
renderable FileChooserDialog of BuiltinDialog
A dialog for opening/saving files or folders.
- All fields from BuiltinDialog
action: FileChooserAction
selectMultiple: bool = false
initialPath: string
Path of the initially shown folderfilenames: seq[string]
The selected file paths
FileChooserDialog:
title = "Open a File"
action = FileChooserOpen
selectMultiple = true
DialogButton {.addButton.}:
text = "Cancel"
res = DialogCancel
DialogButton {.addButton.}:
text = "Open"
res = DialogAccept
style = [ButtonSuggested]
renderable ColorChooserDialog of BuiltinDialog
A dialog for choosing a color.
- All fields from BuiltinDialog
color: tuple[r, g, b, a: float] = (0.0, 0.0, 0.0, 1.0)
useAlpha: bool = false
ColorChooserDialog:
color = (1.0, 0.0, 0.0, 1.0)
useAlpha = true
renderable MessageDialog of BuiltinDialog
A dialog for showing a message to the user.
- All fields from BuiltinDialog
message: string
MessageDialog:
message = "Hello, world!"
DialogButton {.addButton.}:
text = "Ok"
res = DialogAccept
renderable AboutDialog of BaseWidget
- All fields from BaseWidget
programName: string
logo: string
copyright: string
version: string
license: string
credits: seq[(string, seq[string])]
AboutDialog:
programName = "My Application"
logo = "applications-graphics"
version = "1.0.0"
credits = @{"Code": @["Erika Mustermann", "Max Mustermann"],
"Art": @["Max Mustermann"]}
renderable Scale of BaseWidget
A slider for choosing a numeric value within a range.
- All fields from BaseWidget
min: float = 0
Lower end of the range displayed by the scalemax: float = 100
Upper end of the range displayed by the scalevalue: float = 0
The value the Scale widget displays. Remember to update it via yourvalueChanged
proc to reflect the new value on the Scale widget.marks: seq[ScaleMark] = @[]
Adds marks to the Scale at points whereScaleMark.value
would be placed. IfScaleMark.label
is provided, it will be rendered next to the mark.ScaleMark.position
determines the mark's position (and its label) relative to the scale. Note that ScaleLeft and ScaleRight are only sensible when the Scale is vertically oriented (orient
=OrientY
), while ScaleTop and ScaleBottom are only sensible when it is horizontally oriented (orient
=OrientX
)inverted: bool = false
Determines whether the min and max value of the Scale are ordered (low value) left => right (high value) in the case ofinverted = false
or (high value) left <= right (low value) in the case ofinverted = true
.showValue: bool = true
Determines whether to display the numeric value as a label on the widget (showValue = true
) or not (showValue = false
)stepSize: float = 5
Determines the value increment/decrement when the widget is in focus and the user presses arrow keys.pageSize: float = 10
Determines the value increment/decrement when the widget is in focus and the user presses page keys. Typically larger than stepSize.orient: Orient = OrientX
The orientation of the widget. Orients the widget either horizontally (orient = OrientX
) or vertically (orient = OrientY
)showFillLevel: bool = true
Determines whether to color the Scale from the "origin" to the place where the slider on the Scale sits. The Scale is filled left => right/top => bottom ifinverted = false
and left <= right/top <= bottom ifinverted = true
precision: int64 = 1
Number of decimal places to display for the value.precision = 1
enables values like 1.2, whileprecision = 2
enables values like 1.23 and so on.valuePosition: ScalePosition
Specifies where the label of the Scale widget's value should be placed. This setting has no effect ifshowValue = false
.
- valueChanged:
proc (newValue: float)
Emitted when the range value changes from an interaction triggered by the user.
Scale:
value = app.value
showFillLevel = false
min = 0
max = 1
marks = @[ScaleMark(some("Just a mark"), ScaleLeft, 0.5)]
inverted = true
showValue = false
proc valueChanged(newValue: float) =
echo "New value is ", newValue
app.value = newValue
renderable Video of BaseWidget
- All fields from BaseWidget
autoplay: bool = false
loop: bool = false
mediaStream: MediaStream
fileName: string
file: GFile
renderable MediaControls of BaseWidget
- All fields from BaseWidget
mediaStream: MediaStream
renderable Expander of BaseWidget
Container that shows or hides its child depending on whether it is expanded/collapsed.
- All fields from BaseWidget
label: string
The clickable header of the Expander. Overwritten bylabelWidget
if it is provided via adder.labelWidget: Widget
The clickable header of the Expander. Overwriteslabel
if provided.expanded: bool = false
Determines whether the body of the Expander is shownchild: Widget
Determines the body of the ExpanderresizeToplevel: bool = false
useMarkup: bool = false
useUnderline: bool = false
- activate:
proc (activated: bool)
Triggered whenever Expander is expanded or collapsed
- All adders from BaseWidget
add
addLabel
Expander:
label = "Expander"
Label:
text = "Content"
Expander:
label = "Expander"
expanded = app.expanded
proc activate(activated: bool) =
app.expanded = activated
Label:
text = "Content"
Expander:
Label {.addLabel.}:
text = "Widget Label"
Label:
text = "Content"
renderable PasswordEntry of BaseWidget
- All fields from BaseWidget
text: string
activatesDefault: bool = true
placeholderText: string = "Password"
showPeekIcon: bool = true
- activate:
proc ()
Triggered when the user "activated" the entry e.g. by hitting "enter" key while PasswordEntry is in focus. - changed:
proc (password: string)
Triggered when the user types in the PasswordEntry.
renderable ProgressBar of BaseWidget
A progress bar widget to show progress being made on a long-lasting task
- All fields from BaseWidget
ellipsize: EllipsizeMode = EllipsizeEnd
Determines how thetext
gets ellipsized ifshowText = true
andtext
overflows.fraction: float = 0.0
Determines how much the ProgressBar is filled. Must be between 0.0 and 1.0.inverted: bool = false
pulseStep: float = 0.1
showText: bool = false
text: string = ""
renderable ActionBar of BaseWidget
A Bar for actions to execute in a given context. Can be hidden with intro- and outro-animations.
- All fields from BaseWidget
centerWidget: Widget
packStart: seq[Widget]
Widgets shown on the start of the ActionBarpackEnd: seq[Widget]
Widgets shown on the end of the ActionBarrevealed: bool
- All adders from BaseWidget
add
addStart
addEnd
renderable ListView of BaseWidget
- All fields from BaseWidget
size: int
Number of itemsselectionMode: SelectionMode
selected: HashSet[int]
Indices of the currently selected items.showSeparators: bool = false
singleClickActivate: bool = false
enableRubberband: bool = false
- viewItem:
proc (index: int): Widget
- select:
proc (rows: HashSet[int])
- activate:
proc (index: int)
renderable ColumnView of BaseWidget
- All fields from BaseWidget
rows: int
Number of rowscolumns: seq[ColumnViewColumn]
selectionMode: SelectionMode
selected: HashSet[int]
Indices of the currently selected rowsshowRowSeparators: bool = false
showColumnSeparators: bool = false
singleClickActivate: bool = false
enableRubberband: bool = false
reorderable: bool = false
- viewItem:
proc (row, column: int): Widget
- select:
proc (rows: HashSet[int])
- activate:
proc (index: int)