mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-11 13:11:08 +00:00
toggle pin status outside
This commit is contained in:
parent
1da7756374
commit
a1cf47fb1f
@ -35,22 +35,17 @@ impl Label {
|
|||||||
Self { pin, title, widget }
|
Self { pin, title, widget }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Setters
|
||||||
pub fn pin(&self) -> bool {
|
pub fn pin(&self, is_pinned: bool) {
|
||||||
// Toggle status
|
|
||||||
let is_pinned = !self.pin.widget().is_visible();
|
|
||||||
|
|
||||||
// Update pin widget
|
|
||||||
self.pin.widget().set_visible(is_pinned);
|
self.pin.widget().set_visible(is_pinned);
|
||||||
|
|
||||||
// Update label widget
|
|
||||||
self.title.widget().set_visible(!is_pinned);
|
self.title.widget().set_visible(!is_pinned);
|
||||||
|
|
||||||
// Result
|
|
||||||
is_pinned
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
pub fn is_pinned(&self) -> bool {
|
||||||
|
self.pin.widget().is_visible()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn widget(&self) -> &Box {
|
pub fn widget(&self) -> &Box {
|
||||||
&self.widget
|
&self.widget
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ impl Tab {
|
|||||||
move |_, n: i32, _, _| {
|
move |_, n: i32, _, _| {
|
||||||
// double click
|
// double click
|
||||||
if n == 2 {
|
if n == 2 {
|
||||||
label.pin();
|
label.pin(!label.is_pinned()); // toggle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user