Skip to main content

Prop

Enum Prop 

Source
pub enum Prop {
Show 105 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), Error(Option<String>), ReadOnly(bool), Lines(u32), LineWrap(bool), FollowsEnd(bool), InputPurpose(InputPurpose), Checked(bool), Mixed(bool), Enabled(bool), TextStyle(TextStyle), ButtonRole(ButtonRole), ButtonStyle(ButtonStyle), Options(Vec<String>), SelectedIndex(Option<usize>), Number(f64), ColorValue(Color), Range { min: f64, max: f64, }, Step(Option<f64>), WrapAround(bool), Orientation(Orientation), PaneMinimums([f32; 2]), PanesShown([bool; 2]), Tooltip(String), ContextMenu(Vec<MenuEntry>), ContextMenuOnOpen(Option<MenuOnOpen>), Menu(Vec<MenuEntry>), MenuOnOpen(Option<MenuOnOpen>), Modal { owner: Option<NodeId>, modality: Modality, }, Image(ImageSource), ImageFit(ImageFit), Icon(String), VectorIcon(Option<VectorIcon>), IconSize(f32), File(PathBuf), Thumbnail(bool), FileLookup(FileLookup), 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), PopoverShown(bool), Suggestions(Vec<Suggestion>), SearchOnReturn(bool), Header(bool), HeaderEdge(HeaderEdge), SidebarPane(bool), ClickThrough(bool), Rows(Vec<RowKey>), TreeRows(Vec<TreeRow>), TreeLoading(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>), Transparent(bool), FileDrop(Option<FileDrop>), Hover(bool), DoubleClick(bool), Click(bool), RowFiles(Vec<(RowKey, PathBuf)>), RowMoves(RowMoves), 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, or the icon’s on a Button or ToggleButton (its caption keeps the platform’s). 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, SplitButton, 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).

§

Error(Option<String>)

What’s wrong with a TextInput’s, PasswordInput’s or TextArea’s text, or None: the platform marks the field where it has a way to (GTK’s error style), and assistive technology reads it as invalid, with the message as its description. The app shows the message, as apps on every platform place their own.

§

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.

§

FollowsEnd(bool)

A TextArea keeps its end in view as the app sets its text, while it’s there (or the area was empty): a log that follows its output, as Terminal and Console do. Scrolled up, it stays put. Turned on, it shows its end. 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. A Split‘s first pane’s size along it, in points, which the core keeps within the panes’ least sizes.

§

ColorValue(Color)

A ColorWell’s colour: an opaque Color::Rgba (semantic colours and alpha aren’t a colour well’s).

§

Range

The values a Slider or NumberInput can take.

Fields

§min: f64
§max: f64
§

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; a Split’s panes are side by side when it’s horizontal.

§

PaneMinimums([f32; 2])

A Split‘s panes’ least sizes along it, first then second, from their styles’ least width (or height): the platform stops the divider there. Computed by the core.

§

PanesShown([bool; 2])

Which of a Split‘s panes show, first then second: the divider shows only between two. Computed by the core from the panes’ visibility.

§

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.

§

ContextMenuOnOpen(Option<MenuOnOpen>)

The node’s context menu is built as the platform opens it: the platform calls it, from its own moment before a menu shows, and shows what it returns, which is also the node’s ContextMenu from then on. None: the menu is ContextMenu alone.

§

Menu(Vec<MenuEntry>)

A MenuButton’s or SplitButton’s menu: items, separators and submenus, built as a context menu’s. The node reports the item chosen as UiEvent::MenuItem.

§

MenuOnOpen(Option<MenuOnOpen>)

A MenuButton’s menu is built as the platform opens it, as ContextMenuOnOpen builds a context menu: what it returns is shown, and is the node’s Menu from then on. None: the menu is Menu alone.

§

Modal

A window is modal, belonging to owner (the window it was declared in, if any). Sent once, before the window is shown.

Fields

§modality: Modality
§

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, MenuButton or SplitButton 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.

§

VectorIcon(Option<VectorIcon>)

The app’s own icon, in place of a named one (Prop::Icon), for the same widgets: drawn as the platform draws its symbolic icons. None: the named one, if any.

§

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.

§

FileLookup(FileLookup)

Where a FileIcon gets its icon: the file on disk, or only its name. By name, Thumbnail is ignored.

§

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.

§

PopoverShown(bool)

A Popover is shown by its parent, or not. The user dismisses one too (a click outside, Escape): the backend reports PopoverShownChanged(false), which the core absorbs.

§

Suggestions(Vec<Suggestion>)

What a SearchInput suggests for its text, in a list under it while the user types, as each platform shows a field’s suggestions (an AutoSuggestBox’s list, a list in a window that doesn’t take the keyboard on AppKit, a popover that doesn’t on GTK, a popup that doesn’t on Qt). The field keeps the keyboard: the arrows move through the list, Return picks, Escape hides it. Empty: none.

§

SearchOnReturn(bool)

A SearchInput searches on Return (and when cleared), not as the user types: each platform’s setting for searches that take a while (AppKit’s sendsWholeSearchString, GTK’s activate alone, WinUI’s QuerySubmitted alone, Kirigami’s autoAccept off). 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.

§

SidebarPane(bool)

A container that’s a pane down its window’s side that navigates (the rail that picks a Git client’s pages, a mail app’s folders) when the app builds one itself rather than with Sidebar. On WinUI, under tabs in the title bar, it’s Mica Alt’s commanding layer, as a header is; the others leave it as it is. Sent only if the app chose.

§

ClickThrough(bool)

A container the pointer passes through, with everything in it, to what’s under it: a hint laid over a control. Sent only if the app chose.

§

Rows(Vec<RowKey>)

A List’s rows, in order.

§

TreeRows(Vec<TreeRow>)

A Tree’s rows that show, in order: a row, then its open children’s rows. Children of closed rows aren’t sent.

§

TreeLoading(Vec<RowKey>)

A Tree’s rows whose children are being read (a folder on a network share opening), of the rows that show: the platform shows its spinner where the row’s disclosure is. Sent only if the app said which rows load.

§

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.

§

Transparent(bool)

A GpuSurface lets the window’s backdrop show where what the app presents isn’t opaque: the material the platform puts behind a translucent window (AppKit’s behind-window vibrancy, WinUI’s Mica, which its windows always have), or the window’s own background where there’s none. The app still presents with alpha.

§

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).

§

Click(bool)

A Container or Group reports a click on it, or on anything inside it that isn’t a control, as UiEvent::Click, as a header that opens its section. Sent only if the app asked (on_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.

§

RowMoves(RowMoves)

A List’s rows can be dragged within it, and dropped where it says (List::on_move); it reports RowsMoved. Sent only if the app gave it.

§

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. On a TextInput or SearchInput, the keys it takes before its own use of them (the arrows, Return, Escape): a field that moves through a list beside it, as Xcode’s Open Quickly. A search field’s suggestions still take theirs first. 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

Source

pub fn key(&self) -> Discriminant<Prop>

Two props with the same key replace each other.

Source

pub fn affects_measure(&self, kind: WidgetKind) -> bool

Whether changing this prop can change the intrinsic size of a widget of this kind.

Trait Implementations§

Source§

impl Clone for Prop

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Prop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Prop

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Prop

Auto Trait Implementations§

§

impl !RefUnwindSafe for Prop

§

impl !Send for Prop

§

impl !Sync for Prop

§

impl !UnwindSafe for Prop

§

impl Freeze for Prop

§

impl Unpin for Prop

§

impl UnsafeUnpin for Prop

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.