pub struct ApplicationSelectionState {
pub history: Mutex<SelectionHistory>,
/* private fields */
}
Expand description
Selection and hover state.
Both hover and selection are double buffered: Changes from one frame are only visible in the next frame.
Fields§
§history: Mutex<SelectionHistory>
History of selections (what was selected previously).
Implementations§
Source§impl ApplicationSelectionState
impl ApplicationSelectionState
Sourcepub fn on_frame_start(
&mut self,
item_retain_condition: impl Fn(&Item) -> bool,
fallback_selection: Option<Item>,
)
pub fn on_frame_start( &mut self, item_retain_condition: impl Fn(&Item) -> bool, fallback_selection: Option<Item>, )
Called at the start of each frame
Sourcepub fn select_previous(&self)
pub fn select_previous(&self)
Selects the previous element in the history if any.
Sourcepub fn select_next(&self)
pub fn select_next(&self)
Selections the next element in the history if any.
Sourcepub fn clear_selection(&self)
pub fn clear_selection(&self)
Clears the current selection out.
Sourcepub fn set_selection(&self, items: impl Into<ItemCollection>)
pub fn set_selection(&self, items: impl Into<ItemCollection>)
Sets several objects to be selected, updating history as needed.
Clears the selected space context if none was specified.
Sourcepub fn selected_items(&self) -> &ItemCollection
pub fn selected_items(&self) -> &ItemCollection
Returns the current selection.
Sourcepub fn hovered_items(&self) -> &ItemCollection
pub fn hovered_items(&self) -> &ItemCollection
Returns the currently hovered objects.
Sourcepub fn set_hovered(&self, hovered: impl Into<ItemCollection>)
pub fn set_hovered(&self, hovered: impl Into<ItemCollection>)
Set the hovered objects. Will be in Self::hovered_items
on the next frame.
Sourcepub fn toggle_selection(&self, toggle_items: ItemCollection)
pub fn toggle_selection(&self, toggle_items: ItemCollection)
Select passed objects unless already selected in which case they get unselected. If however an object is already selected but now gets passed a different selected space context, it stays selected after all but with an updated selected space context!
pub fn selection_space_contexts( &self, ) -> impl Iterator<Item = &ItemSpaceContext>
pub fn hovered_space_context(&self) -> Option<&ItemSpaceContext>
pub fn highlight_for_ui_element(&self, test: &Item) -> HoverHighlight
Trait Implementations§
Source§impl Default for ApplicationSelectionState
impl Default for ApplicationSelectionState
Source§fn default() -> ApplicationSelectionState
fn default() -> ApplicationSelectionState
Source§impl<'de> Deserialize<'de> for ApplicationSelectionStatewhere
ApplicationSelectionState: Default,
impl<'de> Deserialize<'de> for ApplicationSelectionStatewhere
ApplicationSelectionState: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for ApplicationSelectionState
impl !RefUnwindSafe for ApplicationSelectionState
impl Send for ApplicationSelectionState
impl Sync for ApplicationSelectionState
impl Unpin for ApplicationSelectionState
impl UnwindSafe for ApplicationSelectionState
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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