pub struct ClipperBuffer<'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> ClipperBuffer<'a>
impl<'a> ClipperBuffer<'a>
Sourcepub fn render_widget<W>(&mut self, widget: W, area: Rect)where
W: Widget,
pub fn render_widget<W>(&mut self, widget: W, area: Rect)where
W: Widget,
Render a widget to the temp buffer.
Sourcepub fn render_stateful<W, S>(&mut self, widget: W, area: Rect, state: &mut S)where
W: StatefulWidget<State = S>,
S: RelocatableState,
pub fn render_stateful<W, S>(&mut self, widget: W, area: Rect, state: &mut S)where
W: StatefulWidget<State = S>,
S: RelocatableState,
Render a widget to the temp buffer. This expects that the state is a RelocatableState, so it can reset the areas for hidden widgets.
Sourcepub fn render_widget_handle<W, Idx>(
&mut self,
widget: W,
area: AreaHandle,
tag: Idx,
)
pub fn render_widget_handle<W, Idx>( &mut self, widget: W, area: AreaHandle, tag: Idx, )
Render a widget to the temp buffer.
Sourcepub fn render_stateful_handle<W, S, Idx>(
&mut self,
widget: W,
area: AreaHandle,
tag: Idx,
state: &mut S,
)
pub fn render_stateful_handle<W, S, Idx>( &mut self, widget: W, area: AreaHandle, tag: Idx, state: &mut S, )
Render a widget to the temp buffer. This expects that the state is a RelocatableState, so it can reset the areas for hidden widgets.
Sourcepub fn layout(&self) -> &ClipperLayout
pub fn layout(&self) -> &ClipperLayout
Return the layout.
Sourcepub fn is_visible_area(&self, area: Rect) -> bool
pub fn is_visible_area(&self, area: Rect) -> bool
Is the given area visible?
Sourcepub fn is_visible_handle(&self, handle: AreaHandle) -> bool
pub fn is_visible_handle(&self, handle: AreaHandle) -> bool
Is any of the areas behind the handle visible?
Sourcepub fn locate_handle(&self, handle: AreaHandle) -> Box<[Rect]>
pub fn locate_handle(&self, handle: AreaHandle) -> Box<[Rect]>
Locate an area from layout coordinates to buffer coordinates for rendering.
Any sub-area may be None if it is outside the buffer.
These are still not screen coordinates as the buffer may be clipped into place.
Sourcepub fn locate_area(&self, area: Rect) -> Rect
pub fn locate_area(&self, area: Rect) -> Rect
Locate an area coordinates to buffer coordinates for rendering.
Sourcepub fn relocate<S>(&self, state: &mut S)where
S: RelocatableState,
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.
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 the mechanism for [relocate] to zero them out.
Sourcepub fn buffer_mut(&mut self) -> &mut Buffer
pub fn buffer_mut(&mut self) -> &mut Buffer
Access the temporary buffer.
Note Use of render_widget is preferred.
Sourcepub fn into_widget(self) -> ClipperWidget<'a>
pub fn into_widget(self) -> ClipperWidget<'a>
Rendering the content is finished.
Convert to the output widget that can be rendered in the target area.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ClipperBuffer<'a>
impl<'a> !RefUnwindSafe for ClipperBuffer<'a>
impl<'a> !Send for ClipperBuffer<'a>
impl<'a> !Sync for ClipperBuffer<'a>
impl<'a> Unpin for ClipperBuffer<'a>
impl<'a> !UnwindSafe for ClipperBuffer<'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