Skip to main content

WidgetProperty

Enum WidgetProperty 

Source
#[non_exhaustive]
pub enum WidgetProperty {
Show 61 variants Checked, Value, Range, Step, SelectedIndex, TabItems, SelectedIndices, RowDrag, DataListItems, ListViewColumns, ListViewRows, DataGridRows, DataGridModel, DataGridRowHeight, DataGridColWidth, DataGridFrozenPanes, DataGridSelection, TreeItems, AlertLevel, ImageSource, ImageFit, ButtonIcon, FileChooserMode, ColorDialogData, FontDialogData, ToolbarItems, ToolbarOrientation, DateValue, LinkUrl, TextSelection, TextCompletion, PlaceholderText, ContainerDirection, ContainerWrap, ContainerScroll, ContainerGap, ContainerPadding, CanvasScene, CanvasSurface, CloseGuard, LayoutRoot, WindowCallback, NativeHandle, DrawDemoCube, CopyToClipboard, PasteFromClipboard, KeyedRows, ClearSelection, VisibleAnchor, CalendarDates, CalendarBounds, CalendarFirstDayOfWeek, CalendarSelectionMode, LabelAlignment, LabelWrap, RichTextRuns, RichTextImages, Monospace, MetalHandle, Font, RowIcons,
}
Expand description

A kind-restricted widget property, shared by crate::Ui and the backends.

WidgetSpec is a flat struct, so a property that only makes sense for some kinds (say range on a Slider) is rejected at runtime with GuiError::UnsupportedWidget. This enum single-sources those rejections — ADR decision 1-2 in the adr-widgetspec-typing.md decision record: every Ui::set_* guard and backend kind guard asks WidgetProperty::supports (through WidgetSpec::ensure_property) instead of repeating matches! lists, and the table-driven guard-matrix test asserts that every setter rejects every kind outside its row with the typed error.

Two families stay out of the table on purpose:

  • universally applicable properties (text, size, position, background_color, enabled, focusable, tooltip, accessibility metadata) carry no kind restriction to encode, and
  • per-lane mapping limits (Cocoa’s control-scoped enabled/focusable, the theme-override text kinds) are backend capabilities, not model applicability. A lane that cannot map a valid property reports GuiError::UnsupportedCapability rather than a kind error.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Checked

Checked state (Checkbox, RadioButton).

§

Value

Numeric value (Slider, SpinBox, ProgressBar).

§

Range

Numeric (min, max) range (Slider, SpinBox).

§

Step

Numeric step (Slider, SpinBox).

§

SelectedIndex

Selected item/page index (Tabs, ComboBox, DataList, ListView).

§

TabItems

Tab page labels (Tabs).

§

SelectedIndices

Multi-selection indices (ListView, DataList, TreeView).

§

RowDrag

Row drag source/drop target flags (ListView, DataList, DataGrid, TreeView).

§

DataListItems

Row strings (DataList, ListView).

§

ListViewColumns

Column headers for the columned list contract (ListView).

§

ListViewRows

Row cells for the columned list contract (ListView).

§

DataGridRows

Row-major cell values (DataGrid).

§

DataGridModel

Virtual data model (DataGrid).

§

DataGridRowHeight

Per-row height override (DataGrid).

§

DataGridColWidth

Per-column width override (DataGrid).

§

DataGridFrozenPanes

Frozen row/column counts (DataGrid).

§

DataGridSelection

Cell selection overrides (DataGrid).

§

TreeItems

Hierarchical items (TreeView).

§

AlertLevel

Alert severity (AlertDialog).

§

ImageSource

Raster image source (Image).

§

ImageFit

Image scaling mode (Image).

§

ButtonIcon

Button art: optional stock-art role rendered beside the label (Button, FileChooserDialog).

§

FileChooserMode

File chooser pick mode (FileChooserDialog).

§

ColorDialogData

Colour-dialog preferences (ColorDialog).

§

FontDialogData

Font-dialog preferences (FontDialog).

§

ToolbarItems

Toolbar tools and separators (Toolbar).

§

ToolbarOrientation

Toolbar stacking orientation (Toolbar).

§

DateValue

Date value (DatePicker).

§

LinkUrl

Link URL (LinkLabel).

§

TextSelection

Text selection range in characters (TextInput, TextArea).

§

TextCompletion

Text completion/suggestion items (TextInput).

§

PlaceholderText

Placeholder/hint text (TextInput).

§

ContainerDirection

Container stacking direction (Container, GroupBox, SplitPane).

§

ContainerWrap

Container wrapping mode (Container, GroupBox, SplitPane).

§

ContainerScroll

Container scroll flags (Container, GroupBox, SplitPane).

§

ContainerGap

Spacing between flow children (Container, GroupBox).

§

ContainerPadding

Inset between the container edges and its flow children (Container, GroupBox).

§

CanvasScene

Retained drawing scene (Canvas).

§

CanvasSurface

Raster paint surface (Canvas).

§

CloseGuard

Close-request interception (Window).

§

LayoutRoot

Declarative layout root (Window).

§

WindowCallback

Window event callbacks (Window).

§

NativeHandle

Backend-native Vulkan handle (VulkanCanvas).

§

DrawDemoCube

Built-in Vulkan demo scene (VulkanCanvas).

§

CopyToClipboard

Clipboard copy sources (DataList, ListView, DataGrid, TextInput, TextArea, Label).

§

PasteFromClipboard

Clipboard paste targets (DataList, ListView, DataGrid, TextInput, TextArea, Label).

§

KeyedRows

Keyed row updates (DataList, ListView, DataGrid).

§

ClearSelection

Selection clearing on row widgets (DataList, ListView, DataGrid, TreeView).

§

VisibleAnchor

Topmost-visible-row anchor query (DataList, ListView, DataGrid).

§

CalendarDates

Calendar selected dates (Calendar).

§

CalendarBounds

Calendar min/max selectable bounds (Calendar).

§

CalendarFirstDayOfWeek

Calendar first day of week convention (Calendar).

§

CalendarSelectionMode

Calendar selection mode (Calendar).

§

LabelAlignment

Label text alignment (Label).

§

LabelWrap

Label line wrap mode (Label).

§

RichTextRuns

Rich text styled runs (RichText).

§

RichTextImages

Inline images in rich text (RichText).

§

Monospace

Monospace (code/fixed-pitch) font rendering (TextArea, TextInput, Label, RichText).

§

MetalHandle

Backend-native Metal handle (MetalCanvas).

§

Font

Explicit widget font family, point size, weight, and slant (Label, Button, TextInput, TextArea).

§

RowIcons

Per-row stock-art icon roles for list controls (DataList, ListView).

Implementations§

Source§

impl WidgetProperty

Source

pub const ALL: &'static [WidgetProperty]

Every property row, in declaration order.

Source

pub const fn applicable_kinds(self) -> &'static [WidgetKind]

The kinds this property accepts — the single source of truth for every Ui::set_* guard and backend kind guard.

Source

pub const fn operation(self) -> &'static str

The stable operation name reported by GuiError::UnsupportedWidget; it matches the setter that performed the check.

Source

pub const fn name(self) -> &'static str

The property name, matching its operation name.

Source

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

Whether kind is inside this property’s applicability row.

Trait Implementations§

Source§

impl Clone for WidgetProperty

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 Copy for WidgetProperty

Source§

impl Debug for WidgetProperty

Source§

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

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

impl Eq for WidgetProperty

Source§

impl Hash for WidgetProperty

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WidgetProperty

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 WidgetProperty

Auto Trait Implementations§

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