mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
30 lines
662 B
Rust
30 lines
662 B
Rust
pub struct Tab {
|
|
notebook: gtk::Notebook,
|
|
}
|
|
|
|
impl Tab {
|
|
// Construct new object
|
|
pub fn new() -> Tab {
|
|
Self {
|
|
notebook: gtk::Notebook::builder().scrollable(true).build(),
|
|
}
|
|
}
|
|
|
|
// Actions
|
|
pub fn append(&self, label: >k::Box, page: >k::Box, current: bool) -> u32 {
|
|
let page_number = self.notebook.append_page(page, Some(label));
|
|
|
|
self.notebook.set_tab_reorderable(page, true);
|
|
|
|
if current {
|
|
self.notebook.set_current_page(Some(page_number));
|
|
}
|
|
|
|
page_number
|
|
}
|
|
|
|
// Getters
|
|
pub fn notebook(&self) -> >k::Notebook {
|
|
&self.notebook
|
|
}
|
|
}
|