rename widget struct entity

This commit is contained in:
yggverse 2024-09-23 15:07:41 +03:00
parent 3d7be25c5f
commit 4b78ccb779
3 changed files with 16 additions and 16 deletions

View File

@ -1,24 +1,24 @@
use gtk::prelude::BoxExt;
pub struct Label {
gtk: gtk::Box,
container: gtk::Box,
}
impl Label {
// Construct new object
pub fn new(pin: &gtk::Image, title: &gtk::Label) -> Label {
let gtk = gtk::Box::builder()
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Horizontal)
.build();
gtk.append(pin);
gtk.append(title);
container.append(pin);
container.append(title);
Self { gtk }
Self { container }
}
// Getters
pub fn gtk(&self) -> &gtk::Box {
&self.gtk
pub fn container(&self) -> &gtk::Box {
&self.container
}
}

View File

@ -17,8 +17,8 @@ impl Tab {
// Actions
pub fn append(&self, current: bool) -> u32 {
self.widget.append(
label::Label::new().widget().gtk(),
page::Page::new().widget().gtk(),
label::Label::new().widget().container(),
page::Page::new().widget().container(),
current,
)
}

View File

@ -1,24 +1,24 @@
use gtk::prelude::BoxExt;
pub struct Page {
gtk: gtk::Box,
container: gtk::Box,
}
impl Page {
// Construct
pub fn new(navigation: &gtk::Box, content: &gtk::Box) -> Page {
let gtk = gtk::Box::builder()
let container = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
gtk.append(navigation);
gtk.append(content);
container.append(navigation);
container.append(content);
Self { gtk }
Self { container }
}
// Getters
pub fn gtk(&self) -> &gtk::Box {
&self.gtk
pub fn container(&self) -> &gtk::Box {
&self.container
}
}