mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
ProgressBar takes all given width
This commit is contained in:
parent
2e5262096a
commit
04f961657f
@ -88,7 +88,7 @@ impl XY<usize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a new `Vec2` with the axis `o` set to `value`.
|
/// 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;
|
let mut other = *self;
|
||||||
*o.get_ref(&mut other) = value;
|
*o.get_ref(&mut other) = value;
|
||||||
other
|
other
|
||||||
|
@ -222,7 +222,7 @@ impl View for LinearLayout {
|
|||||||
|
|
||||||
// Ok, so maybe it didn't.
|
// Ok, so maybe it didn't.
|
||||||
// Budget cuts, everyone.
|
// 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);
|
// println_stderr!("Budget req: {:?}", budget_req);
|
||||||
|
|
||||||
// See how they like it that way
|
// See how they like it that way
|
||||||
@ -288,7 +288,7 @@ impl View for LinearLayout {
|
|||||||
.map(|v| self.orientation.get(v))
|
.map(|v| self.orientation.get(v))
|
||||||
.zip(allocations.iter())
|
.zip(allocations.iter())
|
||||||
.map(|(a, b)| a + b)
|
.map(|(a, b)| a + b)
|
||||||
.map(|l| req.with(self.orientation, l))
|
.map(|l| req.with_axis(self.orientation, l))
|
||||||
.collect();
|
.collect();
|
||||||
// println_stderr!("Final sizes: {:?}", final_lengths);
|
// println_stderr!("Final sizes: {:?}", final_lengths);
|
||||||
|
|
||||||
|
@ -3,7 +3,9 @@ use std::sync::{Arc, Mutex};
|
|||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
use {Cursive, Printer};
|
use {Cursive, Printer};
|
||||||
|
use vec::Vec2;
|
||||||
use align::HAlign;
|
use align::HAlign;
|
||||||
|
use direction::Orientation;
|
||||||
use event::*;
|
use event::*;
|
||||||
use theme::{ColorStyle, Effect};
|
use theme::{ColorStyle, Effect};
|
||||||
use view::View;
|
use view::View;
|
||||||
@ -139,4 +141,8 @@ impl View for ProgressBar {
|
|||||||
|
|
||||||
EventResult::Ignored
|
EventResult::Ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_min_size(&mut self, size: Vec2) -> Vec2 {
|
||||||
|
size.with_axis(Orientation::Vertical, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user