Yoda/src/browser/main/mod.rs
2024-09-23 18:51:48 +03:00

50 lines
795 B
Rust

mod tab;
use gtk::{Box, Orientation};
use tab::Tab;
use gtk::prelude::BoxExt;
pub struct Main {
tab: Tab,
widget: Box,
}
impl Main {
// Construct
pub fn new() -> Main {
// Init components
let tab = Tab::new();
// Extras
let widget = Box::builder().orientation(Orientation::Vertical).build();
widget.append(tab.widget());
// Init struct
Self { tab, widget }
}
// Actions
pub fn tab_append(&self) {
self.tab.append(true);
}
pub fn tab_close(&self) {
self.tab.close();
}
pub fn tab_close_all(&self) {
self.tab.close();
}
pub fn tab_pin(&self) {
self.tab.pin();
}
// Getters
pub fn widget(&self) -> &Box {
&self.widget
}
}