Skip to main content

Module page_sidebar

Module page_sidebar 

Expand description

PageSidebar — a shared, reorderable page/slide preview rail: the PDF reader’s page rail and the presentation editor’s slide rail both drive this one widget. It owns the list geometry, scroll, drag-to-reorder (via DragController), a right-click menu, and an optional “add” affordance, emitting PageSidebarEvents the host applies to its model.

The widget does not know how to paint a page or slide — the host passes a thumbnail-draw closure — but draws everything else (frame, selection ring, index number, reflow gap, drag ghost, scrollbar, menu).

The host is imperative (draws into a Scene each frame), so the primary API is PageSidebar::begin_frame / render / pointer- event methods; the Widget impl is a thin shim for the e2e harness.

Structs§

PageSidebar
RailMetrics
The rail’s geometry, on the spacing scale. RailMetrics::DEFAULT restates the scale as the constants above — what PageSidebar::begin_frame has always laid out with, for a host that runs its layout pass without a Theme. A host that has one calls PageSidebar::begin_frame_with_theme and the same values are read from theme.tokens instead, so a density change reaches the rail.

Enums§

PageSidebarEvent
Something the host should do to its page/slide model in response to a sidebar interaction. The ordering-changing variants flag that a save is needed.

Functions§

duplicate_after
Insert a clone of the item at index immediately after it. A no-op when index is out of range.
move_item
Move the item at from to final index to in v, matching the (from, to) a DragController commit yields. A no-op when either index is out of range or they are equal. Shared so the reorder applied to the model is identical to the reflow the rail previewed.