pub struct TooltipPositioner { /* private fields */ }Expand description
An unstyled element that positions its children as an anchored popup.
This owns measurement, side selection, alignment, and viewport clamping. It installs no presentation of its own and adds no wrapper element around its children.
Implementations§
Source§impl Positioner
impl Positioner
Sourcepub fn side(trigger_bounds: Bounds<Pixels>) -> Positioner
pub fn side(trigger_bounds: Bounds<Pixels>) -> Positioner
Places the popup on a side of trigger_bounds, flipping when needed.
Sourcepub fn corner(anchor: Anchor, position: Point<Pixels>) -> Positioner
pub fn corner(anchor: Anchor, position: Point<Pixels>) -> Positioner
Places anchor’s corner of the popup at position.
This is the corner-anchoring path used by triggers that were written
against GPUI’s anchored element. It clamps into the viewport without
changing the requested anchor.
Sourcepub fn position(self, position: Point<Pixels>) -> Positioner
pub fn position(self, position: Point<Pixels>) -> Positioner
Updates the requested corner position.
This is useful when an animation moves an already-composed popup. It has no effect on a side-positioned popup.
Sourcepub fn placement(self, placement: Placement) -> Positioner
pub fn placement(self, placement: Placement) -> Positioner
Sets the preferred side. Only meaningful for Positioner::side.
Sourcepub fn align(self, align: Align) -> Positioner
pub fn align(self, align: Align) -> Positioner
Sets the alignment along the chosen side. Only meaningful for
Positioner::side.
Sourcepub fn offset(self, offset: Pixels) -> Positioner
pub fn offset(self, offset: Pixels) -> Positioner
Sets the gap between the trigger and the popup. Only meaningful for
Positioner::side.
Sourcepub fn on_position(
self,
callback: impl Fn(ResolvedPosition) + 'static,
) -> Positioner
pub fn on_position( self, callback: impl Fn(ResolvedPosition) + 'static, ) -> Positioner
Observe resolved geometry before children prepaint.
Sourcepub fn occlude(self) -> Positioner
pub fn occlude(self) -> Positioner
Blocks the mouse over the positioned popup.
Off by default, because a tooltip that swallowed the pointer would un-hover the very trigger keeping it open. An interactive surface — a popover, a menu, a dropdown — wants it on: what the surface covers is the surface’s, not the panel underneath.
Sourcepub fn margin(self, margin: Pixels) -> Positioner
pub fn margin(self, margin: Pixels) -> Positioner
Sets the minimum distance kept between the popup and the viewport edge.
Trait Implementations§
Source§impl Element for Positioner
impl Element for Positioner
Source§type RequestLayoutState = PositionerState
type RequestLayoutState = PositionerState
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,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
window: &mut Window,
cx: &mut App,
) -> (LayoutId, <Positioner as Element>::RequestLayoutState)
fn request_layout( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, window: &mut Window, cx: &mut App, ) -> (LayoutId, <Positioner as Element>::RequestLayoutState)
Source§fn prepaint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
bounds: Bounds<Pixels>,
request_layout: &mut <Positioner as Element>::RequestLayoutState,
window: &mut Window,
cx: &mut App,
)
fn prepaint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, bounds: Bounds<Pixels>, request_layout: &mut <Positioner as Element>::RequestLayoutState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn paint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
_: Bounds<Pixels>,
_: &mut <Positioner as Element>::RequestLayoutState,
_: &mut <Positioner as Element>::PrepaintState,
window: &mut Window,
cx: &mut App,
)
fn paint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, _: Bounds<Pixels>, _: &mut <Positioner as Element>::RequestLayoutState, _: &mut <Positioner as Element>::PrepaintState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn a11y_role(&self) -> Option<Role>
fn a11y_role(&self) -> Option<Role>
None are not included in the accessibility tree. Read moreSource§fn write_a11y_info(&self, _node: &mut Node)
fn write_a11y_info(&self, _node: &mut Node)
a11y_role() returns Some. Read moreSource§fn a11y_synthetic_children(
&mut self,
_prepaint: &mut Self::PrepaintState,
_builder: &mut A11ySubtreeBuilder<'_>,
)
fn a11y_synthetic_children( &mut self, _prepaint: &mut Self::PrepaintState, _builder: &mut A11ySubtreeBuilder<'_>, )
Source§fn into_any(self) -> AnyElement
fn into_any(self) -> AnyElement
AnyElement.Source§impl IntoElement for Positioner
Available on non-crate feature gpui-fast only.
impl IntoElement for Positioner
gpui-fast only.Source§type Element = Positioner
type Element = Positioner
Source§fn into_element(self) -> <Positioner as IntoElement>::Element
fn into_element(self) -> <Positioner as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl ParentElement for Positioner
impl ParentElement for Positioner
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 !RefUnwindSafe for Positioner
impl !Send for Positioner
impl !Sync for Positioner
impl !UnwindSafe for Positioner
impl Forget for Positioner
impl Freeze for Positioner
impl Move for Positioner
impl Unpin for Positioner
impl UnsafeUnpin for Positioner
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_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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> ElementExt for Twhere
T: ParentElement,
impl<T> ElementExt for Twhere
T: ParentElement,
Source§fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
Source§fn keep_text_selection(self, id: impl Into<ElementId>) -> Self
fn keep_text_selection(self, id: impl Into<ElementId>) -> Self
id must be unique among this
element’s children. Works inside a cached view. Read moreimpl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.