draft pin tab feature

This commit is contained in:
yggverse 2024-09-23 15:44:33 +03:00
parent 4b78ccb779
commit f2427c453e
8 changed files with 64 additions and 20 deletions

View file

@ -10,21 +10,33 @@ pub struct Label {
title: Arc<title::Title>,
// Extras
is_pinned: bool,
widget: widget::Label,
}
impl Label {
// Construct
pub fn new() -> Arc<Label> {
// Init components
let pin = pin::Pin::new();
pub fn new(is_pinned: bool) -> Arc<Label> {
// Components
let pin = pin::Pin::new(is_pinned);
let title = title::Title::new();
// Init extras
// Extras
let widget = widget::Label::new(pin.widget().image(), title.widget().label());
// Result
Arc::new(Self { pin, title, widget })
Arc::new(Self {
pin,
title,
is_pinned,
widget,
})
}
// Actions
pub fn pin(&mut self) {
self.is_pinned = !self.is_pinned; // toggle
// @TODO
}
// Getters