Overlays
At a glance
Section titled “At a glance”MenuItem :: struct {...}TooltipSide :: enum {...}menu :: proc{menu_label, menu_icon}context_menu :: proc(items: []MenuItem) -> (index: int, ok: bool)dialog :: proc(name: string, title: string) -> booldrawer :: proc(name: string) -> boolmenu_icon :: proc(icon: Icon, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false) -> (index: int, ok: bool)menu_label :: proc(label: string, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false, icon := Icon{}) -> (index: int, ok: bool)toast :: proc(message: string, tone := Tone.Default)tooltip :: proc(label: string)tooltip_on :: proc(anchor: Id, label: string, side := TooltipSide.Top)MenuItem
Section titled “MenuItem”MenuItem :: struct { label: string, danger: bool, // drawn in the danger color (e.g. "Löschen") disabled: bool, separator: bool, icon: Icon, // optional, before the label}One entry of a menu. A separator entry draws a line and ignores the other fields.
| Field | Type | Notes |
|---|---|---|
label | string | |
danger | bool | drawn in the danger color (e.g. “Löschen”) |
disabled | bool | |
separator | bool | |
icon | Icon | optional, before the label |
Source: kiln/menu.odin:98
TooltipSide
Section titled “TooltipSide”TooltipSide :: enum { Top, Right,}Where a tooltip appears: above the anchor (below if there is no room) or to its right.
Values: .Top, .Right
Source: kiln/menu.odin:21
Procedure groups
Section titled “Procedure groups”menu :: proc{menu_label, menu_icon}A button that opens a list of entries below it. Returns the index of the clicked entry:
if i, ok := kiln.menu("Aktionen", ITEMS[:]); ok { ... }if i, ok := kiln.menu(kiln.ICON_MORE, ITEMS[:], .Ghost); ok { ... }An icon (or a single-character label) gives a square icon button.
Calls one of these, depending on the argument types:
menu_labelproc(label: string, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false, icon := Icon{}) -> (index: int, ok: bool)menu_iconproc(icon: Icon, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false) -> (index: int, ok: bool)
Source: kiln/menu.odin:112
Procedures
Section titled “Procedures”context_menu
Section titled “context_menu”context_menu :: proc(items: []MenuItem) -> (index: int, ok: bool)Opens a list of entries at the pointer when the last item is right-clicked. Returns the index of the clicked entry:
if kiln.list_item() { ... }if i, ok := kiln.context_menu(ITEMS[:]); ok { ... }| Argument | Type | Default |
|---|---|---|
items | []MenuItem | required |
| Returns | Type |
|---|---|
index | int |
ok | bool |
Source: kiln/menu.odin:183
dialog
Section titled “dialog”dialog :: proc(name: string, title: string) -> boolA modal dialog with a title and a close button over a dimmed backdrop. While shown it returns true; put the body into the block. On compact screens it becomes a sheet at the bottom.
if kiln.button("Löschen", .Danger) {kiln.show("confirm")}
if kiln.dialog("confirm", "Eintrag löschen?") { kiln.text("Das kann nicht rückgängig gemacht werden.") if kiln.actions() { if kiln.button("Abbrechen", .Ghost) {kiln.hide()} if kiln.button("Löschen", .Danger) {append(out, Delete{}); kiln.hide()} }}| Argument | Type | Default |
|---|---|---|
name | string | required |
title | string | required |
| Returns | Type |
|---|---|
| #0 | bool |
Source: kiln/dialog.odin:28
drawer
Section titled “drawer”drawer :: proc(name: string) -> boolA panel that slides in from the left edge over a dimmed backdrop, e.g. the navigation on compact screens. While shown it returns true; put the content into the block.
| Argument | Type | Default |
|---|---|---|
name | string | required |
| Returns | Type |
|---|---|
| #0 | bool |
Source: kiln/dialog.odin:97
menu_icon
Section titled “menu_icon”menu_icon :: proc( icon: Icon, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false,) -> (index: int, ok: bool)| Argument | Type | Default |
|---|---|---|
icon | Icon | required |
items | []MenuItem | required |
variant | ButtonVariant | ButtonVariant.Secondary |
disabled | bool | false |
| Returns | Type |
|---|---|
index | int |
ok | bool |
Source: kiln/menu.odin:130
menu_label
Section titled “menu_label”menu_label :: proc( label: string, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false, icon := Icon{},) -> (index: int, ok: bool)| Argument | Type | Default |
|---|---|---|
label | string | required |
items | []MenuItem | required |
variant | ButtonVariant | ButtonVariant.Secondary |
disabled | bool | false |
icon | Icon | Icon{} |
| Returns | Type |
|---|---|
index | int |
ok | bool |
Source: kiln/menu.odin:117
toast :: proc(message: string, tone := Tone.Default)Shows a short message for the theme’s toast_duration: bottom right, or at the top on compact
screens (where sheets and buttons live at the bottom).
Can be called from anywhere, also from update:
kiln.toast("Gespeichert", .Success)| Argument | Type | Default |
|---|---|---|
message | string | required |
tone | Tone | Tone.Default |
Source: kiln/dialog.odin:223
tooltip
Section titled “tooltip”tooltip :: proc(label: string)Shows label in a bubble next to the last item after the pointer rested on it for the
theme’s tooltip_delay:
kiln.button("Speichern")kiln.tooltip("Strg+S")| Argument | Type | Default |
|---|---|---|
label | string | required |
Source: kiln/menu.odin:31
tooltip_on
Section titled “tooltip_on”tooltip_on :: proc(anchor: Id, label: string, side := TooltipSide.Top)A tooltip for any element (parts of custom widgets, chart bars, …), not only the last item. Call it every frame after declaring the element.
| Argument | Type | Default |
|---|---|---|
anchor | Id | required |
label | string | required |
side | TooltipSide | TooltipSide.Top |
Source: kiln/menu.odin:37