rename wrapper mod to window

This commit is contained in:
yggverse 2024-10-05 17:10:31 +03:00
parent 992ecfc0f6
commit d5101a6465
26 changed files with 8 additions and 8 deletions

View file

@ -0,0 +1,22 @@
use gtk::Image;
pub struct Pin {
widget: Image,
}
impl Pin {
// Construct
pub fn new(visible: bool) -> Pin {
let widget = Image::builder()
.icon_name("view-pin-symbolic")
.visible(visible)
.build();
Self { widget }
}
// Getters
pub fn widget(&self) -> &Image {
&self.widget
}
}

View file

@ -0,0 +1,34 @@
use gtk::{glib::GString, pango::EllipsizeMode, Label};
const DEFAULT_LABEL_TEXT: &str = "New page";
pub struct Title {
widget: Label,
}
impl Title {
// Construct
pub fn new() -> Self {
Self {
widget: Label::builder()
.label(DEFAULT_LABEL_TEXT)
.ellipsize(EllipsizeMode::End)
.width_chars(16)
.single_line_mode(true)
.build(),
}
}
// Actions
pub fn update(&self, title: Option<&GString>) {
match title {
Some(title) => self.widget.set_text(title),
None => self.widget.set_text(DEFAULT_LABEL_TEXT),
}
}
// Getters
pub fn widget(&self) -> &Label {
&self.widget
}
}