pub enum WidgetKind {
Show 39 variants
Window,
Container,
ToolbarItem,
Sidebar,
Fragment,
Text,
Button,
ToggleButton,
MenuButton,
SplitButton,
TextInput,
PasswordInput,
SearchInput,
TextArea,
Checkbox,
Switch,
Select,
RadioGroup,
Slider,
NumberInput,
ColorWell,
Progress,
Spinner,
Separator,
Image,
Icon,
FileIcon,
GpuSurface,
ScrollView,
List,
Table,
Tree,
Tabs,
DocumentTabs,
Group,
Split,
Popover,
Custom(&'static str),
Native,
}Variants§
Window
Container
A layout host: a plain native view that we position children in.
ToolbarItem
A host for one item of its window’s toolbar, the bar across the top that shows the window’s title (the unified NSToolbar, GTK’s header bar, a CommandBar on WinUI, Kirigami’s page toolbar). A native child of the window, after its content. The core lays out what’s in it at its natural size; the platform places it, at the bar’s trailing end.
Sidebar
A window’s sidebar: the list down its leading side that picks what
the window shows (a source list in an NSSplitViewController, a
libadwaita navigation split view, NavigationView’s pane on WinUI, a
first column in Kirigami’s page row). A native child of the window,
after its content and toolbar items. Its items are data
(Prop::Sections), the chosen one Prop::SelectedIndex; the
platform draws, places and sizes it, and the window’s content is
what’s beside it.
Fragment
Core-only grouping used by control flow (Show, For). Never sent to
backends; its children are spliced into the nearest native ancestor.
Text
Button
ToggleButton
A native button that stays pressed until it’s clicked again (an
NSButton of the push-on-push-off type, gtk::ToggleButton,
ToggleButton, a checkable QQC2.Button). A Button’s caption, icon
and style, and a Checkbox’s Prop::Checked, reported as
Changed(Bool).
MenuButton
A native button that opens a menu of actions (a pull-down
NSPopUpButton, gtk::MenuButton, DropDownButton, a QQC2.Button that
opens a QQC2.Menu). Its caption, icon and style are a Button’s;
its menu is Prop::Menu, and the item chosen comes as
UiEvent::MenuItem.
SplitButton
A native button with a menu of other actions beside its own (an
NSComboButton of the split style, WinUI’s SplitButton,
adw::SplitButton; Kirigami has none, so a QQC2.Button with an arrow
QQC2.Button joined to it, as KDE apps pair them). Its caption, icon
and style are a Button’s, and it reports a click as one does; its
menu is Prop::Menu, whose item chosen comes as
UiEvent::MenuItem.
TextInput
PasswordInput
A native password field (NSSecureTextField, PasswordBox,
gtk::PasswordEntry, Kirigami.PasswordField): a TextInput whose
text is hidden, as each platform hides it.
SearchInput
A native search field (NSSearchField, gtk::SearchEntry, an
AutoSuggestBox with the find icon, Kirigami.SearchField): a
TextInput with the platform’s search icon and clear button, which
asks for a search (UiEvent::Search) as
the platform does.
TextArea
A native field for text over many lines (an NSTextView in an
NSScrollView, a TextBox that accepts Return, a gtk::TextView in a
gtk::ScrolledWindow, a QQC2.TextArea in a QQC2.ScrollView). Its
lines wrap, Return starts a new one, and it scrolls past
Prop::Lines, its natural height.
Checkbox
Switch
Select
A native pop-up menu of text options (NSPopUpButton, ComboBox,
gtk::DropDown, QQC2.ComboBox). Its options are Prop::Options.
RadioGroup
Native radio buttons, one for each of Prop::Options, of which
one at most is chosen, Prop::SelectedIndex (NSButtons of the
radio type, RadioButtons, gtk::CheckButtons in a group,
QQC2.RadioButtons). Down a column, as each platform stacks them.
Slider
A native slider (NSSlider, Slider, gtk::Scale, QQC2.Slider): a
Prop::Number in a Prop::Range, in Prop::Steps.
NumberInput
A native field for a whole number, with buttons that step it up and
down (NumberBox, gtk::SpinButton, QQC2.SpinBox; on AppKit an
NSTextField with an NSStepper beside it, as AppKit apps pair them):
a Prop::Number in a Prop::Range, stepped by Prop::Step.
Whole numbers that fit an i32, because Qt’s spin box holds an
int.
ColorWell
A native colour well: a button showing a colour, which opens the
platform’s own way to pick another (NSColorWell, its colour panel;
GTK’s ColorDialogButton; WinUI’s ColorPicker in a flyout under a
DropDownButton; on Qt a button opening the ColorDialog, as KDE apps
pair them). Its colour is Prop::ColorValue, opaque; the user’s
pick comes as Changed(Color).
Progress
A native progress bar (NSProgressIndicator, ProgressBar,
gtk::ProgressBar, QQC2.ProgressBar): a Prop::Progress.
Spinner
A native spinner for work of unknown length (a spinning
NSProgressIndicator, gtk::Spinner, ProgressRing,
QQC2.BusyIndicator). It spins while Prop::Running, and shows
nothing otherwise.
Separator
A native separator line between groups of content (a separator
NSBox, gtk::Separator, Kirigami.Separator; WinUI has none, so a
Border in the divider brush, as Fluent apps draw one). It runs as
Prop::Orientation says and is as thick as the platform draws
it; the layout gives it its length.
Image
A native image view (NSImageView, Image, gtk::Picture, QML Image):
a picture from Prop::Image, at its own size unless the layout
sizes it, fitted as Prop::ImageFit says.
Icon
An icon from the platform’s own set, by its name there: an SF
Symbol in an NSImageView, a themed icon in a gtk::Image or a
Kirigami.Icon, a Segoe Fluent Icons glyph in a FontIcon on WinUI.
Prop::Icon names it, at the platform’s own size unless
Prop::IconSize says otherwise.
FileIcon
A file’s or folder’s own icon, as the platform’s file manager shows
it: NSWorkspace’s in an NSImageView, GIO’s in a gtk::Image, its
MIME type’s in a Kirigami.Icon, the shell’s in a XAML Image.
Prop::File names it; it’s a square as big as the platform’s
small icons unless Prop::IconSize says otherwise. With
Prop::Thumbnail, a preview of what’s in the file where the
platform makes one; with Prop::FileLookup, a type’s icon from
the name alone.
GpuSurface
A native surface the app presents to with its own GPU API, off the
UI thread (an NSView backed by a CAMetalLayer, a Wayland
subsurface, a child window). The backend reports it as
SurfaceReady, then its size in pixels as SurfaceResized; with
Prop::TakesInput, its keys and pointer as SurfaceInput, and
with Prop::TextInput what its keys type.
ScrollView
A native scroll container. It has exactly one native child, the content, which the core lays out and may be larger than the viewport.
List
A native list control (NSTableView, ListView, gtk::ListView, QML
ListView). Its data is Prop::Rows. The platform decides which rows
exist (RowShown, RowHidden); its native children are the hosts of
the rows the core mounted for those (Containers with a
Prop::Row), in row order. It scrolls like a ScrollView.
Table
A native table: a List whose rows are cells under column headers
(NSTableView with columns and a header, gtk::ColumnView, a QML
TableView under a HorizontalHeaderView; WinUI has none, so a
ListView under a header of column buttons, as Fluent apps build
one). Its columns are Prop::Columns, sorted as Prop::Sort
says. Its data, selection and scrolling are a List’s; its native
children are the hosts of the cells the core mounted for the rows it
shows (Containers with a Prop::Cell), in row order, then
column order. The platform sizes its columns, and the user resizes
them: it reports the width each column gives its cells
(ColumnWidths).
Tree
A native tree: a List whose rows nest, opened and closed by a
disclosure the platform draws (NSOutlineView, a gtk::ListView over a
gtk::TreeListModel with gtk::TreeExpanders, a QML TreeView, WinUI’s
TreeView). Its data is Prop::TreeRows, the rows that show; its
selection, scrolling and native children are a List’s. The user
opens and closes rows (RowExpanded), and the platform says how
far it indents their content (TreeIndent).
Tabs
A native tab view: pages, one shown at a time, and a strip of their
titles to pick one (NSTabView, libadwaita’s inline view switcher or
a gtk::Notebook, a SelectorBar over its pages on WinUI, Kirigami’s
NavigationTabBar or a QQC2.TabBar). Its native
children are its pages’ hosts (Containers), in order, titled by
Prop::TabTitles; the shown one is Prop::SelectedIndex.
Every page stays mounted. The core lays out each page at the size
inside the tab strip and border (PlatformMetrics::tab_insets),
all in the same place, so the view is as big as its biggest page;
the platform places them and shows the chosen one.
DocumentTabs
Native document tabs: a strip of tabs with no pages, for documents
the app shows in one place of its own (a terminal’s sessions drawn
on one surface). WinUI’s TabView with items without content,
libadwaita’s AdwTabBar, a QQC2.TabBar with close buttons, and on
AppKit a strip of the backend’s, made as the system’s tab bar. Titled by Prop::TabTitles, the chosen
one Prop::SelectedIndex; the user closes them
(Prop::TabsClosable), moves them (Prop::TabsReorderable) and
asks for a new one (Prop::NewTabButton), where the app lets
them. Measured by the backend; empty where the tabs are the
window’s (DocumentTabsStyle::Window, DocumentTabsStyle::TitleRow).
Group
A native box around related content, under an optional heading
(Prop::Title): an NSBox, libadwaita’s card under a heading, a
Fluent card under a heading on WinUI, a QQC2.GroupBox. The core lays
out its children as a container’s, inside
PlatformMetrics::group_insets (or the
titled ones), and it’s at least as wide as its heading, which
backends measure. Backends draw the box behind the children, which
are its native children.
Split
Two panes with a divider between them that the user drags: side by
side, or with Orientation::Vertical one over the other. Its two
children are the panes. The core lays them out: the first as long
along the split as its Number, then the platform’s divider
(PlatformMetrics::split_divider), then
the second, which takes what’s left, so the first keeps its size as
the split grows. Each pane is at least its style’s least size
(Prop::PaneMinimums). The platform draws the divider and reports
where the user drags it as Changed(Number). A hidden pane
collapses, with the divider, and the other takes the whole split
(Prop::PanesShown); the position is kept for when it’s back.
Popover
A platform’s popover, attached to its parent (a container) while
Prop::PopoverShown: an NSPopover, a gtk::Popover, a XAML Flyout,
a QQC2.Popup. It’s out of its parent’s layout: the core lays out its
children at their natural size, as a toolbar item’s, and the
platform places it by its parent, where it fits. A click outside or
Escape dismisses it, as the platform’s do: the backend reports
PopoverShownChanged(false), which the core absorbs.
Custom(&'static str)
A custom widget (see CustomWidget), named
after it. Its props travel as Prop::Custom.
Native
A raw native view supplied by app code. Its factory and updates
travel as Prop::Native.