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
use fltk::*;
pub fn window() -> window::Window {
let (w, h) = app::screen_size();
let mut win = fltk::window::Window::new(0, 30, w as i32, h as i32 - 30, "");
win.set_color(Color::White);
win
}
pub fn widget<W: fltk::WidgetExt + WidgetBase>(x: i32, y: i32, w: i32, h: i32, label: &str) -> W {
let mut w = W::new((x - w / 2) as i32, (y - h / 2) as i32, w * 2, h * 2, label);
w.set_label_size(36);
w.clear_visible_focus();
w.set_frame(FrameType::RFlatBox);
w.set_selection_color(Color::from_u32(0x12005e));
w.set_label_color(Color::White);
w.set_color(Color::from_u32(0x4a148c));
w
}
pub fn inout_widget<IO: fltk::WidgetBase + fltk::InputExt>(
x: i32,
y: i32,
w: i32,
h: i32,
label: &str,
) -> IO {
let mut w = IO::new((x - w / 2) as i32, (y - h / 2) as i32, w * 2, h * 2, label);
w.set_label_size(36);
w.set_text_size(36);
w
}
pub fn display_widget<Disp: fltk::WidgetBase + fltk::DisplayExt>(
x: i32,
y: i32,
w: i32,
h: i32,
label: &str,
) -> Disp {
let mut w = Disp::new((x - w / 2) as i32, (y - h / 2) as i32, w * 2, h * 2, label);
w.set_label_size(36);
w.set_text_size(36);
w
}