Don't export platform::* from gpui
I'd like to avoid cluttering the top-level namespace with all the platform- specific types.
This commit is contained in:
parent
f450692e77
commit
2615a11f7c
73 changed files with 284 additions and 210 deletions
|
@ -4,7 +4,7 @@ use gpui::{
|
|||
color::Color,
|
||||
elements::{ContainerStyle, ImageStyle, LabelStyle, Shadow, TooltipStyle},
|
||||
fonts::{HighlightStyle, TextStyle},
|
||||
Border, MouseState,
|
||||
platform, Border, MouseState,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use serde_json::Value;
|
||||
|
@ -754,14 +754,15 @@ impl<T> Interactive<T> {
|
|||
self.hover_and_active
|
||||
.as_ref()
|
||||
.unwrap_or(self.active.as_ref().unwrap_or(&self.default))
|
||||
} else if state.clicked() == Some(gpui::MouseButton::Left) && self.clicked.is_some() {
|
||||
} else if state.clicked() == Some(platform::MouseButton::Left) && self.clicked.is_some()
|
||||
{
|
||||
self.click_and_active
|
||||
.as_ref()
|
||||
.unwrap_or(self.active.as_ref().unwrap_or(&self.default))
|
||||
} else {
|
||||
self.active.as_ref().unwrap_or(&self.default)
|
||||
}
|
||||
} else if state.clicked() == Some(gpui::MouseButton::Left) && self.clicked.is_some() {
|
||||
} else if state.clicked() == Some(platform::MouseButton::Left) && self.clicked.is_some() {
|
||||
self.clicked.as_ref().unwrap()
|
||||
} else if state.hovered() {
|
||||
self.hover.as_ref().unwrap_or(&self.default)
|
||||
|
|
|
@ -8,8 +8,10 @@ use gpui::{
|
|||
},
|
||||
fonts::TextStyle,
|
||||
geometry::vector::{vec2f, Vector2F},
|
||||
platform,
|
||||
platform::MouseButton,
|
||||
scene::MouseClick,
|
||||
Action, Element, ElementBox, EventContext, MouseButton, MouseState, RenderContext, View,
|
||||
Action, Element, ElementBox, EventContext, MouseState, RenderContext, View,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
|
@ -80,8 +82,10 @@ pub fn checkbox_with_label<T: 'static, V: View>(
|
|||
.align_children_center()
|
||||
.boxed()
|
||||
})
|
||||
.on_click(gpui::MouseButton::Left, move |_, cx| change(!checked, cx))
|
||||
.with_cursor_style(gpui::CursorStyle::PointingHand)
|
||||
.on_click(platform::MouseButton::Left, move |_, cx| {
|
||||
change(!checked, cx)
|
||||
})
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default)]
|
||||
|
@ -212,7 +216,7 @@ where
|
|||
.boxed()
|
||||
})
|
||||
.on_click(MouseButton::Left, f)
|
||||
.with_cursor_style(gpui::CursorStyle::PointingHand)
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Default)]
|
||||
|
@ -261,11 +265,11 @@ where
|
|||
let style = style.close_icon.style_for(state, false);
|
||||
icon(style).boxed()
|
||||
})
|
||||
.on_click(gpui::MouseButton::Left, move |_, cx| {
|
||||
.on_click(platform::MouseButton::Left, move |_, cx| {
|
||||
let window_id = cx.window_id();
|
||||
cx.remove_window(window_id);
|
||||
})
|
||||
.with_cursor_style(gpui::CursorStyle::PointingHand)
|
||||
.with_cursor_style(platform::CursorStyle::PointingHand)
|
||||
.aligned()
|
||||
.right()
|
||||
.boxed(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue