nuit_core/compose/gesture/
gesture.rs1use crate::{Bind, Context, GestureEvent, GestureNode, IdPath};
2
3pub trait Gesture: Bind {
5 type Body: Gesture = NeverGesture;
6
7 fn body(&self) -> Self::Body {
8 panic!("Gesture does not have a body!")
9 }
10
11 fn fire(&self, event: &GestureEvent, event_path: &IdPath, context: &Context) {
12 self.bind(context);
13 self.body().fire(event, event_path, context)
14 }
15
16 fn render(&self, context: &Context) -> GestureNode {
17 self.bind(context);
18 self.body().render(context)
19 }
20}
21
22pub enum NeverGesture {}
24
25impl Bind for NeverGesture {}
26impl Gesture for NeverGesture {}