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

View File

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

View File

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