empty.rs

 1use crate::{
 2    AfterLayoutContext, Element, Event, EventContext, LayoutContext, PaintContext, SizeConstraint,
 3};
 4use pathfinder_geometry::{rect::RectF, vector::Vector2F};
 5
 6pub struct Empty;
 7
 8impl Empty {
 9    pub fn new() -> Self {
10        Self
11    }
12}
13
14impl Element for Empty {
15    type LayoutState = ();
16    type PaintState = ();
17
18    fn layout(
19        &mut self,
20        constraint: SizeConstraint,
21        _: &mut LayoutContext,
22    ) -> (Vector2F, Self::LayoutState) {
23        (constraint.max, ())
24    }
25
26    fn after_layout(&mut self, _: Vector2F, _: &mut Self::LayoutState, _: &mut AfterLayoutContext) {
27    }
28
29    fn paint(
30        &mut self,
31        _: RectF,
32        _: &mut Self::LayoutState,
33        _: &mut PaintContext,
34    ) -> Self::PaintState {
35    }
36
37    fn dispatch_event(
38        &mut self,
39        _: &Event,
40        _: RectF,
41        _: &mut Self::LayoutState,
42        _: &mut Self::PaintState,
43        _: &mut EventContext,
44    ) -> bool {
45        false
46    }
47}