chore: Upgrade to GPUI3 (#6)
* wip: gpui3 * wip: gpui3 * chore: fix clippy
This commit is contained in:
@@ -3,8 +3,9 @@ use crate::{
|
||||
Sizable, Size,
|
||||
};
|
||||
use gpui::{
|
||||
prelude::FluentBuilder as _, svg, AnyElement, Hsla, IntoElement, Radians, Render, RenderOnce,
|
||||
SharedString, StyleRefinement, Styled, Svg, Transformation, View, VisualContext, WindowContext,
|
||||
prelude::FluentBuilder as _, svg, AnyElement, App, AppContext, Entity, Hsla, IntoElement,
|
||||
Radians, Render, RenderOnce, SharedString, StyleRefinement, Styled, Svg, Transformation,
|
||||
Window,
|
||||
};
|
||||
|
||||
#[derive(IntoElement, Clone)]
|
||||
@@ -174,9 +175,9 @@ impl IconName {
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Return the icon as a View<Icon>
|
||||
pub fn view(self, cx: &mut WindowContext) -> View<Icon> {
|
||||
Icon::build(self).view(cx)
|
||||
/// Return the icon as a Entity<Icon>
|
||||
pub fn view(self, window: &mut Window, cx: &mut App) -> Entity<Icon> {
|
||||
Icon::build(self).view(window, cx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ impl From<IconName> for AnyElement {
|
||||
}
|
||||
|
||||
impl RenderOnce for IconName {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
fn render(self, _window: &mut Window, _cx: &mut App) -> impl IntoElement {
|
||||
Icon::build(self)
|
||||
}
|
||||
}
|
||||
@@ -251,8 +252,8 @@ impl Icon {
|
||||
}
|
||||
|
||||
/// Create a new view for the icon
|
||||
pub fn view(self, cx: &mut WindowContext) -> View<Icon> {
|
||||
cx.new_view(|_| self)
|
||||
pub fn view(self, _window: &mut Window, cx: &mut App) -> Entity<Icon> {
|
||||
cx.new(|_| self)
|
||||
}
|
||||
|
||||
pub fn transform(mut self, transformation: gpui::Transformation) -> Self {
|
||||
@@ -292,8 +293,8 @@ impl Sizable for Icon {
|
||||
}
|
||||
|
||||
impl RenderOnce for Icon {
|
||||
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
|
||||
let text_color = self.text_color.unwrap_or_else(|| cx.text_style().color);
|
||||
fn render(self, window: &mut Window, _cx: &mut App) -> impl IntoElement {
|
||||
let text_color = self.text_color.unwrap_or_else(|| window.text_style().color);
|
||||
|
||||
self.base
|
||||
.text_color(text_color)
|
||||
@@ -315,7 +316,11 @@ impl From<Icon> for AnyElement {
|
||||
}
|
||||
|
||||
impl Render for Icon {
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl IntoElement {
|
||||
fn render(
|
||||
&mut self,
|
||||
_window: &mut gpui::Window,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) -> impl IntoElement {
|
||||
let text_color = self
|
||||
.text_color
|
||||
.unwrap_or_else(|| cx.theme().base.step(cx, ColorScaleStep::ELEVEN));
|
||||
|
||||
Reference in New Issue
Block a user