mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-16 09:40:01 +00:00
49 lines
785 B
Rust
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
|
|
}
|
|
}
|