Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
50edcb06dd
commit
893f15ddab
26 changed files with 150 additions and 195 deletions
|
@ -1,7 +1,7 @@
|
|||
use client::{ContactRequestStatus, User, UserStore};
|
||||
use gpui::{
|
||||
actions, elements::*, Entity, ModelHandle, MutableAppContext, RenderContext, Task, View,
|
||||
ViewContext, ViewHandle,
|
||||
actions, elements::*, Entity, ModelHandle, MouseState, MutableAppContext, RenderContext, Task,
|
||||
View, ViewContext, ViewHandle,
|
||||
};
|
||||
use picker::{Picker, PickerDelegate};
|
||||
use settings::Settings;
|
||||
|
@ -105,7 +105,7 @@ impl PickerDelegate for ContactFinder {
|
|||
fn render_match(
|
||||
&self,
|
||||
ix: usize,
|
||||
mouse_state: &MouseState,
|
||||
mouse_state: MouseState,
|
||||
selected: bool,
|
||||
cx: &gpui::AppContext,
|
||||
) -> ElementBox {
|
||||
|
|
|
@ -259,7 +259,7 @@ impl ContactsPanel {
|
|||
) -> ElementBox {
|
||||
enum Header {}
|
||||
|
||||
let header_style = theme.header_row.style_for(&Default::default(), is_selected);
|
||||
let header_style = theme.header_row.style_for(Default::default(), is_selected);
|
||||
let text = match section {
|
||||
Section::Requests => "Requests",
|
||||
Section::Online => "Online",
|
||||
|
@ -299,7 +299,7 @@ impl ContactsPanel {
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| cx.dispatch_action(ToggleExpanded(section)))
|
||||
.on_click(move |_, _, cx| cx.dispatch_action(ToggleExpanded(section)))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
|
@ -331,11 +331,7 @@ impl ContactsPanel {
|
|||
.constrained()
|
||||
.with_height(theme.row_height)
|
||||
.contained()
|
||||
.with_style(
|
||||
*theme
|
||||
.contact_row
|
||||
.style_for(&Default::default(), is_selected),
|
||||
)
|
||||
.with_style(*theme.contact_row.style_for(Default::default(), is_selected))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
|
@ -442,7 +438,7 @@ impl ContactsPanel {
|
|||
} else {
|
||||
CursorStyle::Arrow
|
||||
})
|
||||
.on_click(move |_, cx| {
|
||||
.on_click(move |_, _, cx| {
|
||||
if !is_host {
|
||||
cx.dispatch_global_action(JoinProject {
|
||||
contact: contact.clone(),
|
||||
|
@ -504,7 +500,7 @@ impl ContactsPanel {
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| {
|
||||
.on_click(move |_, _, cx| {
|
||||
cx.dispatch_action(RespondToContactRequest {
|
||||
user_id,
|
||||
accept: false,
|
||||
|
@ -526,7 +522,7 @@ impl ContactsPanel {
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| {
|
||||
.on_click(move |_, _, cx| {
|
||||
cx.dispatch_action(RespondToContactRequest {
|
||||
user_id,
|
||||
accept: true,
|
||||
|
@ -549,7 +545,7 @@ impl ContactsPanel {
|
|||
})
|
||||
.with_padding(Padding::uniform(2.))
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| cx.dispatch_action(RemoveContact(user_id)))
|
||||
.on_click(move |_, _, cx| cx.dispatch_action(RemoveContact(user_id)))
|
||||
.flex_float()
|
||||
.boxed(),
|
||||
);
|
||||
|
@ -558,11 +554,7 @@ impl ContactsPanel {
|
|||
row.constrained()
|
||||
.with_height(theme.row_height)
|
||||
.contained()
|
||||
.with_style(
|
||||
*theme
|
||||
.contact_row
|
||||
.style_for(&Default::default(), is_selected),
|
||||
)
|
||||
.with_style(*theme.contact_row.style_for(Default::default(), is_selected))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
|
@ -862,7 +854,7 @@ impl View for ContactsPanel {
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(|_, cx| cx.dispatch_action(contact_finder::Toggle))
|
||||
.on_click(|_, _, cx| cx.dispatch_action(contact_finder::Toggle))
|
||||
.boxed(),
|
||||
)
|
||||
.constrained()
|
||||
|
@ -910,7 +902,7 @@ impl View for ContactsPanel {
|
|||
},
|
||||
)
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| {
|
||||
.on_click(move |_, _, cx| {
|
||||
cx.write_to_clipboard(ClipboardItem::new(
|
||||
info.url.to_string(),
|
||||
));
|
||||
|
|
|
@ -61,7 +61,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
|
|||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.with_padding(Padding::uniform(5.))
|
||||
.on_click(move |_, cx| cx.dispatch_any_action(dismiss_action.boxed_clone()))
|
||||
.on_click(move |_, _, cx| cx.dispatch_any_action(dismiss_action.boxed_clone()))
|
||||
.aligned()
|
||||
.constrained()
|
||||
.with_height(
|
||||
|
@ -76,13 +76,10 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
|
|||
.named("contact notification header"),
|
||||
)
|
||||
.with_children(body.map(|body| {
|
||||
Label::new(
|
||||
body.to_string(),
|
||||
theme.body_message.text.clone(),
|
||||
)
|
||||
.contained()
|
||||
.with_style(theme.body_message.container)
|
||||
.boxed()
|
||||
Label::new(body.to_string(), theme.body_message.text.clone())
|
||||
.contained()
|
||||
.with_style(theme.body_message.container)
|
||||
.boxed()
|
||||
}))
|
||||
.with_children(if buttons.is_empty() {
|
||||
None
|
||||
|
@ -99,7 +96,7 @@ pub fn render_user_notification<V: View, A: Action + Clone>(
|
|||
.boxed()
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |_, cx| cx.dispatch_any_action(action.boxed_clone()))
|
||||
.on_click(move |_, _, cx| cx.dispatch_any_action(action.boxed_clone()))
|
||||
.boxed()
|
||||
},
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue