Implement Selectable
for buttons (#3451)
This PR implements the `Selectable` trait for `ButtonLike`, `Button`, and `IconButton`. Release Notes: - N/A
This commit is contained in:
parent
481e42ade9
commit
9d53287341
5 changed files with 45 additions and 51 deletions
|
@ -1,15 +1,7 @@
|
|||
use gpui::{AnyView, WindowContext};
|
||||
|
||||
/// A trait for elements that can be selected.
|
||||
pub trait Selectable {
|
||||
/// Sets whether the element is selected.
|
||||
fn selected(self, selected: bool) -> Self;
|
||||
|
||||
/// Sets the tooltip that should be shown when the element is selected.
|
||||
fn selected_tooltip(
|
||||
self,
|
||||
tooltip: Box<dyn Fn(&mut WindowContext) -> AnyView + 'static>,
|
||||
) -> Self;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq, Hash, Clone, Copy)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue