pub struct ApplicationSelectionState {
pub history: Mutex<RawMutex, SelectionHistory>,
selection_previous_frame: ItemCollection,
selection_this_frame: Mutex<RawMutex, ItemCollection>,
hovered_previous_frame: ItemCollection,
hovered_this_frame: Mutex<RawMutex, ItemCollection>,
}
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<RawMutex, SelectionHistory>
History of selections (what was selected previously).
selection_previous_frame: ItemCollection
§selection_this_frame: Mutex<RawMutex, ItemCollection>
§hovered_previous_frame: ItemCollection
§hovered_this_frame: Mutex<RawMutex, ItemCollection>
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<ApplicationSelectionState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ApplicationSelectionState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Serialize for ApplicationSelectionState
impl Serialize for ApplicationSelectionState
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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>
§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> DowncastSync for T
impl<T> DowncastSync for T
§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request