diff --git a/src/vec.rs b/src/vec.rs index 98bb8e3..c6654f7 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -88,7 +88,7 @@ impl XY { } /// Returns a new `Vec2` with the axis `o` set to `value`. - pub fn with(&self, o: Orientation, value: usize) -> Self { + pub fn with_axis(&self, o: Orientation, value: usize) -> Self { let mut other = *self; *o.get_ref(&mut other) = value; other diff --git a/src/view/linear_layout.rs b/src/view/linear_layout.rs index afe1d6d..97dcd68 100644 --- a/src/view/linear_layout.rs +++ b/src/view/linear_layout.rs @@ -222,7 +222,7 @@ impl View for LinearLayout { // Ok, so maybe it didn't. // Budget cuts, everyone. - let budget_req = req.with(self.orientation, 1); + let budget_req = req.with_axis(self.orientation, 1); // println_stderr!("Budget req: {:?}", budget_req); // See how they like it that way @@ -288,7 +288,7 @@ impl View for LinearLayout { .map(|v| self.orientation.get(v)) .zip(allocations.iter()) .map(|(a, b)| a + b) - .map(|l| req.with(self.orientation, l)) + .map(|l| req.with_axis(self.orientation, l)) .collect(); // println_stderr!("Final sizes: {:?}", final_lengths); diff --git a/src/view/progress_bar.rs b/src/view/progress_bar.rs index 34ce9a0..d4a4fd3 100644 --- a/src/view/progress_bar.rs +++ b/src/view/progress_bar.rs @@ -3,7 +3,9 @@ use std::sync::{Arc, Mutex}; use std::sync::atomic::{AtomicUsize, Ordering}; use {Cursive, Printer}; +use vec::Vec2; use align::HAlign; +use direction::Orientation; use event::*; use theme::{ColorStyle, Effect}; use view::View; @@ -139,4 +141,8 @@ impl View for ProgressBar { EventResult::Ignored } + + fn get_min_size(&mut self, size: Vec2) -> Vec2 { + size.with_axis(Orientation::Vertical, 1) + } }