[][src]Struct conrod_core::widget::canvas::Canvas

pub struct Canvas<'a> {
    pub common: CommonBuilder,
    pub style: Style,
    pub maybe_title_bar_label: Option<&'a str>,
    pub maybe_splits: Option<FlowOfSplits<'a>>,
}

Canvas is designed to be a "container"-like "parent" widget that simplifies placement of "children" widgets.

Widgets can be placed on a Canvas in a variety of ways using methods from the Positionable trait.

Canvas provides methods for padding the kid widget area which can make using the Place-related Positionable methods a little easier.

A Canvas can also be divided into a sequence of smaller Canvasses using the .flow_* methods. This creates a kind of Canvas tree, where each "split" can be sized using the .length or .length_weight methods.

See the canvas.rs example for a demonstration of the Canvas type.

Fields

common: CommonBuilder

Data necessary and common for all widget builder types.

style: Style

The builder data related to the style of the Canvas.

maybe_title_bar_label: Option<&'a str>

The label for the Canvas' TitleBar if there is one.

maybe_splits: Option<FlowOfSplits<'a>>

A list of child Canvasses as splits of this Canvas flowing in the given direction.

Implementations

impl<'a> Canvas<'a>[src]

pub fn new() -> Self[src]

Construct a new Canvas builder.

pub fn title_bar(self, title_bar: &'a str) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn pad_left(self, pad_left: Scalar) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn pad_right(self, pad_right: Scalar) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn pad_bottom(self, pad_bottom: Scalar) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn pad_top(self, pad_top: Scalar) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn with_style(self, with_style: Style) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn length(self, length: Scalar) -> Self[src]

Set the length of the Split as an absolute scalar.

pub fn length_weight(self, weight: Weight) -> Self[src]

Set the length of the Split as a weight.

The default length weight for each widget is 1.0.

pub fn flow_right(self, splits: ListOfSplits<'a>) -> Self[src]

Set the child Canvasses flowing to the right.

pub fn flow_left(self, splits: ListOfSplits<'a>) -> Self[src]

Set the child Canvasses flowing to the left.

pub fn flow_up(self, splits: ListOfSplits<'a>) -> Self[src]

Set the child Canvasses flowing upwards.

pub fn flow_down(self, splits: ListOfSplits<'a>) -> Self[src]

Set the child Canvasses flowing downwards.

pub fn pad(self, pad: Scalar) -> Self[src]

Set the padding for all edges of the area where child widgets will be placed.

pub fn padding(self, pad: Padding) -> Self[src]

Set the padding of the area where child widgets will be placed.

pub fn title_bar_color(self, color: Color) -> Self[src]

Set the color of the Canvas' TitleBar if it is visible.

Trait Implementations

impl<'a> Borderable for Canvas<'a>[src]

fn border(self, border: Scalar) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

fn border_color(self, border_color: Color) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a> Clone for Canvas<'a>[src]

impl<'a> Colorable for Canvas<'a>[src]

fn color(self, color: Color) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a> Common for Canvas<'a>[src]

impl<'a> Copy for Canvas<'a>[src]

impl<'a> Debug for Canvas<'a>[src]

impl<'a> Labelable<'a> for Canvas<'a>[src]

fn label_color(self, label_color: Color) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

fn label_font_size(self, label_font_size: FontSize) -> Self[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a> Widget for Canvas<'a>[src]

type State = State

State to be stored within the Uis widget cache. Read more

type Style = Style

Every widget is required to have its own associated Style type. This type is intended to contain high-level styling information for the widget that can be optionally specified by a user of the widget. Read more

type Event = ()

The type of event yielded by the widget, returned via the Widget::set function. Read more

fn drag_area(
    &self,
    dim: Dimensions,
    style: &Style,
    theme: &Theme
) -> Option<Rect>
[src]

The title bar area at which the Canvas can be clicked and dragged.

Note: the position of the returned Rect should be relative to the center of the widget.

fn kid_area(&self, args: KidAreaArgs<'_, Self>) -> KidArea[src]

The area of the widget below the title bar, upon which child widgets will be placed.

fn update(self, args: UpdateArgs<'_, '_, '_, '_, Self>)[src]

Update the state of the Canvas.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Canvas<'a>

impl<'a> Send for Canvas<'a>

impl<'a> Sync for Canvas<'a>

impl<'a> Unpin for Canvas<'a>

impl<'a> UnwindSafe for Canvas<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<W> Positionable for W where
    W: Widget
[src]

impl<W> Sizeable for W where
    W: Widget
[src]

fn get_x_dimension(&Self, &Ui) -> Dimension[src]

We attempt to retrieve the x Dimension for the widget via the following:

  • Check for specified value at maybe_x_dimension
  • Otherwise, use the default returned by Widget::default_x_dimension.

fn get_y_dimension(&Self, &Ui) -> Dimension[src]

We attempt to retrieve the y Dimension for the widget via the following:

  • Check for specified value at maybe_y_dimension
  • Otherwise, use the default returned by Widget::default_y_dimension.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.