mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-10 20:51:45 +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 }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn pin(&self) -> bool {
|
||||
// Toggle status
|
||||
let is_pinned = !self.pin.widget().is_visible();
|
||||
|
||||
// Update pin widget
|
||||
// Setters
|
||||
pub fn pin(&self, is_pinned: bool) {
|
||||
self.pin.widget().set_visible(is_pinned);
|
||||
|
||||
// Update label widget
|
||||
self.title.widget().set_visible(!is_pinned);
|
||||
|
||||
// Result
|
||||
is_pinned
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn is_pinned(&self) -> bool {
|
||||
self.pin.widget().is_visible()
|
||||
}
|
||||
|
||||
pub fn widget(&self) -> &Box {
|
||||
&self.widget
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ impl Tab {
|
||||
move |_, n: i32, _, _| {
|
||||
// double click
|
||||
if n == 2 {
|
||||
label.pin();
|
||||
label.pin(!label.is_pinned()); // toggle
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user