pub struct PagedView<'a, Msg = Callback> {
pub count: usize,
pub axis: Axis,
pub viewport_fraction: f32,
pub extent: Option<f32>,
pub wheel: Option<WheelGeometry>,
pub requested: usize,
pub pad_ends: bool,
pub snapping: bool,
pub build: &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>,
}Expand description
The description of a paged view, exposed to the render driver.
Fields§
§count: usizeTotal number of pages.
axis: AxisWhich way the pages are laid out.
viewport_fraction: f32The fraction of the viewport one page occupies along that axis.
extent: Option<f32>A page extent in pixels, overriding the fraction when set.
A page view states a fraction because a page is a share of the window it is read
in. A crate::ListWheel states pixels, because a row of a wheel is a line of
text and a line of text is not a share of anything.
wheel: Option<WheelGeometry>The cylinder the pages are laid on, when they are laid on one at all — a
crate::ListWheel and nothing else. See crate::WheelGeometry.
requested: usizeThe page asked for by the application.
pad_ends: boolRoom at both ends, so a page narrower than the viewport rests centred in
it; see PageView::pad_ends.
snapping: boolDoes a release come to rest on a page? See PageView::page_snapping.
build: &'a dyn Fn(usize) -> Box<dyn Widget<Msg>>Builds one page per index.
Implementations§
Source§impl<Msg> PagedView<'_, Msg>
impl<Msg> PagedView<'_, Msg>
Sourcepub fn snap(&self, viewport: Rect) -> PageSnap
pub fn snap(&self, viewport: Rect) -> PageSnap
The snapping description for a viewport of this size.
Sourcepub fn end_padding(&self, viewport: Rect) -> f32
pub fn end_padding(&self, viewport: Rect) -> f32
The room at each end of the content, in logical pixels.
Zero at the default fraction of one, where a page already fills the viewport and there is nothing to centre.