pub struct Placed<W: Widget> { /* private fields */ }Expand description
A retained widget laid out and painted where the page puts it. Only a widget placed in view this frame takes input or answers for what is under the pointer.
Implementations§
Source§impl<W: Widget + 'static> Placed<W>
impl<W: Widget + 'static> Placed<W>
pub fn new(widget: W) -> Self
pub fn widget(&self) -> &W
pub fn widget_mut(&mut self) -> &mut W
Sourcepub fn visible_mut(&mut self) -> Option<&mut W>
pub fn visible_mut(&mut self) -> Option<&mut W>
The widget, while it is placed in view.
pub fn layout(&mut self, rect: Rect, ctx: &mut PaintCtx<'_>) -> f64
Sourcepub fn draw(&mut self, ctx: &mut PaintCtx<'_>, clip: Rect)
pub fn draw(&mut self, ctx: &mut PaintCtx<'_>, clip: Rect)
Paint the laid-out widget inside clip (the page’s viewport) and
count it as placed.
Sourcepub fn place(
&mut self,
ctx: &mut PaintCtx<'_>,
(left, right): (f64, f64),
top: f64,
clip: Rect,
) -> f64
pub fn place( &mut self, ctx: &mut PaintCtx<'_>, (left, right): (f64, f64), top: f64, clip: Rect, ) -> f64
Lay the widget out from top across [left, right] and paint it
where it meets clip. Returns the y below it.
Sourcepub fn handle_event(&mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>)
pub fn handle_event(&mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>)
Route one window event to the widget; one out of view takes none.
pub fn tooltip_at(&self, point: Point) -> Option<String>
Auto Trait Implementations§
impl<W> Freeze for Placed<W>
impl<W> !RefUnwindSafe for Placed<W>
impl<W> !Send for Placed<W>
impl<W> !Sync for Placed<W>
impl<W> Unpin for Placed<W>
impl<W> UnsafeUnpin for Placed<W>
impl<W> !UnwindSafe for Placed<W>
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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§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>
Converts
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>
Converts
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