pub struct GroupItem { /* private fields */ }Expand description
A group container with optional fill / stroke / inline label, in local item coordinates.
Visually, GroupItem renders a labelled box around its members. Logically, it’s the AT-grouping primitive: with no chrome and a label set, it announces itself to AT but draws nothing.
Implementations§
Source§impl GroupItem
impl GroupItem
Sourcepub fn new(local_bounds: Rect) -> Self
pub fn new(local_bounds: Rect) -> Self
A group covering local_bounds in local coordinates. No
chrome by default — call fill / stroke / show_label to
give it visible outline / background / inline label.
Sourcepub fn label(self, label: impl Into<LocalizedString>) -> Self
pub fn label(self, label: impl Into<LocalizedString>) -> Self
Human-readable label, used as the default AT group name and
(when show_label is enabled) rendered inline at top-leading.
Sourcepub fn show_label(self, show: bool) -> Self
pub fn show_label(self, show: bool) -> Self
Render the label inline at paint time.
Sourcepub fn label_inset(self, dx: f32, dy: f32) -> Self
pub fn label_inset(self, dx: f32, dy: f32) -> Self
Override the inset of the inline label from the local origin.
Sourcepub fn label_color(self, color: impl Into<ColorProp>) -> Self
pub fn label_color(self, color: impl Into<ColorProp>) -> Self
Override the inline label colour. Defaults to the stroke colour if set,
else Color::BLACK. Accepts a plain [Color], a theme role, or a
reactive signal.
Sourcepub fn fill(self, color: impl Into<ColorProp>) -> Self
pub fn fill(self, color: impl Into<ColorProp>) -> Self
Background fill colour. Accepts a plain [Color], a theme role, a
Signal<Color>, or a Signal<Role> — resolved against the active theme
at paint time.
Sourcepub fn stroke(self, color: impl Into<ColorProp>, width: f32) -> Self
pub fn stroke(self, color: impl Into<ColorProp>, width: f32) -> Self
Border stroke (colour + scene-coord pixel width) — scales with zoom.
Sourcepub fn stroke_cosmetic(self, color: impl Into<ColorProp>, width: f32) -> Self
pub fn stroke_cosmetic(self, color: impl Into<ColorProp>, width: f32) -> Self
Cosmetic border stroke: holds a constant device-pixel width at any
zoom. With corner_radius > 0 the rounded outline goes through the SDF
cosmetic path; otherwise stroke_rect emits four CosmeticLine edges
(one per side), which are hard-edged and crisp at any zoom.
Sourcepub fn stroke_styled(
self,
color: impl Into<ColorProp>,
style: StrokeStyle,
) -> Self
pub fn stroke_styled( self, color: impl Into<ColorProp>, style: StrokeStyle, ) -> Self
Border stroke with an explicit [StrokeStyle] — dashed / dotted /
custom caps. E.g. .stroke_styled(color, StrokeStyle::dashed(2.0, 6.0, 4.0))
for a dashed lane boundary.
Sourcepub fn corner_radius(self, radius: f32) -> Self
pub fn corner_radius(self, radius: f32) -> Self
Rounded corners for fill and stroke. Default 0.0.
Sourcepub fn access_label(self, label: impl Into<LocalizedString>) -> Self
pub fn access_label(self, label: impl Into<LocalizedString>) -> Self
Override the AT name announced for this item. Accepts
anything convertible into LocalizedString — most
commonly tr!(...) for translated labels, or any plain
string (which auto-converts via From<String>).
Sourcepub fn access_description(self, description: impl Into<LocalizedString>) -> Self
pub fn access_description(self, description: impl Into<LocalizedString>) -> Self
Long-form context appended to the item’s announcement.
Sourcepub fn access_role(self, role: Role) -> Self
pub fn access_role(self, role: Role) -> Self
Override the AccessKit role for this item.
Hide this item from the AT tree.
Sourcepub fn access_subtree(self, mode: AccessSubtreeMode) -> Self
pub fn access_subtree(self, mode: AccessSubtreeMode) -> Self
Set the AT subtree mode. Merge collapses descendants
into this item’s AT node; Exclude prunes them; the
default Inherit lets them emit normally.
Sourcepub fn access_merge_subtree(self) -> Self
pub fn access_merge_subtree(self) -> Self
Convenience: collapse all descendants into this item’s AT node so the subtree reads as one element.
Sourcepub fn access_exclude_subtree(self) -> Self
pub fn access_exclude_subtree(self) -> Self
Convenience: prune all descendants from the AT tree.
Sourcepub fn access_value(self, value: impl Into<LocalizedString>) -> Self
pub fn access_value(self, value: impl Into<LocalizedString>) -> Self
Announce a string value for this item (e.g. a formatted data
reading like "42 %"). Mirrors the widget-tier .access_value.
Sourcepub fn access_numeric_value(self, value: f64) -> Self
pub fn access_numeric_value(self, value: f64) -> Self
Announce a numeric value for this item, for slider/gauge-like data
marks whose magnitude assistive tech should describe. Pair with
access_numeric_range /
access_numeric_step for full
range semantics.
Sourcepub fn access_numeric_range(self, min: f64, max: f64) -> Self
pub fn access_numeric_range(self, min: f64, max: f64) -> Self
Announce the numeric min/max bounds for this item.
Sourcepub fn access_numeric_step(self, step: f64) -> Self
pub fn access_numeric_step(self, step: f64) -> Self
Announce the numeric step (per-arrow increment) for this item.
Trait Implementations§
Source§impl SceneItem for GroupItem
impl SceneItem for GroupItem
Source§fn shape_contains(&self, local_pt: Point) -> bool
fn shape_contains(&self, local_pt: Point) -> bool
Non-visual GroupItems pass clicks through to items beneath. Visual groups (with fill / stroke / inline label) AABB-hit-test so apps can wire group-level click handlers.
Source§fn clone_shape_test(&self) -> Box<dyn Fn(Point, f32) -> bool + 'static>
fn clone_shape_test(&self) -> Box<dyn Fn(Point, f32) -> bool + 'static>
Override the default AABB-only snapshot: logical-only groups (no fill, no stroke, no inline label) must MISS for dispatch so clicks fall through to items beneath. Without this override the snapshot would AABB-hit and capture every event over the group’s rect, blocking the items it contains.
Source§fn local_bounds(&self) -> Rect
fn local_bounds(&self) -> Rect
scene_transform to compute its scene-space AABB for the
spatial index.Source§fn set_local_bounds(&mut self, bounds: Rect)
fn set_local_bounds(&mut self, bounds: Rect)
Scene::set_local_bounds
when the bounds change. Implementations update their stored
bounds field; geometry-bearing items (e.g. crate::PathItem)
must keep their geometry consistent with the new bounds.Source§fn paint(&self, canvas: &mut Canvas, ctx: &SceneItemPaintContext<'_>)
fn paint(&self, canvas: &mut Canvas, ctx: &SceneItemPaintContext<'_>)
scene_transform (parent chain × view) pushed, so
coordinates are in local item space — (0, 0) is the
item’s anchor. Read moreSource§fn set_fill(&mut self, fill: Option<ColorProp>) -> bool
fn set_fill(&mut self, fill: Option<ColorProp>) -> bool
true if this item kind has
a fill slot that accepted the change. Backs
SceneModel::set_item_fill /
clear_item_fill. Rectangles,
paths, and groups set their fill; text items map it onto their
foreground colour (so a None is rejected — text always has a colour);
image items have no fill and return false. Default: no-op.Source§fn set_stroke(&mut self, stroke: Option<(ColorProp, StrokeStyle)>) -> bool
fn set_stroke(&mut self, stroke: Option<(ColorProp, StrokeStyle)>) -> bool
StrokeStyle]), returning true if this
item kind has a stroke slot that accepted the change. Backs
SceneModel::set_item_stroke /
clear_item_stroke. Rectangles,
paths, and groups accept it; text and image items return false.
Default: no-op.Source§fn register_bindings(&self, ctx: &mut BuildContext<'_>, view_id: WidgetId)
fn register_bindings(&self, ctx: &mut BuildContext<'_>, view_id: WidgetId)
SceneView::build for every item in
the scene, with the SceneView’s WidgetId as view_id. Items
with signal-bound state bind their signals here at the
appropriate BindingLevel.Source§fn thumbnail_color(&self) -> Color
fn thumbnail_color(&self) -> Color
RectItem
returns its fill, PathItem
returns stroke or fill, ImageItem
returns the image’s dominant tint placeholder. Read moreSource§fn label(&self) -> Option<String>
fn label(&self) -> Option<String>
SceneItem::accessibility impl as
the AT name when an item author hasn’t overridden it via the
per-item .access_label(...) chain.Source§fn accessibility(
&self,
builder: &mut AccessNodeBuilder,
_ctx: &SceneItemA11yContext,
)
fn accessibility( &self, builder: &mut AccessNodeBuilder, _ctx: &SceneItemA11yContext, )
Role::GraphicsObject] plus the SceneItem::label as the
AT name if set. The per-item .access_* builder chain layers
overrides on top of whatever this method writes.Source§fn access_subtree_mode(&self) -> AccessSubtreeMode
fn access_subtree_mode(&self) -> AccessSubtreeMode
Source§fn initial_flags(&self) -> ItemFlags
fn initial_flags(&self) -> ItemFlags
ItemFlags::default() — visible, enabled,
selectable. Built-ins read their accumulated builder state
(e.g. .draggable(true) flips IS_DRAGGABLE); custom items
override this to opt into hover acceptance, focus, clipping,
or IGNORES_TRANSFORMATIONS. Read moreSource§fn cache_mode(&self) -> CacheMode
fn cache_mode(&self) -> CacheMode
CacheMode::None: the
item’s paint runs every frame. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GroupItem
impl !Send for GroupItem
impl !Sync for GroupItem
impl !UnwindSafe for GroupItem
impl Freeze for GroupItem
impl Unpin for GroupItem
impl UnsafeUnpin for GroupItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more