chore: Upgrade to GPUI3 (#6)
* wip: gpui3 * wip: gpui3 * chore: fix clippy
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
use gpui::{ClickEvent, Focusable, InteractiveElement, Stateful, WindowContext};
|
||||
use gpui::{App, ClickEvent, FocusableWrapper, InteractiveElement, Stateful, Window};
|
||||
|
||||
pub trait InteractiveElementExt: InteractiveElement {
|
||||
/// Set the listener for a double click event.
|
||||
fn on_double_click(
|
||||
mut self,
|
||||
listener: impl Fn(&ClickEvent, &mut WindowContext) + 'static,
|
||||
listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
|
||||
) -> Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
self.interactivity().on_click(move |event, context| {
|
||||
self.interactivity().on_click(move |event, window, cx| {
|
||||
if event.up.click_count == 2 {
|
||||
listener(event, context);
|
||||
listener(event, window, cx);
|
||||
}
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: InteractiveElement> InteractiveElementExt for Focusable<E> {}
|
||||
impl<E: InteractiveElement> InteractiveElementExt for FocusableWrapper<E> {}
|
||||
impl<E: InteractiveElement> InteractiveElementExt for Stateful<E> {}
|
||||
|
||||
Reference in New Issue
Block a user