diff options
author | rabite <rabite@posteo.de> | 2019-01-21 17:47:58 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-01-21 17:47:58 +0100 |
commit | 8ad1b657ec3d20bab2199b33a22ff9a191dfe58d (patch) | |
tree | 9cf9d11a7f40060c0a5ceb8b72c9577f443b5614 /src/hbox.rs | |
parent | 724cc61680e14d45fb7c0e5ebac525b71e7a1381 (diff) |
got file sizes working in listview
Diffstat (limited to 'src/hbox.rs')
-rw-r--r-- | src/hbox.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/hbox.rs b/src/hbox.rs index 7013b2b..9c9c900 100644 --- a/src/hbox.rs +++ b/src/hbox.rs @@ -17,12 +17,15 @@ pub struct HBox { } impl HBox { - pub fn new(widgets: Vec<Box<Widget>>) -> HBox { + pub fn new(widgets: Vec<Box<Widget>>, + dimensions: (u16, u16), + position: (u16, u16), + main: usize) -> HBox { HBox { - dimensions: (100, 100), - position: (1, 1), + dimensions: dimensions, + position: position, children: widgets, - main: 0 + main: main } } } @@ -30,7 +33,7 @@ impl HBox { impl Widget for HBox { fn render(&self) -> Vec<String> { // HBox doesnt' draw anything itself - vec![] + vec![] } fn render_header(&self) -> String { @@ -55,6 +58,13 @@ impl Widget for HBox { fn get_position(&self) -> (u16, u16) { self.position } + fn set_dimensions(&mut self, size: (u16, u16)) { + self.dimensions = size; + } + fn set_position(&mut self, position: (u16, u16)) { + self.position = position; + } + fn on_event(&mut self, event: Event) { self.children[self.main].on_event(event); |