From 2b26e8a70914f62147d445ef1defff3b1501ae56 Mon Sep 17 00:00:00 2001 From: Hannes Kuchelmeister Date: Mon, 24 Jan 2022 11:06:38 +0100 Subject: [PATCH] add bottom toolbar --- src/main.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8972b2b..72f6f97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,10 @@ use adw::prelude::*; use gtk::prelude::*; -use adw::{ApplicationWindow, HeaderBar}; -use gtk::{Adjustment, Application, Box, Image, Orientation, Scale}; +use adw::{ApplicationWindow, HeaderBar, SplitButton}; +use gtk::{ + ActionBar, Adjustment, Application, Box, Button, Image, Orientation, Scale, ToggleButton, +}; const MARGIN_TOP: i32 = 32; const MARGIN_BOTTOM: i32 = 32; @@ -76,12 +78,35 @@ fn main() { .title_widget(&adw::WindowTitle::new("First App", "")) .build(); + // TODO: add button functionality + let open_button = SplitButton::builder().label("Open").build(); + header_bar.pack_start(&open_button); + // Combine the content in a box let title_widget_content = Box::new(Orientation::Vertical, 0); // Adwaitas' ApplicationWindow does not include a HeaderBar + /*let bottom_toolbar_widget = Box::builder() + .orientation(Orientation::Horizontal) + .css_classes(vec!["toolbox".to_string()]) + .halign(gtk::Align::End) + //.margin_top(MARGIN_TOP / 2) + .margin_bottom(MARGIN_BOTTOM / 2) + .build();*/ + + let bottom_toolbar_widget = ActionBar::builder().build(); + + // TODO: add functionality + let focus_button = Button::builder().label("Set Focus").build(); + + let neighbour_toggle_button = ToggleButton::builder().label("Toggle Neighbours").build(); + + bottom_toolbar_widget.pack_start(&neighbour_toggle_button); + bottom_toolbar_widget.pack_end(&focus_button); + title_widget_content.append(&header_bar); title_widget_content.append(&content); + title_widget_content.append(&bottom_toolbar_widget); let window = ApplicationWindow::builder() .application(app)