pub struct PanelHandle(/* private fields */);Expand description
The panel handle gpui-base holds on this crate’s behalf.
Concrete on purpose. Base stores it as
Arc<dyn gpui_base::dock::PanelView>, and every renderer hook — the tab
bar, the tile drag bar — gets it back with Self::of, which is an Any
downcast to this one type. That is the only recovery Rust offers: the
sub-trait object Arc<dyn PanelView> cannot be reconstructed from base’s
handle, but a concrete wrapper around it can be.
Implementations§
Source§impl PanelHandle
impl PanelHandle
pub fn new<P: Panel>(panel: Entity<P>) -> Self
Sourcepub fn from_view(panel: Arc<dyn PanelView>) -> Self
pub fn from_view(panel: Arc<dyn PanelView>) -> Self
Wrap a presentation handle that is already erased.
Sourcepub fn of(panel: &Arc<dyn PanelView>) -> Option<&Self>
pub fn of(panel: &Arc<dyn PanelView>) -> Option<&Self>
Recover the handle behind one of base’s, or None when base is
holding a panel this crate did not wrap — a bare Entity<P> handed
straight to gpui_base::dock::DockLayout::panel, say. A skin must
draw something for that case; base’s own
gpui_base::dock::PanelView::panel_name is the fallback with no
obligations on the panel author.
Sourcepub fn panel(&self) -> Arc<dyn PanelView> ⓘ
pub fn panel(&self) -> Arc<dyn PanelView> ⓘ
The presentation handle, cloned out.
Owned rather than borrowed because the title bar’s ellipsis menu is
built inside a 'static callback: the menu closure outlives the
render_tab_bar call that created it, so it cannot borrow from the
render context it was made in.
Trait Implementations§
Source§impl Clone for PanelHandle
impl Clone for PanelHandle
Source§fn clone(&self) -> PanelHandle
fn clone(&self) -> PanelHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Deref for PanelHandle
So a recovered handle answers the presentation trait directly:
PanelHandle::of(panel)?.title(window, cx). Only Self::panel hands out
an owned clone, which is what a 'static callback needs.
impl Deref for PanelHandle
So a recovered handle answers the presentation trait directly:
PanelHandle::of(panel)?.title(window, cx). Only Self::panel hands out
an owned clone, which is what a 'static callback needs.
Source§impl PanelView for PanelHandle
impl PanelView for PanelHandle
fn panel_name(&self, cx: &App) -> &'static str
fn panel_id(&self, cx: &App) -> PanelId
fn closable(&self, cx: &App) -> bool
fn zoomable(&self, cx: &App) -> bool
fn visible(&self, cx: &App) -> bool
fn set_active(&self, active: bool, window: &mut Window, cx: &mut App)
fn set_zoomed(&self, zoomed: bool, window: &mut Window, cx: &mut App)
fn on_added_to( &self, group: WeakEntity<TabGroup>, window: &mut Window, cx: &mut App, )
fn on_removed(&self, window: &mut Window, cx: &mut App)
fn view(&self) -> AnyView
fn focus_handle(&self, cx: &App) -> FocusHandle
fn dump(&self, cx: &App) -> PanelState
Auto Trait Implementations§
impl !RefUnwindSafe for PanelHandle
impl !UnwindSafe for PanelHandle
impl Freeze for PanelHandle
impl Send for PanelHandle
impl Sync for PanelHandle
impl Unpin for PanelHandle
impl UnsafeUnpin for PanelHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more