pub enum Prop {
Show 86 variants
Title(String),
FullScreen(bool),
MinSize(Size),
HeightFollowsContent(bool),
Maximized(bool),
Resizable(bool),
Text(String),
MaxLines(Option<u32>),
Truncation(Truncation),
TextColor(Color),
FontWeight(FontWeight),
Italic(bool),
TextAlign(HorizontalAlign),
LayoutDirection(LayoutDirection),
Selectable(bool),
Label(String),
Value(String),
Placeholder(String),
ReadOnly(bool),
Lines(u32),
LineWrap(bool),
InputPurpose(InputPurpose),
Checked(bool),
Mixed(bool),
Enabled(bool),
TextStyle(TextStyle),
ButtonRole(ButtonRole),
ButtonStyle(ButtonStyle),
Options(Vec<String>),
SelectedIndex(Option<usize>),
Number(f64),
Range {
min: f64,
max: f64,
},
Step(Option<f64>),
WrapAround(bool),
Orientation(Orientation),
Tooltip(String),
ContextMenu(Vec<MenuEntry>),
Menu(Vec<MenuEntry>),
Modal {
owner: Option<NodeId>,
modality: Modality,
},
Image(ImageSource),
ImageFit(ImageFit),
Icon(String),
IconSize(f32),
File(PathBuf),
Thumbnail(bool),
IconOnly(bool),
Running(bool),
Progress(Option<f64>),
ScrollAxes(ScrollAxes),
ScrollBars(bool),
TabTitles(Vec<String>),
TabIcons(Vec<String>),
TabsStyle(TabsStyle),
TabsClosable(bool),
TabsReorderable(bool),
NewTabButton(bool),
DocumentTabsStyle(DocumentTabsStyle),
Sections(Vec<SidebarSectionData>),
SidebarShown(bool),
Header(bool),
HeaderEdge(HeaderEdge),
Rows(Vec<RowKey>),
EstimatedRowHeight(f32),
Row(RowKey),
Columns(Vec<ColumnData>),
Sort(Option<ColumnSort>),
Cell(CellKey),
SelectionMode(SelectionMode),
ListStyle(ListStyle),
Selected(Vec<RowKey>),
Custom(CustomProps),
Drawing(DisplayList),
Native(Opaque),
TakesInput(bool),
PointerLock(bool),
KeyboardGrab(bool),
Cursor(Cursor),
TextInput(bool),
InputMethod(bool),
TextCursor(Option<Rect>),
FileDrop(Option<FileDrop>),
Hover(bool),
DoubleClick(bool),
RowFiles(Vec<(RowKey, PathBuf)>),
Keys(Vec<Shortcut>),
Tweak(Opaque),
}Expand description
A property of a native widget. Which ones apply depends on the kind.
Variants§
Title(String)
A window’s title, or a Group’s heading (empty: none).
FullScreen(bool)
A window fills its screen, the platform’s own way (a Space of its
own on macOS). The user can change it too (the title bar’s button,
the window manager’s key): the backend reports FullScreenChanged,
which the core absorbs.
MinSize(Size)
The smallest content size the user can make a window, in points. A window smaller when it’s set grows to it.
HeightFollowsContent(bool)
The content sets a window’s height, not the user, who resizes only
its width; where the platform can’t hold one side (GTK), neither.
The core sets it for a WindowSize::FollowHeight window.
Maximized(bool)
A window fills its screen’s working area as the platform’s maximize
(on macOS, zoom) does, and is back to its own size without. The user
can change it too: the backend reports MaximizedChanged, which the
core absorbs. Sent only if the app chose.
Resizable(bool)
The user can resize a window. Without, only the app sets its size; sent only if the app chose.
Text(String)
Text content of a Text.
MaxLines(Option<u32>)
How many lines a Text shows at most, the last one cut off with an
ellipsis, as the platform draws one. None: all of them.
Truncation(Truncation)
Where a Text cut off at its line limit puts its ellipsis. AppKit,
Qt and WinUI cut off a single line’s start or middle only. Sent
only if the app chose.
TextColor(Color)
A Text’s or Icon’s colour. Semantic colours follow the
appearance (dark mode, high contrast, the accent colour); Rgba is
fixed. Icons in full colour keep their own; symbolic ones take it.
Sent only if the app chose.
FontWeight(FontWeight)
A Text’s weight, in place of its text style’s.
Italic(bool)
A Text in italics.
TextAlign(HorizontalAlign)
Where a Text’s lines go across its frame. The core resolves the
app’s TextAlign against the text’s direction, so it’s left or
right here.
LayoutDirection(LayoutDirection)
Which way a widget lays itself out and draws: a checkbox’s box on the right of its caption, a slider’s minimum on the right, a text field’s text starting on the right. The core resolves it for every native node, and sends it to those that are right to left, and to every node of an app whose language is (never to an app that is only left to right). Frames are already mirrored: containers don’t mirror what they hold.
Selectable(bool)
A Text’s text can be selected and copied by the user. Sent when
the text is created, and never changed: Qt’s selectable label is
another item.
Label(String)
Caption of a Button, ToggleButton, MenuButton, Checkbox or
Switch; accessible name of a Switch, Select, RadioGroup,
Slider, NumberInput, Progress, Image, Icon or GpuSurface,
and of a button that shows only its icon.
Value(String)
Current text of a TextInput, PasswordInput, SearchInput or
TextArea; a text area’s lines end in \n.
Placeholder(String)
What a text field shows while it’s empty. Text areas show it where the platform’s have one (Qt, WinUI).
ReadOnly(bool)
A TextInput or TextArea shows its text, which can be selected
and copied, but not edited: by typing, or by assistive technology.
Lines(u32)
How many lines of text a TextArea is tall at its natural size, in
the platform’s font and line spacing; it scrolls past them. The
layout can still make it taller or shorter.
LineWrap(bool)
A TextArea’s lines wrap to its width. Without, a line is as long
as its text, and the area scrolls sideways. Sent only if the app
chose.
InputPurpose(InputPurpose)
What a TextInput is for; sent only if the app chose.
Checked(bool)
Checked state of a Checkbox, Switch or ToggleButton.
Mixed(bool)
A Checkbox shows the mixed state (some of what it stands for is
checked), whatever Checked says. A click leaves it: where it lands
is the platform’s call, and the core absorbs it as Mixed(false).
Enabled(bool)
TextStyle(TextStyle)
ButtonRole(ButtonRole)
ButtonStyle(ButtonStyle)
Options(Vec<String>)
A Select’s or RadioGroup’s options, in order.
SelectedIndex(Option<usize>)
Which option of a Select is chosen: always one, unless it has no
options. Which option of a RadioGroup is: None for none. Which item of a Sidebar is, counting across its sections:
None for none. Which page of a Tabs is shown, and which tab of
DocumentTabs is chosen: always one, unless it has none.
Number(f64)
A Slider’s or NumberInput’s value, within its range. The core
sends it after the range, which may have clamped it.
Range
The values a Slider or NumberInput can take.
Step(Option<f64>)
A Slider’s step, used as the platform uses one: to snap to, where
its sliders snap, and to move by from the keyboard. What a
NumberInput’s buttons and arrow keys add or take away. None: the
platform’s default.
WrapAround(bool)
A NumberInput stepped past one end of its range goes on from the
other. Sent only if the app chose: without, it’s the platform’s
(AppKit’s stepper wraps, the others stop).
Orientation(Orientation)
Which way a Slider or a Separator runs.
Tooltip(String)
Text the platform shows when the pointer rests on the widget, as its tooltip, and assistive technology reads as its description. Any widget or container can have one; empty: none.
ContextMenu(Vec<MenuEntry>)
The menu the platform shows its own way on a right-click, a long
press or the menu key: items, separators and submenus. Any widget
or container can have one; empty: none. The node reports the item
chosen as UiEvent::ContextMenuItem.
Menu(Vec<MenuEntry>)
A MenuButton’s menu: items, separators and submenus, built as a
context menu’s. The node reports the item chosen as
UiEvent::MenuItem.
Modal
A window is modal, belonging to owner (the window it was declared
in, if any). Sent once, before the window is shown.
Image(ImageSource)
What an Image shows.
ImageFit(ImageFit)
How an Image fills its frame; sent only if the app chose.
Icon(String)
What an Icon shows, or the icon a Button, ToggleButton or
MenuButton shows before its caption: a name in the platform’s own set (an SF Symbol, a themed
icon’s name, a Segoe Fluent Icons glyph). Empty: none. A name the
set doesn’t have shows as the platform shows one: nothing, or its
missing-icon icon.
IconSize(f32)
How big an Icon is, in points, used as the platform sizes icons:
an SF Symbol’s point size (as a font’s), the side of a square
elsewhere; a FileIcon’s square’s side everywhere. Sent only if the
app chose.
File(PathBuf)
The file or folder a FileIcon shows the icon of. It’s read when
set, as an image file is.
Thumbnail(bool)
A FileIcon shows a preview of what’s in the file (a picture’s,
a document’s first page) in place of its icon, where the platform
makes one; its icon until then, and where it makes none.
IconOnly(bool)
A button shows its icon without its caption, which stays its accessible name. Without an icon it shows its caption.
Running(bool)
Whether a Spinner spins. Stopped, it shows nothing but keeps its
place.
Progress(Option<f64>)
How far along a Progress is, from 0 to 1. None: not known (an
indeterminate, animated bar).
ScrollAxes(ScrollAxes)
Which axes a ScrollView scrolls.
ScrollBars(bool)
Whether a ScrollView shows scroll bars, as the platform shows them.
Without, it still scrolls, by wheel, trackpad and touch.
TabTitles(Vec<String>)
A Tabs’ page titles, in page order; DocumentTabs’ titles, in
order.
TabIcons(Vec<String>)
A Tabs’ tab icons, in page order: names in the platform’s own set,
as Icon’s; empty for none. Sent only if a tab has one.
TabsStyle(TabsStyle)
How a Tabs shows its tabs. Sent only if the app chose.
TabsClosable(bool)
DocumentTabs’ tabs have the platform’s close buttons (and its
middle click, where it has one), which report
TabCloseRequested; the app closes the tab. Sent only if the app
asked (on_close).
TabsReorderable(bool)
The user can drag DocumentTabs’ tabs to another place among them
(and move them from the keyboard, where the platform can), which
reports TabMoved; the core absorbs it. Sent only if the app asked
(on_move).
NewTabButton(bool)
DocumentTabs have the platform’s new-tab button, which reports
NewTabRequested. Sent only if the app asked (on_new).
DocumentTabsStyle(DocumentTabsStyle)
Where DocumentTabs show their tabs. Sent only if the app chose.
Sections(Vec<SidebarSectionData>)
A Sidebar’s items, in sections, in order.
SidebarShown(bool)
A Sidebar is shown beside the window’s content, or hidden, as the
platform shows and hides one. The user can change it too: the
backend reports SidebarShownChanged, which the core absorbs. Sent
only if the app chose.
Header(bool)
A Container at the top of its window’s content is the window’s
header, the part that stays while what’s under it scrolls: on
AppKit it goes in the title bar, under the title and toolbar, in
their glass (a bottom NSTitlebarAccessoryViewController), and the
scroll view right under it runs up under the bar, blurred at its
edge, as Safari’s and Mail’s bars have it. The others have no such
bar and leave it where it is, at the content’s top; so does AppKit
for one that isn’t there, or beside a sidebar. Sent only if the app
chose.
HeaderEdge(HeaderEdge)
How a header meets what scrolls under it. Sent only if the app chose.
Rows(Vec<RowKey>)
A List’s rows, in order.
EstimatedRowHeight(f32)
How high a List’s rows are likely to be, for platforms that must
size rows before they’re shown.
Row(RowKey)
Which row of its List a row host shows.
Columns(Vec<ColumnData>)
A Table’s columns, in order.
Sort(Option<ColumnSort>)
The column a Table is sorted by, which its header shows. The user
pressing a sortable column’s header sorts it as the platform does:
the backend reports Changed(Sort), which the core absorbs.
Cell(CellKey)
Which cell of its Table a cell host shows.
SelectionMode(SelectionMode)
ListStyle(ListStyle)
Selected(Vec<RowKey>)
The selected rows of a List.
Custom(CustomProps)
A custom widget’s props, with its renders.
Drawing(DisplayList)
What a drawn custom widget shows. Computed by the core after layout, so it arrives with the frames.
Native(Opaque)
A Native node’s factory (on create), then its updates: payloads in
the backend’s own form.
TakesInput(bool)
A GpuSurface takes keys and the pointer, and reports them as
SurfaceInput: it takes focus from a click and from Tab.
PointerLock(bool)
A GpuSurface holds the pointer: the cursor is hidden and stays
put, and its moves are reported as SurfaceInput::Motion. Only
while its window is the active one; the backend reports
PointerLockEnded when that stops, or it can’t lock.
KeyboardGrab(bool)
A GpuSurface takes every key while it has focus, the system’s
shortcuts and the app’s own too, as far as the platform lets an
app. Setting it focuses the surface; the backend reports
KeyboardGrabEnded when the surface or its window loses focus, or
it can’t grab.
Cursor(Cursor)
The pointer’s cursor over a GpuSurface.
TextInput(bool)
A GpuSurface that takes input takes text too, as a text field
does: its keys report what they type, and the platform’s input
methods are on while it has focus, committing as
SurfaceInput::Text.
InputMethod(bool)
Whether the platform’s input methods are on while a GpuSurface
takes text (they are unless this says otherwise). Off, its keys
still report what they type, dead keys and AltGr composed in, but
nothing composes: for a modal editor whose keys are commands
outside its insert mode, as a terminal’s are.
TextCursor(Option<Rect>)
Where the caret is on a GpuSurface that takes text, in points from
its top left: the input method’s candidate window opens by it.
FileDrop(Option<FileDrop>)
A Container or Group takes the files and folders this says
when they’re dragged from the platform’s file manager and dropped
on it; None: none. While acceptable files are over it, the
platform shows it’ll copy them, and the node reports
DropHover(true), then DropHover(false); a drop reports the ones
it takes as FilesDropped.
Hover(bool)
A Container or Group reports the pointer coming over it, or
over anything inside it, and leaving, as
UiEvent::Hover. Sent only if the app
asked (on_hover).
DoubleClick(bool)
A Container or Group reports a double click on it, or on
anything inside it that isn’t a control (a label, an icon), as
UiEvent::DoubleClick. Sent only if
the app asked (on_double_click).
RowFiles(Vec<(RowKey, PathBuf)>)
A List’s or Table‘s rows’ files: dragging a row carries its
file out of the app (to the file manager, another app, a folder),
and dragging a selected row carries every selected row’s, as the
platform drags a selection. The drag offers to copy. Rows without a
file don’t drag. Sent before the rows, and only if the app gave
them.
Keys(Vec<Shortcut>)
The keys a Container, Group, List or Table takes while it,
or a control inside it, has keyboard focus, and the focused control
doesn’t use them itself: they go up from the focused control, as the
platform sends keys it doesn’t use, to the nearest node that takes
them, which reports UiEvent::Key. Sent only
if the app gave some.
Tweak(Opaque)
Raw platform settings for a built-in widget (see
Tweak), in the backend’s own form. Applied after
the widget’s other props, and again whenever they change.
Implementations§
Source§impl Prop
impl Prop
Sourcepub fn key(&self) -> Discriminant<Prop>
pub fn key(&self) -> Discriminant<Prop>
Two props with the same key replace each other.
Sourcepub fn affects_measure(&self, kind: WidgetKind) -> bool
pub fn affects_measure(&self, kind: WidgetKind) -> bool
Whether changing this prop can change the intrinsic size of a widget of this kind.