diff options
author | rabite <rabite@posteo.de> | 2019-02-12 22:55:16 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-02-12 22:55:16 +0100 |
commit | 56d9c3521599baef6ff1472c0c95fa07f17a5a67 (patch) | |
tree | 48f16edb6cc49a71bd9d438072f7c2d4848c3ac7 /src/miller_columns.rs | |
parent | 1c500d91cf7389850e9f32b14d8ae210a7e62888 (diff) |
async widget
Diffstat (limited to 'src/miller_columns.rs')
-rw-r--r-- | src/miller_columns.rs | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/miller_columns.rs b/src/miller_columns.rs index 4114326..66113c6 100644 --- a/src/miller_columns.rs +++ b/src/miller_columns.rs @@ -1,7 +1,7 @@ use termion::event::Key; use crate::coordinates::{Coordinates, Position, Size}; -use crate::preview::Previewer; +use crate::preview::AsyncPreviewer; use crate::widget::Widget; use crate::hbox::HBox; @@ -10,21 +10,21 @@ pub struct MillerColumns<T> where T: Widget { pub widgets: HBox<T>, // pub left: Option<T>, // pub main: Option<T>, - pub preview: Previewer, + pub preview: AsyncPreviewer, pub ratio: (u16, u16, u16), pub coordinates: Coordinates, } impl<T> MillerColumns<T> where - T: Widget, + T: Widget + PartialEq, { - pub fn new() -> Self { - Self { + pub fn new() -> MillerColumns<T> { + MillerColumns { widgets: HBox::new(), coordinates: Coordinates::new(), ratio: (20, 30, 50), - preview: Previewer::new(), + preview: AsyncPreviewer::new(), } } @@ -91,7 +91,6 @@ where if len < 2 { return None; } - self.widgets.widgets.get(len - 2)?.get_position(); self.widgets.widgets.get_mut(len - 2) } pub fn get_main_widget(&self) -> &T { @@ -105,19 +104,8 @@ where impl<T> Widget for MillerColumns<T> where T: Widget, + T: PartialEq { - fn get_size(&self) -> &Size { - &self.coordinates.size - } - fn get_position(&self) -> &Position { - &self.coordinates.position - } - fn set_size(&mut self, size: Size) { - self.coordinates.size = size; - } - fn set_position(&mut self, position: Position) { - self.coordinates.position = position; - } fn get_coordinates(&self) -> &Coordinates { &self.coordinates } |