Struct rustty_oxide::VerticalLayout [] [src]

pub struct VerticalLayout { /* fields omitted */ }

Hold buttons and align them vertically for drawing within a Dialog

Examples

use oxide::core::{HorizontalAlign, VerticalAlign, ButtonResult, Button, Widget};
use oxide::{Dialog, StdButton, VerticalLayout};

let mut maindlg = Dialog::new(60, 10);

let b1 = StdButton::new("Quit", 'q', ButtonResult::Ok);
let b2 = StdButton::new("Foo!", 'f', ButtonResult::Custom(1));
let b3 = StdButton::new("Bar!", 'b', ButtonResult::Custom(2));

let buttons = vec![b1, b2, b3].into_iter().map(Box::new);
let buttons = buttons.map(|x| x as Box<Button>).collect();

let mut vlayout = VerticalLayout::from_vec(buttons, 1);
vlayout.pack(&maindlg, HorizontalAlign::Middle, VerticalAlign::Bottom, (0,1));
     
maindlg.add_layout(vlayout);

Methods

impl VerticalLayout
[src]

[src]

Construct a VerticalLayout object from a vector of boxed objects that implement Button. The current API for this function will change very soon

Examples

use oxide::core::{Button, ButtonResult};
use oxide::{StdButton, VerticalLayout};

let b1 = StdButton::new("Quit", 'q', ButtonResult::Ok);
let b2 = StdButton::new("Foo!", 'f', ButtonResult::Custom(1));
let b3 = StdButton::new("Bar!", 'b', ButtonResult::Custom(2));

let v = vec![b1, b2, b3].into_iter().map(Box::new).map(|x| x as Box<Button>).collect();
let mut hlayout = VerticalLayout::from_vec(v, 1);

Trait Implementations

impl Widget for VerticalLayout
[src]

[src]

Draws the widget to the valid CellAccessor passed

[src]

Aligns the widget with the parent as reference

[src]

Expose the painter trait draw_box for all widgets, which outlines the space enclosed within the widget Read more

[src]

Resize the given widget to new dimensions given by Size

[src]

Return a reference the renderer, Base in general cases

[src]

Return a mutable reference to the renderer, Base in general cases

impl Layout for VerticalLayout
[src]

[src]

[src]