Struct cushy::widget::MountedWidget
source · pub struct MountedWidget { /* private fields */ }
Expand description
A Widget
that has been attached to a widget hierarchy.
Because WidgetInstance
s can be reused, a mounted widget can be unmounted
and eventually remounted. To ensure the widget is in a consistent state, all
types that own MountedWidget
s should call
MountedWidget::remount_if_needed
during their mount()
functions.
Implementations§
source§impl MountedWidget
impl MountedWidget
sourcepub fn remount_if_needed(&mut self, context: &mut EventContext<'_>)
pub fn remount_if_needed(&mut self, context: &mut EventContext<'_>)
Remounts this widget, if it was previously unmounted.
sourcepub fn is_mounted(&self) -> bool
pub fn is_mounted(&self) -> bool
Returns true if this widget is still mounted in a window.
sourcepub fn lock(&self) -> WidgetGuard<'_>
pub fn lock(&self) -> WidgetGuard<'_>
Locks the widget for exclusive access. Locking widgets should only be done for brief moments of time when you are certain no deadlocks can occur due to other widget locks being held.
sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidates this widget.
sourcepub const fn instance(&self) -> &WidgetInstance
pub const fn instance(&self) -> &WidgetInstance
Returns the underlying widget instance
sourcepub fn next_focus(&self) -> Option<MountedWidget>
pub fn next_focus(&self) -> Option<MountedWidget>
Returns the next widget to focus after this widget.
This function returns the value set in
MakeWidget::with_next_focus()
.
sourcepub fn previous_focus(&self) -> Option<MountedWidget>
pub fn previous_focus(&self) -> Option<MountedWidget>
Returns the widget to focus before this widget.
There is no direct way to set this value. This relationship is created
automatically using MakeWidget::with_next_focus()
.
sourcepub fn explicit_focus_target(&self, advance: bool) -> Option<MountedWidget>
pub fn explicit_focus_target(&self, advance: bool) -> Option<MountedWidget>
Returns the next or previous focus target, if one was set using
MakeWidget::with_next_focus()
.
sourcepub fn last_layout(&self) -> Option<Rect<Px>>
pub fn last_layout(&self) -> Option<Rect<Px>>
Returns the region that the widget was last rendered at.
sourcepub fn effective_styles(&self) -> Styles
pub fn effective_styles(&self) -> Styles
Returns the effective styles for the current tree.
sourcepub fn primary_hover(&self) -> bool
pub fn primary_hover(&self) -> bool
Returns true if this widget that is directly beneath the cursor.
sourcepub fn parent(&self) -> Option<MountedWidget>
pub fn parent(&self) -> Option<MountedWidget>
Returns the parent of this widget.
sourcepub fn has_parent(&self) -> bool
pub fn has_parent(&self) -> bool
Returns true if this node has a parent.
Trait Implementations§
source§impl AsRef<WidgetId> for MountedWidget
impl AsRef<WidgetId> for MountedWidget
source§impl Clone for MountedWidget
impl Clone for MountedWidget
source§fn clone(&self) -> MountedWidget
fn clone(&self) -> MountedWidget
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MountedWidget
impl Debug for MountedWidget
source§impl ManageWidget for MountedWidget
impl ManageWidget for MountedWidget
source§type Managed = MountedWidget
type Managed = MountedWidget
Option<MountedWidget>
or
MountedWidget
.source§fn manage(&self, _context: &WidgetContext<'_>) -> Self::Managed
fn manage(&self, _context: &WidgetContext<'_>) -> Self::Managed
self
into a MountedWidget
.source§impl<T> MapManagedWidget<T> for MountedWidget
impl<T> MapManagedWidget<T> for MountedWidget
source§fn map(self, map: impl FnOnce(MountedWidget) -> T) -> Self::Result
fn map(self, map: impl FnOnce(MountedWidget) -> T) -> Self::Result
map
with a MountedWidget
.source§impl MountableChild for MountedWidget
impl MountableChild for MountedWidget
source§fn mount(
widget: MountedWidget,
_into: &MountedChildren<Self>,
_index: usize,
) -> Self
fn mount( widget: MountedWidget, _into: &MountedChildren<Self>, _index: usize, ) -> Self
widget
.source§fn widget(&self) -> &MountedWidget
fn widget(&self) -> &MountedWidget
source§fn unmount(self) -> MountedWidget
fn unmount(self) -> MountedWidget
source§impl PartialEq<WidgetInstance> for MountedWidget
impl PartialEq<WidgetInstance> for MountedWidget
source§impl PartialEq for MountedWidget
impl PartialEq for MountedWidget
Auto Trait Implementations§
impl Freeze for MountedWidget
impl !RefUnwindSafe for MountedWidget
impl Send for MountedWidget
impl Sync for MountedWidget
impl Unpin for MountedWidget
impl !UnwindSafe for MountedWidget
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.§impl<A> Cast for A
impl<A> Cast for A
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§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
source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.§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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> IntoReadOnly<T> for T
impl<T> IntoReadOnly<T> for T
source§fn into_read_only(self) -> ReadOnly<T>
fn into_read_only(self) -> ReadOnly<T>
self
as a ReadOnly
.source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.source§impl<T> IntoValue<T> for T
impl<T> IntoValue<T> for T
source§fn into_value(self) -> Value<T>
fn into_value(self) -> Value<T>
Value
.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more