Yoda/src/browser/main/mod.rs
2024-09-23 16:03:39 +03:00

49 lines
785 B
Rust

mod tab;
mod widget;
use std::sync::Arc;
pub struct Main {
// Components
tab: Arc<tab::Tab>,
// Extras
widget: widget::Main,
}
impl Main {
// Construct
pub fn new() -> Arc<Main> {
// Init components
let tab = tab::Tab::new();
// Extras
let widget = widget::Main::new(tab.widget().notebook());
// Init struct
Arc::new(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) -> &widget::Main {
&self.widget
}
}