windjammer_ui/
event_handler.rs

1//! Type aliases for event handlers
2
3use std::cell::RefCell;
4use std::rc::Rc;
5
6/// Type alias for a mutable event handler with no arguments
7pub type EventHandler = Rc<RefCell<dyn FnMut()>>;
8
9/// Type alias for a mutable event handler with a String argument
10pub type StringEventHandler = Rc<RefCell<dyn FnMut(String)>>;
11
12/// Type alias for a mutable event handler with a bool argument
13pub type BoolEventHandler = Rc<RefCell<dyn FnMut(bool)>>;
14
15/// Type alias for a mutable event handler with an f64 argument
16pub type F64EventHandler = Rc<RefCell<dyn FnMut(f64)>>;
17
18/// Type alias for a mutable event handler with an [f32; 4] argument (RGBA color)
19pub type ColorEventHandler = Rc<RefCell<dyn FnMut([f32; 4])>>;