2024-09-20 18:02:10 +03:00
|
|
|
mod tab;
|
2024-09-22 18:50:47 +03:00
|
|
|
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 {
|
2024-09-23 15:56:09 +03:00
|
|
|
// Components
|
|
|
|
tab: Arc<tab::Tab>,
|
|
|
|
|
|
|
|
// Extras
|
2024-09-22 18:50:47 +03:00
|
|
|
widget: widget::Main,
|
2024-09-22 02:00:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Main {
|
2024-09-22 18:50:47 +03:00
|
|
|
// Construct
|
2024-09-23 01:57:16 +03:00
|
|
|
pub fn new() -> Arc<Main> {
|
2024-09-22 18:50:47 +03:00
|
|
|
// Init components
|
2024-09-22 22:23:44 +03:00
|
|
|
let tab = tab::Tab::new();
|
2024-09-22 18:50:47 +03:00
|
|
|
|
2024-09-23 15:56:09 +03:00
|
|
|
// Extras
|
2024-09-23 15:58:55 +03:00
|
|
|
let widget = widget::Main::new(tab.widget().notebook());
|
2024-09-23 15:56:09 +03:00
|
|
|
|
2024-09-22 18:50:47 +03:00
|
|
|
// Init struct
|
2024-09-23 15:56:09 +03:00
|
|
|
Arc::new(Self { tab, widget })
|
2024-09-22 18:50:47 +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();
|
|
|
|
}
|
|
|
|
|
2024-09-22 18:50:47 +03:00
|
|
|
// Getters
|
|
|
|
pub fn widget(&self) -> &widget::Main {
|
|
|
|
&self.widget
|
|
|
|
}
|
2024-09-20 18:02:10 +03:00
|
|
|
}
|