[−][src]Trait termcandy::Widget
A Widget
is a Future
that can be drawn.
The easiest way to create widgets is using the #[widget]
attribute.
Required methods
fn draw<'s, 'm>(&self, surface: &'m mut SurfaceMut<'s>)
Draw the widget to the given surface.
Provided methods
fn map_events<M: Fn(Event) -> Option<Event>>(self, map: M) -> MapEvents<Self, M> where
Self: Sized,
M: Fn(Event) -> Option<Event> + Sync + Send,
Self: Sized,
M: Fn(Event) -> Option<Event> + Sync + Send,
Filter and map all user input events arriving at the widget.
fn resize<M: Fn(u16, u16) -> Rect>(self, map: M) -> Resize<Self, M> where
Self: Sized,
M: Fn(u16, u16) -> Rect + Sync + Send,
Self: Sized,
M: Fn(u16, u16) -> Rect + Sync + Send,
Resize the widget to the given region calculated from the width and height of the screen.
The widget will draw itself to the region you calculate, the position of mouse-click
events will be mapped accordingly, and widget::screen_size()
will report the given region
when called from inside the widget.
Implementations on Foreign Types
impl<'a, W> Widget for &'a mut W where
W: Widget,
[src]
W: Widget,
fn draw<'s, 'm>(&self, surface: &'m mut SurfaceMut<'s>)
[src]
fn map_events<M: Fn(Event) -> Option<Event>>(self, map: M) -> MapEvents<Self, M> where
Self: Sized,
M: Fn(Event) -> Option<Event> + Sync + Send,
[src]
Self: Sized,
M: Fn(Event) -> Option<Event> + Sync + Send,
fn resize<M: Fn(u16, u16) -> Rect>(self, map: M) -> Resize<Self, M> where
Self: Sized,
M: Fn(u16, u16) -> Rect + Sync + Send,
[src]
Self: Sized,
M: Fn(u16, u16) -> Rect + Sync + Send,