Struct cursive::views::Canvas [] [src]

pub struct Canvas<T> { /* fields omitted */ }

A blank view that forwards calls to closures.

You can use this view to easily draw your own interface.

Methods

impl<T: 'static + View> Canvas<T>
[src]

[src]

Creates a new Canvas around the given view.

By default, forwards all calls to the inner view.

impl<T> Canvas<T>
[src]

[src]

Creates a new, empty Canvas.

Examples

let canvas = Canvas::new(())
                    .with_draw(|printer, _| {
                        // Print the view
                    });

[src]

Gets a mutable reference to the inner state.

[src]

Sets the closure for draw(&Printer).

[src]

Sets the closure for draw(&Printer).

Chainable variant.

[src]

Sets the closure for on_event(Event).

[src]

Sets the closure for on_event(Event).

Chainable variant.

[src]

Sets the closure for required_size(Vec2).

[src]

Sets the closure for required_size(Vec2).

Chainable variant.

[src]

Sets the closure for layout(Vec2).

[src]

Sets the closure for layout(Vec2).

Chainable variant.

[src]

Sets the closure for take_focus(Direction).

[src]

Sets the closure for take_focus(Direction).

Chainable variant.

[src]

Sets the closure for needs_relayout().

[src]

Sets the closure for needs_relayout().

Chainable variant.

Trait Implementations

impl<T> View for Canvas<T>
[src]

[src]

Draws the view with the given printer (includes bounds) and focus.

[src]

Called when a key was pressed. Read more

[src]

Returns the minimum size the view requires with the given restrictions. Read more

[src]

Called once the size for this view has been decided, Read more

[src]

This view is offered focus. Will it take it? Read more

[src]

Returns true if the view content changed since last layout phase. Read more

[src]

Runs a closure on the view identified by the given selector. Read more

[src]

Moves the focus to the view identified by the given selector. Read more