Struct rustty_oxide::HorizontalLayout [] [src]

pub struct HorizontalLayout { /* fields omitted */ }

Hold buttons and align them horizontally for drawing within a Dialog

Examples

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

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 hlayout = HorizontalLayout::from_vec(buttons, 1);
hlayout.pack(&maindlg, HorizontalAlign::Middle, VerticalAlign::Bottom, (0,1));
     
maindlg.add_layout(hlayout);

Methods

impl HorizontalLayout
[src]

[src]

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

Examples

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

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 = HorizontalLayout::from_vec(v, 1);

Trait Implementations

impl Widget for HorizontalLayout
[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 HorizontalLayout
[src]

[src]

[src]