mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
complete widget submodule refactory
This commit is contained in:
parent
e45b7f0a4a
commit
1e42a75f2e
29 changed files with 585 additions and 145 deletions
30
src/browser/main/tab/widget.rs
Normal file
30
src/browser/main/tab/widget.rs
Normal 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: >k::Box, page: >k::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) -> >k::Notebook {
|
||||
&self.gtk
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue