1use peniko::kurbo::{Point, Rect};
2use smallvec::SmallVec;
3use std::{cell::RefCell, rc::Rc};
4
5use crate::platform::menu::Menu;
6use crate::{
7 event::{Event, EventPropagation},
8 view::ViewId,
9};
10
11pub type EventCallback = dyn FnMut(&Event) -> EventPropagation;
12pub type ResizeCallback = dyn Fn(Rect);
13pub type MenuCallback = dyn Fn() -> Menu;
14
15pub type EventListenerVec = SmallVec<[Rc<RefCell<EventCallback>>; 1]>;
19
20#[derive(Default)]
21pub(crate) struct ResizeListeners {
22 pub(crate) rect: Rect,
23 pub(crate) callbacks: Vec<Rc<ResizeCallback>>,
24}
25
26#[derive(Default)]
28pub(crate) struct MoveListeners {
29 pub(crate) window_origin: Point,
30 pub(crate) callbacks: Vec<Rc<dyn Fn(Point)>>,
31}
32
33pub(crate) type CleanupListeners = Vec<Rc<dyn Fn()>>;
34
35pub(crate) enum FrameUpdate {
36 Style(ViewId),
37 Layout(ViewId),
38 Paint(ViewId),
39}
40
41pub use crate::event::EventCx;
43pub use crate::window::state::DragState;
45
46pub use crate::layout::{ComputeLayoutCx, LayoutCx};
48pub use crate::style::{InteractionState, StyleCx};
50pub use crate::paint::{PaintCx, PaintState};
52pub use crate::message::UpdateCx;