2024-09-20 18:02:10 +03:00
|
|
|
mod tab;
|
2024-09-18 20:33:29 +03:00
|
|
|
|
2024-09-23 18:51:48 +03:00
|
|
|
use tab::Tab;
|
2024-09-23 01:57:16 +03:00
|
|
|
|
2024-09-24 21:29:05 +03:00
|
|
|
use gtk::{prelude::BoxExt, Box, Orientation};
|
|
|
|
use std::sync::Arc;
|
2024-09-23 15:56:09 +03:00
|
|
|
|
2024-09-23 18:51:48 +03:00
|
|
|
pub struct Main {
|
2024-09-24 21:29:05 +03:00
|
|
|
tab: Arc<Tab>,
|
2024-09-23 18:51:48 +03:00
|
|
|
widget: Box,
|
2024-09-22 02:00:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Main {
|
2024-09-22 18:50:47 +03:00
|
|
|
// Construct
|
2024-09-23 18:51:48 +03:00
|
|
|
pub fn new() -> Main {
|
2024-09-22 18:50:47 +03:00
|
|
|
// Init components
|
2024-09-23 18:51:48 +03:00
|
|
|
let tab = Tab::new();
|
2024-09-22 18:50:47 +03:00
|
|
|
|
2024-09-23 15:56:09 +03:00
|
|
|
// Extras
|
2024-09-23 18:51:48 +03:00
|
|
|
let widget = Box::builder().orientation(Orientation::Vertical).build();
|
|
|
|
|
|
|
|
widget.append(tab.widget());
|
2024-09-23 15:56:09 +03:00
|
|
|
|
2024-09-22 18:50:47 +03:00
|
|
|
// Init struct
|
2024-09-23 18:51:48 +03:00
|
|
|
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 16:03:39 +03:00
|
|
|
pub fn tab_close(&self) {
|
|
|
|
self.tab.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn tab_close_all(&self) {
|
2024-09-24 00:56:46 +03:00
|
|
|
self.tab.close_all();
|
2024-09-23 16:03:39 +03:00
|
|
|
}
|
|
|
|
|
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
|
2024-09-23 18:51:48 +03:00
|
|
|
pub fn widget(&self) -> &Box {
|
2024-09-22 18:50:47 +03:00
|
|
|
&self.widget
|
|
|
|
}
|
2024-09-20 18:02:10 +03:00
|
|
|
}
|