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]
fn from_vec(widgets: Vec<Box<Button>>, inner_margin: usize) -> VerticalLayout
[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]
fn draw(&mut self, parent: &mut CellAccessor)
[src]
Draws the widget to the valid CellAccessor
passed
fn pack(
&mut self,
parent: &HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize)
)
[src]
&mut self,
parent: &HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize)
)
Aligns the widget with the parent
as reference
fn draw_box(&mut self)
[src]
Expose the painter trait draw_box
for all widgets, which outlines the space enclosed within the widget Read more
fn resize(&mut self, new_size: Size)
[src]
Resize the given widget to new dimensions given by Size
fn frame(&self) -> &Frame
[src]
Return a reference the renderer, Base
in general cases
fn frame_mut(&mut self) -> &mut Frame
[src]
Return a mutable reference to the renderer, Base
in general cases