pub struct Anchored { /* private fields */ }Expand description
An anchored element that can be used to display UI that will avoid overflowing the window bounds.
Implementations§
Source§impl Anchored
impl Anchored
Sourcepub fn anchor(self, anchor: Corner) -> Self
pub fn anchor(self, anchor: Corner) -> Self
Sets which corner of the anchored element should be anchored to the current position.
Sourcepub fn position(self, anchor: Point<Pixels>) -> Self
pub fn position(self, anchor: Point<Pixels>) -> Self
Sets the position in window coordinates (otherwise the location the anchored element is rendered is used)
Sourcepub fn offset(self, offset: Point<Pixels>) -> Self
pub fn offset(self, offset: Point<Pixels>) -> Self
Offset the final position by this amount. Useful when you want to anchor to an element but offset from it, such as in PopoverMenu.
Sourcepub fn position_mode(self, mode: AnchoredPositionMode) -> Self
pub fn position_mode(self, mode: AnchoredPositionMode) -> Self
Sets the position mode for this anchored element. Local will have this
interpret its Anchored::position as relative to the parent element.
While Window will have it interpret the position as relative to the window.
Sourcepub fn snap_to_window(self) -> Self
pub fn snap_to_window(self) -> Self
Snap to window edge instead of switching anchor corner when an overflow would occur.
Sourcepub fn snap_to_window_with_margin(self, edges: impl Into<Edges<Pixels>>) -> Self
pub fn snap_to_window_with_margin(self, edges: impl Into<Edges<Pixels>>) -> Self
Snap to window edge and leave some margins.
Trait Implementations§
Source§impl Element for Anchored
impl Element for Anchored
Source§type RequestLayoutState = AnchoredState
type RequestLayoutState = AnchoredState
Element::request_layout. A mutable reference to this state is subsequently
provided to Element::prepaint and Element::paint.Source§type PrepaintState = ()
type PrepaintState = ()
Element::prepaint. A mutable reference to this state is subsequently
provided to Element::paint.Source§fn id(&self) -> Option<ElementId>
fn id(&self) -> Option<ElementId>
Source§fn source_location(&self) -> Option<&'static Location<'static>>
fn source_location(&self) -> Option<&'static Location<'static>>
Source§fn request_layout(
&mut self,
_id: Option<&GlobalElementId>,
_inspector_id: Option<&InspectorElementId>,
window: &mut Window,
cx: &mut App,
) -> (LayoutId, Self::RequestLayoutState)
fn request_layout( &mut self, _id: Option<&GlobalElementId>, _inspector_id: Option<&InspectorElementId>, window: &mut Window, cx: &mut App, ) -> (LayoutId, Self::RequestLayoutState)
Source§fn prepaint(
&mut self,
_id: Option<&GlobalElementId>,
_inspector_id: Option<&InspectorElementId>,
bounds: Bounds<Pixels>,
request_layout: &mut Self::RequestLayoutState,
window: &mut Window,
cx: &mut App,
)
fn prepaint( &mut self, _id: Option<&GlobalElementId>, _inspector_id: Option<&InspectorElementId>, bounds: Bounds<Pixels>, request_layout: &mut Self::RequestLayoutState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn paint(
&mut self,
_id: Option<&GlobalElementId>,
_inspector_id: Option<&InspectorElementId>,
_bounds: Bounds<Pixels>,
_request_layout: &mut Self::RequestLayoutState,
_prepaint: &mut Self::PrepaintState,
window: &mut Window,
cx: &mut App,
)
fn paint( &mut self, _id: Option<&GlobalElementId>, _inspector_id: Option<&InspectorElementId>, _bounds: Bounds<Pixels>, _request_layout: &mut Self::RequestLayoutState, _prepaint: &mut Self::PrepaintState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn into_any(self) -> AnyElement
fn into_any(self) -> AnyElement
AnyElement.Source§impl IntoElement for Anchored
impl IntoElement for Anchored
Source§type Element = Anchored
type Element = Anchored
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl ParentElement for Anchored
impl ParentElement for Anchored
Source§fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>)
Source§fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
Source§fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for Anchored
impl !RefUnwindSafe for Anchored
impl !Send for Anchored
impl !Sync for Anchored
impl Unpin for Anchored
impl UnsafeUnpin for Anchored
impl !UnwindSafe for Anchored
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_cancellable_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> (AnimationElement<Self>, AnimationHandle)where
Self: Sized,
fn with_cancellable_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> (AnimationElement<Self>, AnimationHandle)where
Self: Sized,
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> 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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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