Yoda/src/browser/main/mod.rs

38 lines
614 B
Rust
Raw Normal View History

2024-09-20 18:02:10 +03:00
mod tab;
mod widget;
2024-09-18 20:33:29 +03:00
2024-09-23 01:57:16 +03:00
use std::sync::Arc;
2024-09-22 02:00:54 +03:00
pub struct Main {
widget: widget::Main,
tab: tab::Tab,
2024-09-22 02:00:54 +03:00
}
impl Main {
// Construct
2024-09-23 01:57:16 +03:00
pub fn new() -> Arc<Main> {
// Init components
2024-09-22 22:23:44 +03:00
let tab = tab::Tab::new();
// Init struct
2024-09-23 01:57:16 +03:00
Arc::new(Self {
2024-09-23 15:44:33 +03:00
widget: widget::Main::new(tab.widget().tab()), // @TODO
tab,
2024-09-23 01:57:16 +03:00
})
}
// Actions
2024-09-22 02:00:54 +03:00
pub fn tab_append(&self) {
self.tab.append(true);
}
2024-09-23 15:44:33 +03:00
pub fn tab_pin(&self) {
self.tab.pin();
}
// Getters
pub fn widget(&self) -> &widget::Main {
&self.widget
}
2024-09-20 18:02:10 +03:00
}