54 lines
758 B
Rust
Raw Normal View History

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