28 lines
498 B
Rust
Raw Normal View History

2024-09-20 18:02:10 +03:00
mod label;
mod page;
2024-09-18 22:38:18 +03:00
2024-09-18 22:07:52 +03:00
use gtk::Notebook;
2024-09-20 18:02:10 +03:00
pub fn new() -> Notebook {
let tab = Notebook::builder().scrollable(true).build();
2024-09-19 00:46:58 +03:00
// Add test tab @TODO restore from session
2024-09-20 18:02:10 +03:00
append(&tab, true);
2024-09-19 00:03:28 +03:00
2024-09-20 18:02:10 +03:00
tab
2024-09-18 22:38:18 +03:00
}
2024-09-20 18:02:10 +03:00
pub fn append(tab: &Notebook, current: bool) -> u32 {
2024-09-18 22:47:53 +03:00
let page = page::new();
2024-09-20 18:02:10 +03:00
let page_number = tab.append_page(&page, Some(&label::new()));
tab.set_tab_reorderable(&page, true);
if current {
tab.set_current_page(Some(page_number));
2024-09-18 22:47:53 +03:00
}
2024-09-20 18:02:10 +03:00
page_number
}