45 lines
730 B
Rust
Raw Normal View History

2024-09-20 18:02:10 +03:00
mod label;
mod page;
2024-09-22 22:23:44 +03:00
mod widget;
2024-09-18 22:38:18 +03:00
2024-09-23 15:56:09 +03:00
use std::sync::Arc;
2024-09-22 02:00:54 +03:00
pub struct Tab {
2024-09-22 22:23:44 +03:00
widget: widget::Tab,
2024-09-18 22:38:18 +03:00
}
2024-09-22 02:00:54 +03:00
impl Tab {
2024-09-22 22:23:44 +03:00
// Construct
2024-09-23 15:56:09 +03:00
pub fn new() -> Arc<Tab> {
Arc::new(Self {
2024-09-23 12:41:56 +03:00
widget: widget::Tab::new(),
2024-09-23 15:56:09 +03:00
})
2024-09-18 22:47:53 +03:00
}
2024-09-22 02:00:54 +03:00
2024-09-22 22:23:44 +03:00
// Actions
2024-09-23 15:44:33 +03:00
pub fn append(&self, is_active: bool) -> u32 {
2024-09-22 22:23:44 +03:00
self.widget.append(
2024-09-23 15:44:33 +03:00
label::Label::new(false).widget().container(),
2024-09-23 15:07:41 +03:00
page::Page::new().widget().container(),
2024-09-23 15:44:33 +03:00
is_active,
2024-09-22 22:23:44 +03:00
)
}
2024-09-18 22:47:53 +03:00
2024-09-23 16:03:39 +03:00
pub fn close(&self) {
todo!()
}
pub fn close_all(&self) {
todo!()
}
2024-09-23 15:44:33 +03:00
pub fn pin(&self) -> bool {
2024-09-23 16:03:39 +03:00
todo!()
2024-09-23 15:44:33 +03:00
}
2024-09-22 22:23:44 +03:00
// Getters
pub fn widget(&self) -> &widget::Tab {
&self.widget
}
2024-09-20 18:02:10 +03:00
}