pub struct TileContext { /* private fields */ }Expand description
Everything gpui_base::dock exports, so a consumer never has to depend
on the foundation crate directly to write a skin or read a container’s
state. Kept in step with base’s own list by
every_base_dock_export_is_reachable_from_here.
Two names are handled elsewhere and one is deliberately absent:
base’s Panel and PanelView arrive as BasePanel and BasePanelView
because this module’s Panel/PanelView are the presentation halves that
extend them, and base’s Dock — a plain state struct holding one dock’s
open, collapsible, size and resizing flags — is not re-exported at all,
because the name meant a panel container in every released version of this
crate and handing it back with a different meaning is worse than dropping
it. A skin reads a dock through DockContext.
What a skin needs to draw one tile, and the callbacks it invokes rather
than reimplementing the snapping and resize arithmetic.
Implementations§
Source§impl TileContext
impl TileContext
Sourcepub fn node(&self) -> NodeId
pub fn node(&self) -> NodeId
The Tiles node this tile belongs to, for a skin that needs to name
the canvas in a drag payload or a drop target.
pub fn panel(&self) -> &Arc<dyn PanelView> ⓘ
pub fn panel_id(&self) -> PanelId
pub fn bounds(&self) -> Bounds<Pixels>
pub fn z_index(&self) -> usize
pub fn is_moving(&self) -> bool
pub fn is_resizing(&self) -> bool
pub fn is_closable(&self) -> bool
Sourcepub fn is_zoomed(&self) -> bool
pub fn is_zoomed(&self) -> bool
Whether this tile is the one filling the whole dock.
A zoomed tile is drawn without its stored bounds and takes no move or resize gesture, so a skin should offer the way back out here rather than the affordances of a tile that can still be dragged.
Sourcepub fn is_zoomable(&self) -> bool
pub fn is_zoomable(&self) -> bool
Whether this tile’s panel allows zooming at all. Where the zoom control appears is the skin’s decision; whether there is one to offer is not.
Sourcepub fn begin_move(
&self,
pointer: Point<Pixels>,
window: &mut Window,
cx: &mut App,
)
pub fn begin_move( &self, pointer: Point<Pixels>, window: &mut Window, cx: &mut App, )
Pointer positions are in window coordinates: every gesture is resolved against the position the gesture started at, so the skin never has to convert into canvas space.
pub fn move_to(&self, pointer: Point<Pixels>, window: &mut Window, cx: &mut App)
pub fn end_move(&self, window: &mut Window, cx: &mut App)
pub fn begin_resize( &self, side: ResizeSide, pointer: Point<Pixels>, window: &mut Window, cx: &mut App, )
pub fn resize_to( &self, pointer: Point<Pixels>, window: &mut Window, cx: &mut App, )
pub fn end_resize(&self, window: &mut Window, cx: &mut App)
pub fn bring_to_front(&self, window: &mut Window, cx: &mut App)
Sourcepub fn toggle_zoom(&self, window: &mut Window, cx: &mut App)
pub fn toggle_zoom(&self, window: &mut Window, cx: &mut App)
Flip this tile between filling the whole dock and sitting at its stored bounds.
Zooming in is refused when Self::is_zoomable is false, so a skin
that offers a Zoom control should gate it on that. Zooming out is
never refused.
Sourcepub fn close(&self, window: &mut Window, cx: &mut App)
pub fn close(&self, window: &mut Window, cx: &mut App)
Dismiss this tile. Refused when Self::is_closable is false, so a
skin that offers a Close control should gate it on that.
Trait Implementations§
Source§impl Clone for TileContext
impl Clone for TileContext
Source§fn clone(&self) -> TileContext
fn clone(&self) -> TileContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TileContext
impl !Send for TileContext
impl !Sync for TileContext
impl !UnwindSafe for TileContext
impl Freeze for TileContext
impl Unpin for TileContext
impl UnsafeUnpin for TileContext
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