Rename again, add fun cx APIs using new traits

This commit is contained in:
Mikayla
2023-11-17 10:06:41 -08:00
parent 01d9d53f4a
commit 17d53d0e38
10 changed files with 77 additions and 35 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
use gpui::{
div, prelude::*, px, AnyView, Div, FocusHandle, Managed, Render, Subscription, View,
div, prelude::*, px, AnyView, Div, FocusHandle, ManagedView, Render, Subscription, View,
ViewContext,
};
use ui::{h_stack, v_stack};
@@ -22,7 +22,7 @@ impl ModalLayer {
pub fn toggle_modal<V, B>(&mut self, cx: &mut ViewContext<Self>, build_view: B)
where
V: Managed,
V: ManagedView,
B: FnOnce(&mut ViewContext<V>) -> V,
{
if let Some(active_modal) = &self.active_modal {
@@ -38,7 +38,7 @@ impl ModalLayer {
pub fn show_modal<V>(&mut self, new_modal: View<V>, cx: &mut ViewContext<Self>)
where
V: Managed,
V: ManagedView,
{
self.active_modal = Some(ActiveModal {
modal: new_modal.clone().into(),
+6 -6
View File
@@ -31,10 +31,10 @@ use futures::{
use gpui::{
actions, div, point, size, Action, AnyModel, AnyView, AnyWeakView, AppContext, AsyncAppContext,
AsyncWindowContext, Bounds, Context, Div, Entity, EntityId, EventEmitter, FocusHandle,
FocusableView, GlobalPixels, InteractiveComponent, KeyContext, Managed, Model, ModelContext,
ParentComponent, PathPromptOptions, Point, PromptLevel, Render, Size, Styled, Subscription,
Task, View, ViewContext, VisualContext, WeakView, WindowBounds, WindowContext, WindowHandle,
WindowOptions,
FocusableView, GlobalPixels, InteractiveComponent, KeyContext, ManagedView, Model,
ModelContext, ParentComponent, PathPromptOptions, Point, PromptLevel, Render, Size, Styled,
Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowBounds, WindowContext,
WindowHandle, WindowOptions,
};
use item::{FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, ProjectItem};
use itertools::Itertools;
@@ -3364,14 +3364,14 @@ impl Workspace {
div
}
pub fn active_modal<V: Managed + 'static>(
pub fn active_modal<V: ManagedView + 'static>(
&mut self,
cx: &ViewContext<Self>,
) -> Option<View<V>> {
self.modal_layer.read(cx).active_modal()
}
pub fn toggle_modal<V: Managed, B>(&mut self, cx: &mut ViewContext<Self>, build: B)
pub fn toggle_modal<V: ManagedView, B>(&mut self, cx: &mut ViewContext<Self>, build: B)
where
B: FnOnce(&mut ViewContext<V>) -> V,
{