//! Shared element constructors and small style helpers. pub use gpui_native_theme::Size; pub use gpui_native_utils::{StyledExt, h_flex, v_flex}; /// A handler told to clean up after a dismissed surface. pub type DismissHandler = std::rc::Rc; /// Deferred draw priority of window-modal surfaces; default layer 0 stays for in-flow chrome like resize handles. pub const DIALOG_LAYER: usize = 1; /// Deferred draw priority of floating panels, so controls inside a dialog open above it. pub const OVERLAY_LAYER: usize = 2; /// Deferred draw priority of passive notifications, so they stay visible over dialogs. pub const TOAST_LAYER: usize = 3; /// A component that can be told which size to render at. pub trait Sizable: Sized { /// Sets the size. fn with_size(mut self, size: Size) -> Self { self.apply_size(size); self } /// Applies the size to the component's fields. fn apply_size(&mut self, size: Size); /// Sets `Size::XSmall`. fn xsmall(self) -> Self where Self: Sized, { self.with_size(Size::XSmall) } /// Sets `Size::Small`. fn small(self) -> Self where Self: Sized, { self.with_size(Size::Small) } /// Sets `Size::Large`. fn large(self) -> Self where Self: Sized, { self.with_size(Size::Large) } }