Struct elmesque::element::Element [−] [src]

pub struct Element {
    pub props: Properties,
    pub element: Prim,
}

Graphical elements that snap together to build complex widgets and layouts.

Each element is a rectangle with a known width and height, making them easy to combine and position.

Fields

props
element

Methods

impl Element

fn width(self, new_width: i32) -> Element

Create an Element with a given width.

fn height(self, new_height: i32) -> Element

Create an Element with a given height.

fn size(self, new_w: i32, new_h: i32) -> Element

Create an Element with a given size.

fn opacity(self, opacity: f32) -> Element

Create an Element with a given opacity.

fn color(self, color: Color) -> Element

Create an `Element with a given background color.

fn container(self, w: i32, h: i32, pos: Position) -> Element

Put an element in a container. This lets you position the element really easily, and there are tons of ways to set the Position.

fn clear(self, color: Color) -> Element

Put an element in a cleared wrapper. The color provided will be the color that clears the screen before rendering the contained element.

fn above(self, other: Element) -> Element

Stack elements vertically. To put a above b you would say: a.above(b)

fn below(self, other: Element) -> Element

Stack elements vertically. To put a below b you would say: a.below(b)

fn beside(self, other: Element) -> Element

Put elements beside each other horizontally. To put b to the right of a you would say: a.beside(b)

fn get_width(&self) -> i32

Return the width of the Element.

fn get_height(&self) -> i32

Return the height of the Element.

fn get_size(&self) -> (i32, i32)

Return the size of the Element's bounding rectangle.

fn draw<'a, C, G>(&self, renderer: &mut Renderer<'a, C, G>) where C: CharacterCache, G: Graphics<Texture=C>

Draw the form with some given graphics backend.

fn is_over(&self, x: i32, y: i32) -> bool

Return whether or not a point is over the element.

Trait Implementations

Derived Implementations

impl Debug for Element

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for Element

fn clone(&self) -> Element

fn clone_from(&mut self, source: &Self)