|
|
@ -7,7 +7,7 @@ use crate::{
|
|
|
|
time::Duration,
|
|
|
|
time::Duration,
|
|
|
|
ui::{
|
|
|
|
ui::{
|
|
|
|
button_request::{ButtonRequest, ButtonRequestCode},
|
|
|
|
button_request::{ButtonRequest, ButtonRequestCode},
|
|
|
|
component::{maybe::PaintOverlapping, MsgMap},
|
|
|
|
component::{maybe::PaintOverlapping, MsgMap, PageMap},
|
|
|
|
display::{self, Color},
|
|
|
|
display::{self, Color},
|
|
|
|
geometry::{Offset, Rect},
|
|
|
|
geometry::{Offset, Rect},
|
|
|
|
shape::Renderer,
|
|
|
|
shape::Renderer,
|
|
|
@ -415,6 +415,7 @@ where
|
|
|
|
|
|
|
|
|
|
|
|
pub trait ComponentExt: Sized {
|
|
|
|
pub trait ComponentExt: Sized {
|
|
|
|
fn map<F>(self, func: F) -> MsgMap<Self, F>;
|
|
|
|
fn map<F>(self, func: F) -> MsgMap<Self, F>;
|
|
|
|
|
|
|
|
fn with_pages<F>(self, func: F) -> PageMap<Self, F>;
|
|
|
|
fn into_child(self) -> Child<Self>;
|
|
|
|
fn into_child(self) -> Child<Self>;
|
|
|
|
fn request_complete_repaint(&mut self, ctx: &mut EventCtx);
|
|
|
|
fn request_complete_repaint(&mut self, ctx: &mut EventCtx);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -427,6 +428,10 @@ where
|
|
|
|
MsgMap::new(self, func)
|
|
|
|
MsgMap::new(self, func)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn with_pages<F>(self, func: F) -> PageMap<Self, F> {
|
|
|
|
|
|
|
|
PageMap::new(self, func)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn into_child(self) -> Child<Self> {
|
|
|
|
fn into_child(self) -> Child<Self> {
|
|
|
|
Child::new(self)
|
|
|
|
Child::new(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -569,6 +574,10 @@ impl EventCtx {
|
|
|
|
self.page_count = Some(count);
|
|
|
|
self.page_count = Some(count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn map_page_count(&mut self, func: impl Fn(usize) -> usize) {
|
|
|
|
|
|
|
|
self.page_count = Some(func(self.page_count.unwrap_or(1)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn page_count(&self) -> Option<usize> {
|
|
|
|
pub fn page_count(&self) -> Option<usize> {
|
|
|
|
self.page_count
|
|
|
|
self.page_count
|
|
|
|
}
|
|
|
|
}
|
|
|
|