#[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 reportsGuiError::UnsupportedCapabilityrather than a kind error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
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
impl WidgetProperty
Sourcepub const ALL: &'static [WidgetProperty]
pub const ALL: &'static [WidgetProperty]
Every property row, in declaration order.
Sourcepub const fn applicable_kinds(self) -> &'static [WidgetKind]
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.
Sourcepub const fn operation(self) -> &'static str
pub const fn operation(self) -> &'static str
The stable operation name reported by GuiError::UnsupportedWidget;
it matches the setter that performed the check.
Sourcepub fn supports(self, kind: WidgetKind) -> bool
pub fn supports(self, kind: WidgetKind) -> bool
Whether kind is inside this property’s applicability row.