pub enum WidgetKind {
Show 33 variants
Window,
Container,
ToolbarItem,
Sidebar,
Fragment,
Text,
Button,
ToggleButton,
MenuButton,
TextInput,
PasswordInput,
SearchInput,
TextArea,
Checkbox,
Switch,
Select,
RadioGroup,
Slider,
NumberInput,
Progress,
Spinner,
Separator,
Image,
Icon,
FileIcon,
GpuSurface,
ScrollView,
List,
Table,
Tabs,
Group,
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.
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.
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.
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.
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).
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.
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.
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.