pub struct Semantics {
pub typ: WidgetType,
pub label: String,
pub value: Option<f64>,
pub selected: Option<bool>,
pub enabled: bool,
}Expand description
The semantic payload attached to a painted element — what role it plays, the
human/agent-readable label, an optional numeric value, and whether it is the
current selection. This is the data a screen reader announces and a robot
driver / get_by_label retrieves.
Fields§
§typ: WidgetTypeAccessKit role (egui maps WidgetType → accesskit::Role).
label: StringStable, human-readable label. MUST be unique within a surface (FC-5).
value: Option<f64>Optional numeric value (a grid cell number, a bar height, a node count,
a yaw angle). Becomes the AccessKit numeric_value.
selected: Option<bool>Whether this element is the current selection (a selected cell/row/node).
enabled: boolWhether the element is enabled/interactive.
Implementations§
Source§impl Semantics
impl Semantics
Sourcepub fn new(typ: WidgetType, label: impl Into<String>) -> Self
pub fn new(typ: WidgetType, label: impl Into<String>) -> Self
A labelled element of an arbitrary role (no value, no selection).
A clickable button (e.g. a painted graph/DAG node, a chip, a tile).
Sourcepub fn image(label: impl Into<String>) -> Self
pub fn image(label: impl Into<String>) -> Self
A value-bearing image/region summary (e.g. a whole map/plot pane).
Sourcepub fn list_item(label: impl Into<String>, selected: bool) -> Self
pub fn list_item(label: impl Into<String>, selected: bool) -> Self
A selectable list/row item (file row, command-palette row, menu item).
Sourcepub fn value(self, v: f64) -> Self
pub fn value(self, v: f64) -> Self
Attach a numeric value (chainable). Carried as AccessKit numeric_value,
so get_by_label(..).numeric_value() reads it back exactly.
Sourcepub fn widget_info(&self) -> WidgetInfo
pub fn widget_info(&self) -> WidgetInfo
Build the egui WidgetInfo this semantics maps to.