use gtk4::prelude::*;
use gtk4::{Application, ApplicationWindow, Box as GtkBox, Entry, Label, Orientation, Stack};
#[derive(Clone)]
pub struct Ui {
pub window: ApplicationWindow,
pub stack: Stack,
pub tabbar: Label,
pub statusbar: Label,
pub completion: GtkBox,
pub commandline: Entry,
}
impl Ui {
pub fn build(app: &Application) -> Ui {
let window = ApplicationWindow::builder()
.application(app)
.default_width(1200)
.default_height(800)
.title("qbrsh")
.build();
let vbox = GtkBox::new(Orientation::Vertical, 0);
let tabbar = Label::new(None);
tabbar.set_xalign(0.0);
tabbar.set_widget_name("qbrsh-tabbar");
let stack = Stack::new();
stack.set_vexpand(true);
stack.set_hexpand(true);
let statusbar = Label::new(None);
statusbar.set_xalign(0.0);
statusbar.set_widget_name("qbrsh-status");
let completion = GtkBox::new(Orientation::Vertical, 0);
completion.set_visible(false);
completion.set_widget_name("qbrsh-completion");
let commandline = Entry::new();
commandline.set_visible(false);
commandline.set_widget_name("qbrsh-cmd");
vbox.append(&tabbar);
vbox.append(&stack);
vbox.append(&completion);
vbox.append(&statusbar);
vbox.append(&commandline);
window.set_child(Some(&vbox));
Ui {
window,
stack,
tabbar,
statusbar,
completion,
commandline,
}
}
}