pub trait TilesRenderer: 'static {
// Required method
fn render_drag_bar(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement;
// Provided methods
fn frame(&self, window: &mut Window, cx: &mut App) -> Stateful<Div> { ... }
fn tile_frame(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div> { ... }
fn render_resize_handles(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement { ... }
fn panel_frame(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div> { ... }
fn render_overlay(
&self,
content: Size<Pixels>,
window: &mut Window,
cx: &mut App,
) -> Option<AnyElement> { ... }
fn grid_size(&self, cx: &App) -> Pixels { ... }
}Expand description
Appearance for a tiles canvas. Base draws none of it.
Like TabGroupRenderer, the frame hooks return
the element itself rather than wrapping one: base attaches focus and drop
handling to the canvas frame and the stored bounds to the tile frame, so a
wrapper would put the hit area and the painted area on different elements.
That is also why there is no wrap_canvas hook — it would be exactly the
wrapper the TabGroupRenderer review ruled out.
Required Methods§
Sourcefn render_drag_bar(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement
fn render_drag_bar( &self, tile: &TileContext, window: &mut Window, cx: &mut App, ) -> AnyElement
The strip the tile is dragged by. Its height is
DRAG_BAR_HEIGHT, which base’s snapping
arithmetic and the skin must agree on.
Provided Methods§
Sourcefn frame(&self, window: &mut Window, cx: &mut App) -> Stateful<Div>
fn frame(&self, window: &mut Window, cx: &mut App) -> Stateful<Div>
The canvas frame, which base tracks focus and drop handling on.
Sourcefn tile_frame(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div>
fn tile_frame( &self, tile: &TileContext, window: &mut Window, cx: &mut App, ) -> Stateful<Div>
One tile’s frame, which base positions at the tile’s stored bounds.
Sourcefn render_resize_handles(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement
fn render_resize_handles( &self, tile: &TileContext, window: &mut Window, cx: &mut App, ) -> AnyElement
The tile’s resize affordances. Their hit size is
HANDLE_SIZE.
Sourcefn panel_frame(
&self,
tile: &TileContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div>
fn panel_frame( &self, tile: &TileContext, window: &mut Window, cx: &mut App, ) -> Stateful<Div>
The frame around one tile’s panel view.
A wrapper, unlike the other frame hooks, and for the same reason
DockAreaRenderer::split_frame
is one: base attaches nothing to it, so there is no hit area to keep
together with the painted area. It exists because base draws the panel
as an ordinary child of the tile frame, and a panel that does not size
itself would otherwise have no size at all — the old canvas wrapped it
in h_flex().overflow_hidden().size_full(), and nothing else can put
that back.
Sourcefn render_overlay(
&self,
content: Size<Pixels>,
window: &mut Window,
cx: &mut App,
) -> Option<AnyElement>
fn render_overlay( &self, content: Size<Pixels>, window: &mut Window, cx: &mut App, ) -> Option<AnyElement>
An element drawn above every tile — a scrollbar, a drop hint.
Rendered last, so it paints and hit-tests above the tiles. That ordering is the whole point: the canvas frame is the scroll container, so an overlay placed with the frame’s own children would sit beneath every tile. Not called while a tile is zoomed, because then the canvas is one tile filling the dock rather than a canvas.
content is the scrollable extent of every tile measured from the
canvas origin, which a scrollbar needs and a hook holding only
&mut App could not work out.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".