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§
- Page
Sidebar - Rail
Metrics - The rail’s geometry, on the spacing scale.
RailMetrics::DEFAULTrestates the scale as the constants above — whatPageSidebar::begin_framehas always laid out with, for a host that runs its layout pass without aTheme. A host that has one callsPageSidebar::begin_frame_with_themeand the same values are read fromtheme.tokensinstead, so a density change reaches the rail.
Enums§
- Page
Sidebar Event - 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
indeximmediately after it. A no-op whenindexis out of range. - move_
item - Move the item at
fromto final indextoinv, matching the(from, to)aDragControllercommit 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.