47 lines
684 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:03:28 +03:00
let tab = Notebook::builder().scrollable(true).build();
append(
tab.clone(),
true
); // @TODO
return tab;
2024-09-18 22:38:18 +03:00
}
pub fn append(
2024-09-19 00:37:54 +03:00
tab: Notebook,
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
}