1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// use crate::{
// el::ElId,
// event::Event,
// layout::{Layout, Viewport},
// render::Renderer,
// size::{Length, Size},
// widget::Widget,
// };
// #[derive(Clone, Copy)]
// enum KeyAction {
// CaseToggle,
// Enter,
// Char(char),
// }
// macro_rules! keyboard_layout {
// (@key $key: ident) => {
// KeyAction::$key
// };
// (@key $key: literal) => {
// KeyAction::Char($key)
// };
// ($([$($key: tt),* $(,)?]),* $(,)?) => [
// &[
// $(
// &[$(keyboard_layout!(@key $key)),*]
// ),*
// ]
// ];
// }
// const KEYBOARD_LAYOUT: &[&[KeyAction]] = keyboard_layout![
// ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'],
// ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],
// ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';'],
// ['z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/'],
// ];
// pub struct VirtualKeyboard<'a, Message> {
// id: ElId,
// size: Size<Length>,
// on_char: Box<dyn Fn(char) -> Message + 'a>,
// }
// impl<'a, Message> VirtualKeyboard<'a, Message> {
// pub fn new<F>(on_char: F) -> Self
// where
// F: Fn(char) -> Message + 'a,
// {
// Self { id: ElId::unique(), size: Size::fill(), on_char: Box::new(on_char) }
// }
// }
// impl<'a, Message, R, E, S> Widget<Message, R, E, S> for VirtualKeyboard<'a, Message>
// where
// R: Renderer,
// E: Event,
// {
// fn id(&self) -> Option<crate::el::ElId> {
// Some(self.id)
// }
// fn tree_ids(&self) -> Vec<crate::el::ElId> {
// vec![]
// }
// fn size(&self) -> Size<Length> {
// Size::fill()
// }
// fn position(&self) -> crate::layout::Position {
// crate::layout::Position::Absolute
// }
// fn layout(
// &self,
// ctx: &mut crate::ui::UiCtx<Message>,
// state: &mut crate::state::StateNode,
// styler: &S,
// limits: &crate::layout::Limits,
// viewport: &Viewport,
// ) -> crate::layout::LayoutNode {
// Layout::flex(ctx, state, styler, axis, limits, size, position, viewport, padding, gap, align, children)
// }
// fn draw(
// &self,
// ctx: &mut crate::ui::UiCtx<Message>,
// state: &mut crate::state::StateNode,
// renderer: &mut R,
// styler: &S,
// layout: crate::layout::Layout,
// ) {
// todo!()
// }
// }