pub struct SceneItemHandlerSet {
pub on_tap: Option<Rc<dyn Fn(&SceneTapEvent, &mut EventContext<'_>)>>,
pub on_double_tap: Option<Rc<dyn Fn(&SceneTapEvent, &mut EventContext<'_>)>>,
pub on_hover: Option<Rc<dyn Fn(bool, &mut EventContext<'_>)>>,
pub on_context_menu: Option<Rc<dyn Fn(&SceneTapEvent, &mut EventContext<'_>)>>,
pub accept_tap_buttons: ButtonMask,
pub cursor: Option<CursorIcon>,
pub tooltip: Option<LocalizedString>,
pub accepts_drops: bool,
}Expand description
Per-item event closures + cursor + tooltip + drop acceptance.
Closures are stored as Rc<dyn Fn> so cloning the handler set
is cheap; the SceneView clones into its dispatch path.
Fields§
§on_tap: Option<Rc<dyn Fn(&SceneTapEvent, &mut EventContext<'_>)>>Tap (single click). Stored as the rich SceneTapEvent
form internally; the simpler Self::on_tap setter wraps
Fn(Point, ...) callers in a shim that extracts
event.position_scene.
on_double_tap: Option<Rc<dyn Fn(&SceneTapEvent, &mut EventContext<'_>)>>Double-tap. Storage only — the SceneView’s dispatch site doesn’t synthesise double-tap recognition yet; this field stays unset-on-fire until a future unit wires the recognizer in. Treat as a forward-declared slot.
on_hover: Option<Rc<dyn Fn(bool, &mut EventContext<'_>)>>Hover transitions: bool is true on enter, false on
leave.
Right-click / OS-native context-menu trigger.
Which pointer buttons count as a “tap” / context-menu
invocation. Default [ButtonMask::PRIMARY] for tap; the
SECONDARY button always routes through on_context_menu
regardless of this mask. Items wanting middle-click-as-tap
extend the mask: accept_tap_buttons(PRIMARY | MIDDLE).
Mirrors widget-tier accept_tap_buttons(...).
cursor: Option<CursorIcon>Cursor icon shown while the pointer is over this item. Overrides the SceneView default.
tooltip: Option<LocalizedString>Tooltip body for this item. Kept as a LocalizedString (not an
eagerly-resolved String) so a tr!(...) source follows the
active locale — the SceneView resolves it against the current
locale at show time. The SceneView’s hover machinery surfaces it
as a point-anchored overlay through the standard overlay manager.
accepts_drops: boolWhether the item accepts dropped payloads.
Implementations§
Source§impl SceneItemHandlerSet
impl SceneItemHandlerSet
Sourcepub fn on_tap<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(Point, &mut EventContext<'_>) + 'static,
pub fn on_tap<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(Point, &mut EventContext<'_>) + 'static,
Register a tap callback. Simpler Fn(Point, &mut ctx)
signature for callers that only need the click position;
internally wraps in a shim that extracts
event.position_scene. For modifier-aware handlers (Shift-
click selection, Ctrl-click toggle, etc.) use
Self::on_tap_event which exposes the full
SceneTapEvent.
Sourcepub fn on_tap_event<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(&SceneTapEvent, &mut EventContext<'_>) + 'static,
pub fn on_tap_event<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(&SceneTapEvent, &mut EventContext<'_>) + 'static,
Register a tap callback that receives the full
SceneTapEvent — scene-coord position, button, modifiers.
Use for modifier-aware patterns (Shift+click extends selection, Ctrl+click toggles, middle-click handlers
once paired with accept_tap_buttons).
Sourcepub fn on_double_tap<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(Point, &mut EventContext<'_>) + 'static,
pub fn on_double_tap<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(Point, &mut EventContext<'_>) + 'static,
Register a double-tap callback (Point-only shim — see
Self::on_tap). Not wired yet: the SceneView’s
dispatch doesn’t recognise double-tap; the field is stored
but never fired. A future unit wires the recognizer.
Sourcepub fn on_double_tap_event<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(&SceneTapEvent, &mut EventContext<'_>) + 'static,
pub fn on_double_tap_event<F>(&mut self, f: F) -> &mut Selfwhere
F: Fn(&SceneTapEvent, &mut EventContext<'_>) + 'static,
Rich-event variant of Self::on_double_tap.
Sourcepub fn on_hover<F>(&mut self, f: F) -> &mut Self
pub fn on_hover<F>(&mut self, f: F) -> &mut Self
Register a hover callback. Receives true on enter,
false on leave.
Register a context-menu callback (right-click). Point-only
shim; see Self::on_context_menu_event for the rich
variant.
Rich-event variant of Self::on_context_menu.
Mask of pointer buttons that should be treated as a tap
for this item. Default [ButtonMask::PRIMARY]. Right-click
(SECONDARY) always routes through on_context_menu
regardless of this mask.
Sourcepub fn cursor(&mut self, c: CursorIcon) -> &mut Self
pub fn cursor(&mut self, c: CursorIcon) -> &mut Self
Override the cursor icon shown over this item.
Sourcepub fn tooltip(&mut self, t: impl Into<LocalizedString>) -> &mut Self
pub fn tooltip(&mut self, t: impl Into<LocalizedString>) -> &mut Self
Set a tooltip. Accepts anything convertible into
[LocalizedString] — most commonly
tr!(...) for translated copy or lit!(...) for fixed text.
Stored unresolved; the SceneView resolves it against the active
locale when the tooltip is shown, so a tr!(...) source tracks
locale changes.
Sourcepub fn accepts_drops(&mut self, accepts: bool) -> &mut Self
pub fn accepts_drops(&mut self, accepts: bool) -> &mut Self
Mark whether the item accepts dropped payloads.
Trait Implementations§
Source§impl Clone for SceneItemHandlerSet
impl Clone for SceneItemHandlerSet
Source§fn clone(&self) -> SceneItemHandlerSet
fn clone(&self) -> SceneItemHandlerSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SceneItemHandlerSet
impl Debug for SceneItemHandlerSet
Auto Trait Implementations§
impl !RefUnwindSafe for SceneItemHandlerSet
impl !Send for SceneItemHandlerSet
impl !Sync for SceneItemHandlerSet
impl !UnwindSafe for SceneItemHandlerSet
impl Freeze for SceneItemHandlerSet
impl Unpin for SceneItemHandlerSet
impl UnsafeUnpin for SceneItemHandlerSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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