Trait embedded_layout::View

source ·
pub trait View {
    // Required methods
    fn translate_impl(&mut self, by: Point);
    fn bounds(&self) -> Rectangle;

    // Provided methods
    fn size(&self) -> Size { ... }
    fn translate_mut(&mut self, by: Point) -> &mut Self
       where Self: Sized { ... }
    fn translate(self, by: Point) -> Self
       where Self: Sized { ... }
}
Expand description

A View is the base unit for most of the embedded-layout operations.

Views must have a size and a position.

See the custom_view example for how you can define more complex views.

Required Methods§

source

fn translate_impl(&mut self, by: Point)

Object-safe version of translate_mut().

The default implementations of translate and translate_mut both call this functions.

source

fn bounds(&self) -> Rectangle

Returns the bounding box of the View as a Rectangle

Provided Methods§

source

fn size(&self) -> Size

Get the size of a View.

source

fn translate_mut(&mut self, by: Point) -> &mut Selfwhere Self: Sized,

Move the origin of an object by a given number of (x, y) pixels, mutating the object in place.

If you a looking for a method to implement, you might want translate_impl() instead.

source

fn translate(self, by: Point) -> Selfwhere Self: Sized,

Move the origin of an object by a given number of (x, y) pixels, returning a new object.

If you a looking for a method to implement, you might want translate_impl() instead.

Implementors§

source§

impl View for EmptyViewGroup

source§

impl<LD, VG> View for LinearLayout<LD, VG>where LD: Orientation, VG: ViewGroup,

source§

impl<T> View for Views<'_, T>where T: View,

source§

impl<T> View for Twhere T: Transform + Dimensions,

source§

impl<V> View for Chain<V>where V: View,

source§

impl<V, VC> View for Link<V, VC>where V: View, VC: View + ChainElement,