create separated structs for subject entity

This commit is contained in:
yggverse 2024-09-22 19:51:06 +03:00
parent 6f3ad01c35
commit 2c389abdfd
7 changed files with 147 additions and 55 deletions

View file

@ -1,20 +1,24 @@
mod description;
mod title;
mod widget;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box {
let subject = Box::builder()
// Tuneup
.orientation(gtk::Orientation::Vertical)
.valign(gtk::Align::Center)
.build();
// Compose childs
subject.append(&title::new());
subject.append(&description::new());
// Done
subject
pub struct Subject {
widget: widget::Subject,
}
impl Subject {
// Construct
pub fn new() -> Subject {
Self {
widget: widget::Subject::new(
title::Title::new().widget().gtk(),
description::Description::new().widget().gtk(),
),
}
}
// Getters
pub fn widget(&self) -> &widget::Subject {
&self.widget
}
}