Trait composable::views::View

source ·
pub trait View: Sized {
Show 16 methods // Required methods fn size(&self) -> Size; fn draw(&self, bounds: Bounds, onto: &mut impl Output); // Provided methods fn event(&self, event: Event, offset: Point, bounds: Bounds) { ... } fn padding( self, top: f32, right: f32, bottom: f32, left: f32, ) -> Padding<Self> { ... } fn padding_top(self, pad: f32) -> Padding<Self> { ... } fn padding_right(self, pad: f32) -> Padding<Self> { ... } fn padding_bottom(self, pad: f32) -> Padding<Self> { ... } fn padding_left(self, pad: f32) -> Padding<Self> { ... } fn padding_horizontal(self, pad: f32) -> Padding<Self> { ... } fn padding_vertical(self, pad: f32) -> Padding<Self> { ... } fn padding_both(self, horizontal: f32, vertical: f32) -> Padding<Self> { ... } fn padding_all(self, pad: f32) -> Padding<Self> { ... } fn fixed(self, width: f32, height: f32) -> impl View { ... } fn width(self, width: f32) -> impl View { ... } fn height(self, height: f32) -> impl View { ... } fn across(self) -> impl View { ... }
}
Available on crate features unstable and views only.
Expand description

User interface element and modifiers to re-configure it.

Required Methods§

source

fn size(&self) -> Size

The intrinsic size of the View

source

fn draw(&self, bounds: Bounds, onto: &mut impl Output)

How the View is drawn

Provided Methods§

source

fn event(&self, event: Event, offset: Point, bounds: Bounds)

User-interface Event handling of the View

source

fn padding(self, top: f32, right: f32, bottom: f32, left: f32) -> Padding<Self>

Add padding to all sides of the View

source

fn padding_top(self, pad: f32) -> Padding<Self>

Add padding to the top of the View

source

fn padding_right(self, pad: f32) -> Padding<Self>

Add padding to the right side of the View

source

fn padding_bottom(self, pad: f32) -> Padding<Self>

Add padding to the bottom of the View

source

fn padding_left(self, pad: f32) -> Padding<Self>

Add padding to the left side of the View

source

fn padding_horizontal(self, pad: f32) -> Padding<Self>

Add padding to the horizontal sides of the View

source

fn padding_vertical(self, pad: f32) -> Padding<Self>

Add padding to the vertical sides of the View

source

fn padding_both(self, horizontal: f32, vertical: f32) -> Padding<Self>

Add different padding to the horizontal and vertical sides of the View

source

fn padding_all(self, pad: f32) -> Padding<Self>

Add the same padding to all sides of the View

source

fn fixed(self, width: f32, height: f32) -> impl View

Set the size of the View to a fixed value.

source

fn width(self, width: f32) -> impl View

source

fn height(self, height: f32) -> impl View

source

fn across(self) -> impl View

Causes a tuple of Views to cascade horizontally, rather than vertically.

§Note

For other views, nothing changes

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: View> View for Option<T>

source§

fn size(&self) -> Size

source§

fn event(&self, event: Event, offset: Point, bounds: Bounds)

source§

fn draw(&self, bounds: Bounds, onto: &mut impl Output)

source§

impl<T: View> View for Box<T>

source§

fn size(&self) -> Size

source§

fn event(&self, event: Event, offset: Point, bounds: Bounds)

source§

fn draw(&self, bounds: Bounds, onto: &mut impl Output)

source§

impl<T: View, E: View> View for Result<T, E>

source§

fn size(&self) -> Size

source§

fn event(&self, event: Event, offset: Point, bounds: Bounds)

source§

fn draw(&self, bounds: Bounds, onto: &mut impl Output)

Implementors§

source§

impl View for Spacer

source§

impl<V: View> View for Fixed<V>

source§

impl<V: View> View for FixedHeight<V>

source§

impl<V: View> View for FixedWidth<V>

source§

impl<V: View> View for Padding<V>