pub struct ViewBuffer<'a> { /* private fields */ }Expand description
Render to the temp buffer.
- It maps your widget area from layout coordinates to screen coordinates before rendering.
- It helps with cleanup of the widget state if your widget is currently invisible.
Implementations§
Source§impl<'a> ViewBuffer<'a>
impl<'a> ViewBuffer<'a>
Sourcepub fn render_widget<W>(&mut self, widget: W, area: Rect) -> boolwhere
W: Widget,
pub fn render_widget<W>(&mut self, widget: W, area: Rect) -> boolwhere
W: Widget,
Render a widget to the temp buffer.
Sourcepub fn render<W, S>(&mut self, widget: W, area: Rect, state: &mut S) -> boolwhere
W: StatefulWidget<State = S>,
S: RelocatableState,
pub fn render<W, S>(&mut self, widget: W, area: Rect, state: &mut S) -> boolwhere
W: StatefulWidget<State = S>,
S: RelocatableState,
Render a widget to the temp buffer. This expects that the state is a RelocatableState.
Sourcepub fn render_popup<W, S>(
&mut self,
widget: W,
area: Rect,
state: &mut S,
) -> boolwhere
W: StatefulWidget<State = S>,
S: RelocatableState,
pub fn render_popup<W, S>(
&mut self,
widget: W,
area: Rect,
state: &mut S,
) -> boolwhere
W: StatefulWidget<State = S>,
S: RelocatableState,
Render an additional popup widget for the given main widget.
Doesn’t call relocate().
Sourcepub fn is_visible_area(&self, area: Rect) -> bool
pub fn is_visible_area(&self, area: Rect) -> bool
Is this area inside the buffer area.
Sourcepub fn shift(&self) -> (i16, i16)
👎Deprecated since 2.0.0: should not be public. use relocate2() instead.
pub fn shift(&self) -> (i16, i16)
Calculate the necessary shift from view to screen.
Sourcepub fn locate_area(&self, area: Rect) -> Rect
👎Deprecated since 2.0.0: wrong api, use is_visible_area() or locate_area2()
pub fn locate_area(&self, area: Rect) -> Rect
Does nothing for view. Only exists to match Clipper.
Sourcepub fn locate_area2(&self, area: Rect) -> Option<Rect>
pub fn locate_area2(&self, area: Rect) -> Option<Rect>
Validates that this area is inside the buffer area.
Sourcepub fn relocate<S>(&self, state: &mut S)where
S: RelocatableState,
👎Deprecated since 2.0.0: wrong api, use relocate2() instead
pub fn relocate<S>(&self, state: &mut S)where
S: RelocatableState,
After rendering the widget to the buffer it may have stored areas in its state. These will be in buffer coordinates instead of screen coordinates.
Call this function to correct this after rendering.
Sourcepub fn relocate2<S>(&self, area: Rect, state: &mut S)where
S: RelocatableState,
pub fn relocate2<S>(&self, area: Rect, state: &mut S)where
S: RelocatableState,
After rendering the widget to the buffer it may have stored areas in its state. These will be in buffer coordinates instead of screen coordinates.
Call this function to correct this after rendering.
👎Deprecated since 2.0.0: bad api, use relocate2() instead
If a widget is not rendered because it is out of the buffer area, it may still have left over areas in its state.
This uses relocate_hidden to zero them out.
Sourcepub fn buffer(&mut self) -> &mut Buffer
pub fn buffer(&mut self) -> &mut Buffer
Access the temporary buffer.
Note Use of render_widget is preferred.
Sourcepub fn into_widget(self) -> ViewWidget<'a>
👎Deprecated since 2.3.0: use finish() instead
pub fn into_widget(self) -> ViewWidget<'a>
Rendering the content is finished.
Convert to the output widget that can be rendered in the target area.
Trait Implementations§
Source§impl<'a> Debug for ViewBuffer<'a>
impl<'a> Debug for ViewBuffer<'a>
Auto Trait Implementations§
impl<'a> Freeze for ViewBuffer<'a>
impl<'a> RefUnwindSafe for ViewBuffer<'a>
impl<'a> Send for ViewBuffer<'a>
impl<'a> Sync for ViewBuffer<'a>
impl<'a> Unpin for ViewBuffer<'a>
impl<'a> UnwindSafe for ViewBuffer<'a>
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> 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