layout: add panel trait
This commit is contained in:
+38
-10
@@ -3,14 +3,36 @@
|
|||||||
//! divider between them; dragging the seam resizes the panels and a
|
//! divider between them; dragging the seam resizes the panels and a
|
||||||
//! double-click restores the half split.
|
//! double-click restores the half split.
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, AnyView, App, Axis, Div, ElementId, IntoElement, ParentElement as _, RenderOnce,
|
AnyElement, AnyView, App, Axis, Div, ElementId, Entity, IntoElement, ParentElement as _,
|
||||||
StyleRefinement, Styled as _, Window, div, rems,
|
Render, RenderOnce, StyleRefinement, Styled as _, Window, div, rems,
|
||||||
};
|
};
|
||||||
use gpui_native_theme::ActiveTheme as _;
|
use gpui_native_theme::ActiveTheme as _;
|
||||||
|
|
||||||
use crate::resizable::{Resizable, ResizableState};
|
use crate::resizable::{Resizable, ResizableState};
|
||||||
|
|
||||||
|
pub trait Panel: Render + 'static {}
|
||||||
|
|
||||||
|
/// An object-safe handle to a panel, so apps can hold panels by kind.
|
||||||
|
pub trait PanelView: 'static {
|
||||||
|
/// The panel's view.
|
||||||
|
fn view(&self) -> AnyView;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Panel> PanelView for Entity<T> {
|
||||||
|
fn view(&self) -> AnyView {
|
||||||
|
self.clone().into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<P: PanelView + ?Sized> PanelView for Arc<P> {
|
||||||
|
fn view(&self) -> AnyView {
|
||||||
|
(**self).view()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The layout the cached panel content lays out with.
|
/// The layout the cached panel content lays out with.
|
||||||
fn content_style() -> StyleRefinement {
|
fn content_style() -> StyleRefinement {
|
||||||
StyleRefinement::default().size_full()
|
StyleRefinement::default().size_full()
|
||||||
@@ -33,13 +55,13 @@ fn island(panel: Div, cx: &App) -> Div {
|
|||||||
/// The panel row drawn under the titlebar.
|
/// The panel row drawn under the titlebar.
|
||||||
#[derive(IntoElement)]
|
#[derive(IntoElement)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct Panel {
|
pub struct PanelRow {
|
||||||
id: ElementId,
|
id: ElementId,
|
||||||
main: Option<AnyElement>,
|
main: Option<AnyElement>,
|
||||||
split: Option<AnyElement>,
|
split: Option<AnyElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Panel {
|
impl PanelRow {
|
||||||
/// Creates the panel row.
|
/// Creates the panel row.
|
||||||
pub fn new<I>(id: I) -> Self
|
pub fn new<I>(id: I) -> Self
|
||||||
where
|
where
|
||||||
@@ -53,19 +75,25 @@ impl Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the main panel's content.
|
/// Sets the main panel's content.
|
||||||
pub fn main(mut self, main: AnyView) -> Self {
|
pub fn main<P>(mut self, main: P) -> Self
|
||||||
self.main = Some(main.cached(content_style()).into_any_element());
|
where
|
||||||
|
P: PanelView,
|
||||||
|
{
|
||||||
|
self.main = Some(main.view().cached(content_style()).into_any_element());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Splits the row into two half-width panels,
|
/// Splits the row into two half-width panels.
|
||||||
pub fn split(mut self, panel: AnyView) -> Self {
|
pub fn split<P>(mut self, panel: P) -> Self
|
||||||
self.split = Some(panel.cached(content_style()).into_any_element());
|
where
|
||||||
|
P: PanelView,
|
||||||
|
{
|
||||||
|
self.split = Some(panel.view().cached(content_style()).into_any_element());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderOnce for Panel {
|
impl RenderOnce for PanelRow {
|
||||||
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||||
let id = self.id.clone();
|
let id = self.id.clone();
|
||||||
let gutter = rems(0.5).to_pixels(window.rem_size());
|
let gutter = rems(0.5).to_pixels(window.rem_size());
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
//! half-width islands with a drag divider that resizes them.
|
//! half-width islands with a drag divider that resizes them.
|
||||||
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyView, AppContext as _, Context, InteractiveElement as _, IntoElement, Modifiers,
|
AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, Modifiers, MouseButton,
|
||||||
MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement as _, Render,
|
MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement as _, Render, SharedString,
|
||||||
SharedString, Styled as _, TestAppContext, VisualTestContext, Window, div, point, px, size,
|
Styled as _, TestAppContext, VisualTestContext, Window, div, point, px, size,
|
||||||
};
|
};
|
||||||
use gpui_native_layout::panel::Panel;
|
use gpui_native_layout::panel::{Panel, PanelRow};
|
||||||
use gpui_native_theme::Theme;
|
use gpui_native_theme::Theme;
|
||||||
|
|
||||||
const WINDOW_WIDTH: f32 = 1024.0;
|
const WINDOW_WIDTH: f32 = 1024.0;
|
||||||
@@ -36,15 +36,17 @@ impl Render for TagView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for TagView {}
|
||||||
|
|
||||||
struct PanelHarness {
|
struct PanelHarness {
|
||||||
split: bool,
|
split: bool,
|
||||||
main: AnyView,
|
main: Entity<TagView>,
|
||||||
split_view: AnyView,
|
split_view: Entity<TagView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for PanelHarness {
|
impl Render for PanelHarness {
|
||||||
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let panel = Panel::new("panel-harness").main(self.main.clone());
|
let panel = PanelRow::new("panel-harness").main(self.main.clone());
|
||||||
let panel = if self.split {
|
let panel = if self.split {
|
||||||
panel.split(self.split_view.clone())
|
panel.split(self.split_view.clone())
|
||||||
} else {
|
} else {
|
||||||
@@ -65,8 +67,8 @@ fn panel_window(cx: &mut TestAppContext, split: bool) -> VisualTestContext {
|
|||||||
let window = cx.open_window(size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), |_, _| {
|
let window = cx.open_window(size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), |_, _| {
|
||||||
PanelHarness {
|
PanelHarness {
|
||||||
split,
|
split,
|
||||||
main: main.into(),
|
main,
|
||||||
split_view: split_view.into(),
|
split_view,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let cx = VisualTestContext::from_window(window.into(), cx);
|
let cx = VisualTestContext::from_window(window.into(), cx);
|
||||||
|
|||||||
+4
-2
@@ -225,9 +225,11 @@ Gaps surfaced by the signed comparison; ordered by signed's usage.
|
|||||||
trailing buttons, `Theme::titlebar_height`
|
trailing buttons, `Theme::titlebar_height`
|
||||||
- [x] Shell — the titlebar over the panel row in the window frame, hosting
|
- [x] Shell — the titlebar over the panel row in the window frame, hosting
|
||||||
the toast and alert overlays
|
the toast and alert overlays
|
||||||
- [x] Panel — island layout on the muted app background: the main island
|
- [x] Panel row — island layout on the muted app background: the main island
|
||||||
fills the window and can split once into two half-width islands with
|
fills the window and can split once into two half-width islands with
|
||||||
a drag divider between them (double-click restores the half split)
|
a drag divider between them (double-click restores the half split);
|
||||||
|
apps define panels by implementing the `Panel` trait on their views
|
||||||
|
and hand entities or `PanelView` handles to `PanelRow`
|
||||||
- [x] Resizable group — stacked panes with drag dividers, per-pane floors,
|
- [x] Resizable group — stacked panes with drag dividers, per-pane floors,
|
||||||
double-click reset, keyboard steps
|
double-click reset, keyboard steps
|
||||||
|
|
||||||
|
|||||||
+158
-91
@@ -4,10 +4,10 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
use gpui::prelude::FluentBuilder as _;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyView, App, AppContext as _, Axis, Bounds, Context, Entity, FontWeight,
|
App, AppContext as _, Axis, Bounds, Context, Entity, FontWeight, InteractiveElement as _,
|
||||||
InteractiveElement as _, IntoElement, KeyBinding, ListAlignment, ListState, ParentElement as _,
|
IntoElement, KeyBinding, ListAlignment, ListState, ParentElement as _, Pixels, Render,
|
||||||
Pixels, Render, SharedString, Styled as _, UniformListScrollHandle, WeakEntity, Window,
|
SharedString, Styled as _, UniformListScrollHandle, WeakEntity, Window, WindowBounds,
|
||||||
WindowBounds, WindowOptions, actions, div, list, px, rems, size, uniform_list,
|
WindowOptions, actions, div, list, px, rems, size, uniform_list,
|
||||||
};
|
};
|
||||||
use gpui_native_core::alert::{Alert, AlertSeverity, Alerts};
|
use gpui_native_core::alert::{Alert, AlertSeverity, Alerts};
|
||||||
use gpui_native_core::avatar::Avatar;
|
use gpui_native_core::avatar::Avatar;
|
||||||
@@ -50,7 +50,7 @@ use gpui_native_editor::diff::{DiffRowKind, DiffViewState};
|
|||||||
use gpui_native_editor::highlight::Language;
|
use gpui_native_editor::highlight::Language;
|
||||||
use gpui_native_editor::markdown::{ListMarker, MarkdownBlock, MarkdownViewState, TextView};
|
use gpui_native_editor::markdown::{ListMarker, MarkdownBlock, MarkdownViewState, TextView};
|
||||||
use gpui_native_icons::{IconAssets, IconRole, icon};
|
use gpui_native_icons::{IconAssets, IconRole, icon};
|
||||||
use gpui_native_layout::panel::Panel;
|
use gpui_native_layout::panel::{Panel, PanelRow, PanelView};
|
||||||
use gpui_native_layout::resizable::{Resizable, ResizableState};
|
use gpui_native_layout::resizable::{Resizable, ResizableState};
|
||||||
use gpui_native_layout::resize_handle::ResizeHandle;
|
use gpui_native_layout::resize_handle::ResizeHandle;
|
||||||
use gpui_native_layout::shell::Shell;
|
use gpui_native_layout::shell::Shell;
|
||||||
@@ -226,9 +226,9 @@ struct Gallery {
|
|||||||
tabs: Vec<SharedString>,
|
tabs: Vec<SharedString>,
|
||||||
active: Option<SharedString>,
|
active: Option<SharedString>,
|
||||||
/// Created demo views, kept so state survives tab switches.
|
/// Created demo views, kept so state survives tab switches.
|
||||||
views: HashMap<SharedString, AnyView>,
|
views: HashMap<SharedString, Arc<dyn PanelView>>,
|
||||||
/// The panel the row is split with, if any.
|
/// The panel the row is split with, if any.
|
||||||
split_panel: Option<AnyView>,
|
split_panel: Option<Arc<dyn PanelView>>,
|
||||||
palette: Option<Entity<CommandPaletteState>>,
|
palette: Option<Entity<CommandPaletteState>>,
|
||||||
palette_runs: Vec<SharedString>,
|
palette_runs: Vec<SharedString>,
|
||||||
dialog_open: bool,
|
dialog_open: bool,
|
||||||
@@ -259,19 +259,19 @@ impl Gallery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The panel row: the active demo, split with the opened sub panel.
|
/// The panel row: the active demo, split with the opened sub panel.
|
||||||
fn render_panel(&self) -> Panel {
|
fn render_panel(&self) -> PanelRow {
|
||||||
let panel = match self
|
let row = match self
|
||||||
.active
|
.active
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|active| self.views.get(active).cloned())
|
.and_then(|active| self.views.get(active).cloned())
|
||||||
{
|
{
|
||||||
Some(view) => Panel::new("gallery-panel").main(view),
|
Some(panel) => PanelRow::new("gallery-panel").main(panel),
|
||||||
None => Panel::new("gallery-panel"),
|
None => PanelRow::new("gallery-panel"),
|
||||||
};
|
};
|
||||||
|
|
||||||
match &self.split_panel {
|
match &self.split_panel {
|
||||||
Some(split) => panel.split(split.clone()),
|
Some(split) => row.split(split.clone()),
|
||||||
None => panel,
|
None => row,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ impl Gallery {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let view = cx.new(|_| column_details());
|
let view = cx.new(|_| column_details());
|
||||||
self.split_panel = Some(view.into());
|
self.split_panel = Some(Arc::new(view));
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,48 +453,39 @@ impl Gallery {
|
|||||||
gallery: WeakEntity<Self>,
|
gallery: WeakEntity<Self>,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Option<AnyView> {
|
) -> Option<Arc<dyn PanelView>> {
|
||||||
let view: AnyView = match id {
|
let panel: Arc<dyn PanelView> = match id {
|
||||||
"welcome" => cx.new(|_| WelcomePanel { gallery }).into(),
|
"welcome" => Arc::new(cx.new(|_| WelcomePanel { gallery })),
|
||||||
"button" => cx.new(|_| ButtonDemo { clicks: 0 }).into(),
|
"button" => Arc::new(cx.new(|_| ButtonDemo { clicks: 0 })),
|
||||||
"input" => cx.new(InputDemo::new).into(),
|
"input" => Arc::new(cx.new(InputDemo::new)),
|
||||||
"field" => cx.new(|cx| FieldDemo::new(window, cx)).into(),
|
"field" => Arc::new(cx.new(|cx| FieldDemo::new(window, cx))),
|
||||||
"combobox" => cx.new(|cx| ComboboxDemo::new(window, cx)).into(),
|
"combobox" => Arc::new(cx.new(|cx| ComboboxDemo::new(window, cx))),
|
||||||
"status-dot" => cx.new(|_| StatusDotDemo).into(),
|
"status-dot" => Arc::new(cx.new(|_| StatusDotDemo)),
|
||||||
"checkbox" => cx.new(|_| CheckboxDemo { checked: false }).into(),
|
"checkbox" => Arc::new(cx.new(|_| CheckboxDemo { checked: false })),
|
||||||
"radio" => cx
|
"radio" => Arc::new(cx.new(|_| RadioDemo {
|
||||||
.new(|_| RadioDemo {
|
|
||||||
plan: SharedString::from("starter"),
|
plan: SharedString::from("starter"),
|
||||||
})
|
})),
|
||||||
.into(),
|
"switch" => Arc::new(cx.new(|_| SwitchDemo { checked: true })),
|
||||||
"switch" => cx.new(|_| SwitchDemo { checked: true }).into(),
|
"toggle" => Arc::new(cx.new(|_| ToggleDemo { pressed: false })),
|
||||||
"toggle" => cx.new(|_| ToggleDemo { pressed: false }).into(),
|
"slider" => Arc::new(cx.new(|_| SliderDemo { volume: 40.0 })),
|
||||||
"slider" => cx.new(|_| SliderDemo { volume: 40.0 }).into(),
|
"segmented" => Arc::new(cx.new(|_| SegmentedDemo {
|
||||||
"segmented" => cx
|
|
||||||
.new(|_| SegmentedDemo {
|
|
||||||
filter: ExploreFilter::default(),
|
filter: ExploreFilter::default(),
|
||||||
})
|
})),
|
||||||
.into(),
|
"select" => Arc::new(cx.new(|_| SelectDemo {
|
||||||
"select" => cx
|
|
||||||
.new(|_| SelectDemo {
|
|
||||||
strategy: Some(Strategy::Curated),
|
strategy: Some(Strategy::Curated),
|
||||||
})
|
})),
|
||||||
.into(),
|
"link" => Arc::new(cx.new(|_| LinkDemo { clicks: 0 })),
|
||||||
"link" => cx.new(|_| LinkDemo { clicks: 0 }).into(),
|
"clipboard" => Arc::new(cx.new(|_| ClipboardDemo)),
|
||||||
"clipboard" => cx.new(|_| ClipboardDemo).into(),
|
"badge" => Arc::new(cx.new(|_| BadgeDemo)),
|
||||||
"badge" => cx.new(|_| BadgeDemo).into(),
|
"avatar" => Arc::new(cx.new(|_| AvatarDemo)),
|
||||||
"avatar" => cx.new(|_| AvatarDemo).into(),
|
"progress" => Arc::new(cx.new(|_| ProgressDemo)),
|
||||||
"progress" => cx.new(|_| ProgressDemo).into(),
|
"spinner" => Arc::new(cx.new(|_| SpinnerDemo)),
|
||||||
"spinner" => cx.new(|_| SpinnerDemo).into(),
|
"list" => Arc::new(cx.new(|_| ListDemo { selected: None })),
|
||||||
"list" => cx.new(|_| ListDemo { selected: None }).into(),
|
"tree" => Arc::new(cx.new(|_| TreeDemo {
|
||||||
"tree" => cx
|
|
||||||
.new(|_| TreeDemo {
|
|
||||||
nodes: TreeDemo::demo(),
|
nodes: TreeDemo::demo(),
|
||||||
selected: None,
|
selected: None,
|
||||||
})
|
})),
|
||||||
.into(),
|
"tabs" => Arc::new(cx.new(|_| TabsDemo {
|
||||||
"tabs" => cx
|
|
||||||
.new(|_| TabsDemo {
|
|
||||||
selected: 0,
|
selected: 0,
|
||||||
pill_tabs: vec![
|
pill_tabs: vec![
|
||||||
SharedString::from("Explorer"),
|
SharedString::from("Explorer"),
|
||||||
@@ -505,59 +496,47 @@ impl Gallery {
|
|||||||
lead_selected: 0,
|
lead_selected: 0,
|
||||||
overflow_selected: 0,
|
overflow_selected: 0,
|
||||||
overflow_open: false,
|
overflow_open: false,
|
||||||
})
|
})),
|
||||||
.into(),
|
"alert" => Arc::new(cx.new(|_| AlertDemo {
|
||||||
"alert" => cx
|
|
||||||
.new(|_| AlertDemo {
|
|
||||||
alerts: self.alerts.clone(),
|
alerts: self.alerts.clone(),
|
||||||
dismissed: false,
|
dismissed: false,
|
||||||
})
|
})),
|
||||||
.into(),
|
"toast" => Arc::new(cx.new(|_| ToastDemo {
|
||||||
"toast" => cx
|
|
||||||
.new(|_| ToastDemo {
|
|
||||||
toasts: self.toasts.clone(),
|
toasts: self.toasts.clone(),
|
||||||
})
|
})),
|
||||||
.into(),
|
"dialog" => Arc::new(cx.new(|_| DialogDemo { gallery })),
|
||||||
"dialog" => cx.new(|_| DialogDemo { gallery }).into(),
|
|
||||||
"command-palette" => {
|
"command-palette" => {
|
||||||
let palette = self.palette.clone()?;
|
let palette = self.palette.clone()?;
|
||||||
cx.new(|cx| CommandPaletteDemo::new(gallery, palette, cx))
|
Arc::new(cx.new(|cx| CommandPaletteDemo::new(gallery, palette, cx)))
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
"menu" => cx.new(|_| MenuDemo { open: false }).into(),
|
"menu" => Arc::new(cx.new(|_| MenuDemo { open: false })),
|
||||||
"dropdown-menu" => cx
|
"dropdown-menu" => Arc::new(cx.new(|_| DropdownMenuDemo {
|
||||||
.new(|_| DropdownMenuDemo {
|
|
||||||
open_menu: None,
|
open_menu: None,
|
||||||
status: None,
|
status: None,
|
||||||
})
|
})),
|
||||||
.into(),
|
"context-menu" => Arc::new(cx.new(|_| ContextMenuDemo {
|
||||||
"context-menu" => cx
|
|
||||||
.new(|_| ContextMenuDemo {
|
|
||||||
action: SharedString::from("Right-click the card"),
|
action: SharedString::from("Right-click the card"),
|
||||||
})
|
})),
|
||||||
.into(),
|
"popover" => Arc::new(cx.new(|_| PopoverDemo { open: false })),
|
||||||
"popover" => cx.new(|_| PopoverDemo { open: false }).into(),
|
"tooltip" => Arc::new(cx.new(|_| TooltipDemo)),
|
||||||
"tooltip" => cx.new(|_| TooltipDemo).into(),
|
"empty-state" => Arc::new(cx.new(|_| EmptyStateDemo)),
|
||||||
"empty-state" => cx.new(|_| EmptyStateDemo).into(),
|
"scroll-area" => Arc::new(cx.new(|_| ScrollAreaDemo)),
|
||||||
"scroll-area" => cx.new(|_| ScrollAreaDemo).into(),
|
"scrollbar" => Arc::new(cx.new(|_| ScrollbarDemo::new())),
|
||||||
"scrollbar" => cx.new(|_| ScrollbarDemo::new()).into(),
|
"code-view" => Arc::new(cx.new(CodeViewDemo::new)),
|
||||||
"code-view" => cx.new(CodeViewDemo::new).into(),
|
"diff-view" => Arc::new(cx.new(DiffViewDemo::new)),
|
||||||
"diff-view" => cx.new(DiffViewDemo::new).into(),
|
"markdown-view" => Arc::new(cx.new(MarkdownViewDemo::new)),
|
||||||
"markdown-view" => cx.new(MarkdownViewDemo::new).into(),
|
"text-view" => Arc::new(cx.new(TextViewDemo::new)),
|
||||||
"text-view" => cx.new(TextViewDemo::new).into(),
|
"sidebar" => Arc::new(cx.new(|_| SidebarDemo { selected: None })),
|
||||||
"sidebar" => cx.new(|_| SidebarDemo { selected: None }).into(),
|
"resize-handle" => Arc::new(cx.new(|_| ResizeDemo {
|
||||||
"resize-handle" => cx
|
|
||||||
.new(|_| ResizeDemo {
|
|
||||||
width: rems(ResizeDemo::WIDTH_DEFAULT_REMS).to_pixels(window.rem_size()),
|
width: rems(ResizeDemo::WIDTH_DEFAULT_REMS).to_pixels(window.rem_size()),
|
||||||
})
|
})),
|
||||||
.into(),
|
"resizable" => Arc::new(cx.new(ResizableDemo::new)),
|
||||||
"resizable" => cx.new(ResizableDemo::new).into(),
|
"separator" => Arc::new(cx.new(|_| SeparatorDemo)),
|
||||||
"separator" => cx.new(|_| SeparatorDemo).into(),
|
"theme" => Arc::new(cx.new(|_| ThemeDemo)),
|
||||||
"theme" => cx.new(|_| ThemeDemo).into(),
|
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(view)
|
Some(panel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,6 +677,8 @@ struct WelcomePanel {
|
|||||||
gallery: WeakEntity<Gallery>,
|
gallery: WeakEntity<Gallery>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for WelcomePanel {}
|
||||||
|
|
||||||
impl Render for WelcomePanel {
|
impl Render for WelcomePanel {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -806,6 +787,8 @@ struct RightDetails {
|
|||||||
body: SharedString,
|
body: SharedString,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for RightDetails {}
|
||||||
|
|
||||||
impl Render for RightDetails {
|
impl Render for RightDetails {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -841,6 +824,8 @@ impl ButtonDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ButtonDemo {}
|
||||||
|
|
||||||
impl Render for ButtonDemo {
|
impl Render for ButtonDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1005,6 +990,8 @@ impl InputDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for InputDemo {}
|
||||||
|
|
||||||
impl Render for InputDemo {
|
impl Render for InputDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1089,6 +1076,8 @@ impl FieldDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for FieldDemo {}
|
||||||
|
|
||||||
impl Render for FieldDemo {
|
impl Render for FieldDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1161,6 +1150,8 @@ impl Render for FieldDemo {
|
|||||||
|
|
||||||
struct StatusDotDemo;
|
struct StatusDotDemo;
|
||||||
|
|
||||||
|
impl Panel for StatusDotDemo {}
|
||||||
|
|
||||||
impl Render for StatusDotDemo {
|
impl Render for StatusDotDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1329,6 +1320,8 @@ impl ComboboxDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ComboboxDemo {}
|
||||||
|
|
||||||
impl Render for ComboboxDemo {
|
impl Render for ComboboxDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1398,6 +1391,8 @@ struct CheckboxDemo {
|
|||||||
checked: bool,
|
checked: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for CheckboxDemo {}
|
||||||
|
|
||||||
impl Render for CheckboxDemo {
|
impl Render for CheckboxDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1440,6 +1435,8 @@ struct RadioDemo {
|
|||||||
plan: SharedString,
|
plan: SharedString,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for RadioDemo {}
|
||||||
|
|
||||||
impl Render for RadioDemo {
|
impl Render for RadioDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1476,6 +1473,8 @@ struct SwitchDemo {
|
|||||||
checked: bool,
|
checked: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for SwitchDemo {}
|
||||||
|
|
||||||
impl Render for SwitchDemo {
|
impl Render for SwitchDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1518,6 +1517,8 @@ struct ToggleDemo {
|
|||||||
pressed: bool,
|
pressed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ToggleDemo {}
|
||||||
|
|
||||||
impl Render for ToggleDemo {
|
impl Render for ToggleDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1555,6 +1556,8 @@ struct SliderDemo {
|
|||||||
volume: f32,
|
volume: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for SliderDemo {}
|
||||||
|
|
||||||
impl Render for SliderDemo {
|
impl Render for SliderDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1592,6 +1595,8 @@ struct SegmentedDemo {
|
|||||||
filter: ExploreFilter,
|
filter: ExploreFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for SegmentedDemo {}
|
||||||
|
|
||||||
impl Render for SegmentedDemo {
|
impl Render for SegmentedDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1674,6 +1679,8 @@ struct SelectDemo {
|
|||||||
strategy: Option<Strategy>,
|
strategy: Option<Strategy>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for SelectDemo {}
|
||||||
|
|
||||||
impl Render for SelectDemo {
|
impl Render for SelectDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1722,6 +1729,8 @@ struct LinkDemo {
|
|||||||
clicks: usize,
|
clicks: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for LinkDemo {}
|
||||||
|
|
||||||
impl Render for LinkDemo {
|
impl Render for LinkDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -1770,6 +1779,8 @@ impl Render for LinkDemo {
|
|||||||
|
|
||||||
struct ClipboardDemo;
|
struct ClipboardDemo;
|
||||||
|
|
||||||
|
impl Panel for ClipboardDemo {}
|
||||||
|
|
||||||
impl Render for ClipboardDemo {
|
impl Render for ClipboardDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1804,6 +1815,8 @@ impl Render for ClipboardDemo {
|
|||||||
|
|
||||||
struct SeparatorDemo;
|
struct SeparatorDemo;
|
||||||
|
|
||||||
|
impl Panel for SeparatorDemo {}
|
||||||
|
|
||||||
impl Render for SeparatorDemo {
|
impl Render for SeparatorDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1856,6 +1869,8 @@ impl ResizableDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ResizableDemo {}
|
||||||
|
|
||||||
impl Render for ResizableDemo {
|
impl Render for ResizableDemo {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1895,6 +1910,8 @@ impl Render for ResizableDemo {
|
|||||||
|
|
||||||
struct BadgeDemo;
|
struct BadgeDemo;
|
||||||
|
|
||||||
|
impl Panel for BadgeDemo {}
|
||||||
|
|
||||||
impl Render for BadgeDemo {
|
impl Render for BadgeDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1932,6 +1949,8 @@ impl Render for BadgeDemo {
|
|||||||
|
|
||||||
struct AvatarDemo;
|
struct AvatarDemo;
|
||||||
|
|
||||||
|
impl Panel for AvatarDemo {}
|
||||||
|
|
||||||
impl Render for AvatarDemo {
|
impl Render for AvatarDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1967,6 +1986,8 @@ impl Render for AvatarDemo {
|
|||||||
|
|
||||||
struct ProgressDemo;
|
struct ProgressDemo;
|
||||||
|
|
||||||
|
impl Panel for ProgressDemo {}
|
||||||
|
|
||||||
impl Render for ProgressDemo {
|
impl Render for ProgressDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -1992,6 +2013,8 @@ impl Render for ProgressDemo {
|
|||||||
|
|
||||||
struct SpinnerDemo;
|
struct SpinnerDemo;
|
||||||
|
|
||||||
|
impl Panel for SpinnerDemo {}
|
||||||
|
|
||||||
impl Render for SpinnerDemo {
|
impl Render for SpinnerDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -2034,6 +2057,8 @@ struct ListDemo {
|
|||||||
selected: Option<usize>,
|
selected: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ListDemo {}
|
||||||
|
|
||||||
impl Render for ListDemo {
|
impl Render for ListDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2209,6 +2234,8 @@ impl TreeDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for TreeDemo {}
|
||||||
|
|
||||||
impl Render for TreeDemo {
|
impl Render for TreeDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2252,6 +2279,8 @@ struct TabsDemo {
|
|||||||
overflow_open: bool,
|
overflow_open: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for TabsDemo {}
|
||||||
|
|
||||||
impl Render for TabsDemo {
|
impl Render for TabsDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2427,6 +2456,8 @@ struct AlertDemo {
|
|||||||
dismissed: bool,
|
dismissed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for AlertDemo {}
|
||||||
|
|
||||||
impl Render for AlertDemo {
|
impl Render for AlertDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2519,6 +2550,8 @@ struct ToastDemo {
|
|||||||
toasts: Entity<Toasts>,
|
toasts: Entity<Toasts>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ToastDemo {}
|
||||||
|
|
||||||
impl Render for ToastDemo {
|
impl Render for ToastDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let toasts_undo = self.toasts.clone();
|
let toasts_undo = self.toasts.clone();
|
||||||
@@ -2589,6 +2622,8 @@ struct DialogDemo {
|
|||||||
gallery: WeakEntity<Gallery>,
|
gallery: WeakEntity<Gallery>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for DialogDemo {}
|
||||||
|
|
||||||
impl Render for DialogDemo {
|
impl Render for DialogDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let gallery_dialog = self.gallery.clone();
|
let gallery_dialog = self.gallery.clone();
|
||||||
@@ -2655,6 +2690,8 @@ impl CommandPaletteDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for CommandPaletteDemo {}
|
||||||
|
|
||||||
impl Render for CommandPaletteDemo {
|
impl Render for CommandPaletteDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -2721,6 +2758,8 @@ struct MenuDemo {
|
|||||||
open: bool,
|
open: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for MenuDemo {}
|
||||||
|
|
||||||
impl Render for MenuDemo {
|
impl Render for MenuDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2792,6 +2831,8 @@ impl DropdownMenuDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for DropdownMenuDemo {}
|
||||||
|
|
||||||
impl Render for DropdownMenuDemo {
|
impl Render for DropdownMenuDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2943,6 +2984,8 @@ struct ContextMenuDemo {
|
|||||||
action: SharedString,
|
action: SharedString,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ContextMenuDemo {}
|
||||||
|
|
||||||
impl Render for ContextMenuDemo {
|
impl Render for ContextMenuDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -2998,6 +3041,8 @@ struct PopoverDemo {
|
|||||||
open: bool,
|
open: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for PopoverDemo {}
|
||||||
|
|
||||||
impl Render for PopoverDemo {
|
impl Render for PopoverDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -3039,6 +3084,8 @@ impl Render for PopoverDemo {
|
|||||||
|
|
||||||
struct TooltipDemo;
|
struct TooltipDemo;
|
||||||
|
|
||||||
|
impl Panel for TooltipDemo {}
|
||||||
|
|
||||||
impl Render for TooltipDemo {
|
impl Render for TooltipDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -3084,6 +3131,8 @@ impl Render for TooltipDemo {
|
|||||||
|
|
||||||
struct EmptyStateDemo;
|
struct EmptyStateDemo;
|
||||||
|
|
||||||
|
impl Panel for EmptyStateDemo {}
|
||||||
|
|
||||||
impl Render for EmptyStateDemo {
|
impl Render for EmptyStateDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
@@ -3130,6 +3179,8 @@ impl Render for EmptyStateDemo {
|
|||||||
|
|
||||||
struct ScrollAreaDemo;
|
struct ScrollAreaDemo;
|
||||||
|
|
||||||
|
impl Panel for ScrollAreaDemo {}
|
||||||
|
|
||||||
impl Render for ScrollAreaDemo {
|
impl Render for ScrollAreaDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
@@ -3212,6 +3263,8 @@ impl ScrollbarDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ScrollbarDemo {}
|
||||||
|
|
||||||
impl Render for ScrollbarDemo {
|
impl Render for ScrollbarDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
@@ -3421,6 +3474,8 @@ impl CodeViewDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for CodeViewDemo {}
|
||||||
|
|
||||||
impl Render for CodeViewDemo {
|
impl Render for CodeViewDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -3591,6 +3646,8 @@ impl DiffViewDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for DiffViewDemo {}
|
||||||
|
|
||||||
impl Render for DiffViewDemo {
|
impl Render for DiffViewDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -3811,6 +3868,8 @@ impl MarkdownViewDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for MarkdownViewDemo {}
|
||||||
|
|
||||||
impl Render for MarkdownViewDemo {
|
impl Render for MarkdownViewDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -3887,6 +3946,8 @@ impl TextViewDemo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for TextViewDemo {}
|
||||||
|
|
||||||
impl Render for TextViewDemo {
|
impl Render for TextViewDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let colors = cx.theme().colors;
|
let colors = cx.theme().colors;
|
||||||
@@ -3934,6 +3995,8 @@ struct SidebarDemo {
|
|||||||
selected: Option<usize>,
|
selected: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for SidebarDemo {}
|
||||||
|
|
||||||
impl Render for SidebarDemo {
|
impl Render for SidebarDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -4102,6 +4165,8 @@ impl ResizeDemo {
|
|||||||
const WIDTH_MAX_REMS: f32 = 20.;
|
const WIDTH_MAX_REMS: f32 = 20.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Panel for ResizeDemo {}
|
||||||
|
|
||||||
impl Render for ResizeDemo {
|
impl Render for ResizeDemo {
|
||||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let view = cx.entity();
|
let view = cx.entity();
|
||||||
@@ -4180,6 +4245,8 @@ impl Render for ResizeDemo {
|
|||||||
|
|
||||||
struct ThemeDemo;
|
struct ThemeDemo;
|
||||||
|
|
||||||
|
impl Panel for ThemeDemo {}
|
||||||
|
|
||||||
impl Render for ThemeDemo {
|
impl Render for ThemeDemo {
|
||||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
|
|||||||
Reference in New Issue
Block a user