@@ -1,8 +1,6 @@
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
|
||||
use gpui::{
|
||||
div, px, App, Axis, Div, Element, ElementId, Pixels, Refineable, StyleRefinement, Styled,
|
||||
};
|
||||
use gpui::{div, px, App, Axis, Div, Element, Pixels, Refineable, StyleRefinement, Styled};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use theme::ActiveTheme;
|
||||
|
||||
@@ -105,9 +103,16 @@ impl From<Pixels> for Size {
|
||||
|
||||
/// A trait for defining element that can be selected.
|
||||
pub trait Selectable: Sized {
|
||||
fn element_id(&self) -> &ElementId;
|
||||
/// Set the selected state of the element.
|
||||
fn selected(self, selected: bool) -> Self;
|
||||
|
||||
/// Returns true if the element is selected.
|
||||
fn is_selected(&self) -> bool;
|
||||
|
||||
/// Set is the element mouse right clicked, default do nothing.
|
||||
fn secondary_selected(self, _: bool) -> Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait for defining element that can be disabled.
|
||||
|
||||
Reference in New Issue
Block a user