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]
fn from_vec(widgets: Vec<Box<Button>>, inner_margin: usize) -> HorizontalLayout
[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]
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