complete widget submodule refactory

This commit is contained in:
yggverse 2024-09-22 22:23:44 +03:00
parent e45b7f0a4a
commit 1e42a75f2e
29 changed files with 585 additions and 145 deletions

View file

@ -0,0 +1,30 @@
pub struct Tab {
gtk: gtk::Notebook,
}
impl Tab {
// Construct new object
pub fn new() -> Tab {
Self {
gtk: gtk::Notebook::builder().scrollable(true).build(),
}
}
// Actions
pub fn append(&self, label: &gtk::Box, page: &gtk::Box, current: bool) -> u32 {
let page_number = self.gtk.append_page(page, Some(label));
self.gtk.set_tab_reorderable(page, true);
if current {
self.gtk.set_current_page(Some(page_number));
}
page_number
}
// Getters
pub fn gtk(&self) -> &gtk::Notebook {
&self.gtk
}
}