Struct nannou::ui::widget::canvas::Canvas[][src]

pub struct Canvas<'a> {
    pub common: CommonBuilder,
    pub style: Style,
    pub maybe_title_bar_label: Option<&'a str>,
    pub maybe_splits: Option<(Direction, &'a [(NodeIndex<u32>, Canvas<'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 CanvasTitleBar if there is one.

maybe_splits: Option<(Direction, &'a [(NodeIndex<u32>, Canvas<'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() -> Canvas<'a>[src]

Construct a new Canvas builder.

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

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

pub fn pad_left(self, pad_left: f64) -> Canvas<'a>[src]

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

pub fn pad_right(self, pad_right: f64) -> Canvas<'a>[src]

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

pub fn pad_bottom(self, pad_bottom: f64) -> Canvas<'a>[src]

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

pub fn pad_top(self, pad_top: f64) -> Canvas<'a>[src]

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

pub fn with_style(self, with_style: Style) -> Canvas<'a>[src]

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

pub fn length(self, length: f64) -> Canvas<'a>[src]

Set the length of the Split as an absolute scalar.

pub fn length_weight(self, weight: f64) -> Canvas<'a>[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: &'a [(NodeIndex<u32>, Canvas<'a>)]
) -> Canvas<'a>
[src]

Set the child Canvasses flowing to the right.

pub fn flow_left(self, splits: &'a [(NodeIndex<u32>, Canvas<'a>)]) -> Canvas<'a>[src]

Set the child Canvasses flowing to the left.

pub fn flow_up(self, splits: &'a [(NodeIndex<u32>, Canvas<'a>)]) -> Canvas<'a>[src]

Set the child Canvasses flowing upwards.

pub fn flow_down(self, splits: &'a [(NodeIndex<u32>, Canvas<'a>)]) -> Canvas<'a>[src]

Set the child Canvasses flowing downwards.

pub fn pad(self, pad: f64) -> Canvas<'a>[src]

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

pub fn padding(self, pad: Padding) -> Canvas<'a>[src]

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

pub fn title_bar_color(self, color: Color) -> Canvas<'a>[src]

Set the color of the CanvasTitleBar if it is visible.

Trait Implementations

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

pub fn border(self, border: f64) -> Canvas<'a>[src]

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

pub fn border_color(self, border_color: Color) -> Canvas<'a>[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]

pub fn color(self, color: Color) -> Canvas<'a>[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]

pub fn label_color(self, label_color: Color) -> Canvas<'a>[src]

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

pub fn label_font_size(self, label_font_size: u32) -> Canvas<'a>[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

pub fn drag_area(
    &self,
    dim: [f64; 2],
    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.

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

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

pub fn update(self, args: UpdateArgs<'_, '_, '_, '_, Canvas<'a>>)[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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    T: Component + Float,
    D: AdaptFrom<S, Swp, Dwp, T>,
    Swp: WhitePoint,
    Dwp: WhitePoint
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> Downcast<T> for T

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

impl<T> Instrument for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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

impl<T> SetParameter for T

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

pub fn get_x_dimension(&self, ui: &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.

pub fn get_y_dimension(&self, ui: &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.

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,