From 7157ce3790af718359dc2aaa089cc6fc843284b7 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Mon, 25 Jun 2018 21:47:06 +0530 Subject: Begin work on article stack view --- src/main.rs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index aa10691..a3cc713 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,15 @@ use content::*; fn main() { // Initial setup let mut main = Cursive::default(); + let mut articles_vec = vec![]; main.add_global_callback('q', |s| s.quit()); main.add_global_callback('s', |s| search(s)); main.add_global_callback('t', |s| match s.pop_layer() { - _ => () - }); + Some(_) => (), + None => s.add_layer( Dialog::text("Stack is empty!") + .title("Error") + )}); main.run(); } @@ -69,11 +72,19 @@ fn on_submit(s: &mut Cursive, name: &String) { Err(e) => pop_error(s, handler(e)) }; - s.add_layer( - LinearLayout::vertical() - .child(TextView::new(heading).h_align(HAlign::Center)) - .child(DummyView.fixed_height(1)) - .child(TextView::new(extract) - .fixed_width(85)) - ); + let article_stack = LinearLayout::horizontal() + .child(TextView::new("Stack")) + .child(DummyView.fixed_height(1)); + + s.add_layer(Dialog::around( + LinearLayout::horizontal() + .child( + LinearLayout::vertical() + .child(TextView::new(heading).h_align(HAlign::Center)) + .child(DummyView.fixed_height(1)) + .child(TextView::new(extract)) + ) + .child(article_stack) + ) + ); } -- cgit v1.2.3