Skip to main content

Prop

Enum Prop 

Source
pub enum Prop {
Show 77 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), Sections(Vec<SidebarSectionData>), SidebarShown(bool), 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), 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: always one, unless it has no pages.

§

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.

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.

§

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.

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

§

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.

§

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.

§

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.

§

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

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.