1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use quicksilver::graphics::Graphics;
use quicksilver::{lifecycle::Window, mint::Vector2};
pub trait WidgetConfig<R: Sized, W: Widget> {
fn to_widget(self) -> (W, R);
}
pub trait Widget {
fn contains(&self, pos: &Vector2<f32>) -> bool;
fn is_focusable(&self, pos: &Vector2<f32>) -> bool;
fn render(&mut self, gfx: &mut Graphics, window: &Window) -> quicksilver::Result<()>;
fn get_cursor_on_hover(&self, _: &Vector2<f32>) -> quicksilver::lifecycle::CursorIcon {
quicksilver::lifecycle::CursorIcon::Default
}
fn set_focus(&mut self, _: &Vector2<f32>, _: bool) {}
fn set_hover(&mut self, _: &Vector2<f32>, _: bool) {}
fn on_click(&mut self, _location: &Vector2<f32>) {}
fn on_key_press(&mut self, _key: quicksilver::blinds::event::Key, _state: bool) {}
fn on_typed(&mut self, _char: char) {}
}