bexa_ui_core/
framework.rs1use taffy::prelude::*;
2use winit::event::WindowEvent;
3use winit::event::KeyEvent;
4use winit::keyboard::ModifiersState;
5
6pub struct DrawContext<'a> {
7 pub renderer: &'a mut crate::Renderer,
8 pub layout: &'a Layout,
9}
10
11pub struct EventContext<'a> {
12 pub event: &'a WindowEvent,
13 pub layout: &'a Layout,
14}
15
16pub trait Widget {
17 fn style(&self) -> Style {
18 Style::default()
19 }
20
21 fn draw(&self, _ctx: &mut DrawContext) {}
22
23 fn handle_event(&mut self, _ctx: &mut EventContext) -> bool {
24 false
25 }
26
27 fn handle_key_event(&mut self, _event: &KeyEvent, _modifiers: ModifiersState) -> bool {
30 false
31 }
32
33 fn is_focusable(&self) -> bool {
34 false
35 }
36
37 fn set_focus(&mut self, _focused: bool) {}
38
39 fn activate(&mut self) {}
40
41 fn clear_active(&mut self) {}
42
43 fn is_scrollable(&self) -> bool {
44 false
45 }
46
47 fn update_measures(&mut self, _measures: &[Vec<f32>]) {}
49}