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
use crate::prelude::*;

#[allow(unused)]
pub trait TheTrait {
    fn new() -> Self
    where
        Self: Sized;

    fn init(&mut self, ctx: &mut TheContext) {}

    fn window_title(&mut self) -> String {
        "TheFramework based App".to_string()
    }

    #[cfg(feature = "ui")]
    fn init_ui(&mut self, ui: &mut TheUI, ctx: &mut TheContext) {}

    fn draw(&mut self, pixels: &mut [u8], ctx: &mut TheContext) {}

    fn update(&mut self, ctx: &mut TheContext) -> bool {
        false
    }

    #[cfg(feature = "ui")]
    fn update_ui(&mut self, ui: &mut TheUI, ctx: &mut TheContext) -> bool {
        false
    }

    fn touch_down(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool {
        false
    }

    fn touch_dragged(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool {
        false
    }

    fn touch_up(&mut self, x: f32, y: f32, ctx: &mut TheContext) -> bool {
        false
    }

    fn hover(&mut self, _x: f32, _y: f32, ctx: &mut TheContext) -> bool {
        false
    }

    fn key_down(
        &mut self,
        char: Option<char>,
        key: Option<TheKeyCode>,
        ctx: &mut TheContext,
    ) -> bool {
        false
    }

    fn mouse_wheel(&mut self, delta: (isize, isize), ctx: &mut TheContext) -> bool {
        false
    }

    fn modifier_changed(&mut self, shift: bool, ctrl: bool, alt: bool, logo: bool) -> bool {
        false
    }

    fn dropped_file(&mut self, _path: String) -> bool {
        false
    }

    /// Open a file requester
    fn open(&mut self) {}

    /// Save the file
    fn save(&mut self) {}

    /// Save the file as...
    fn save_as(&mut self) {}

    // Cut / Copy / Paste

    fn cut(&mut self) -> String {
        "".to_string()
    }

    fn copy(&mut self) -> String {
        "".to_string()
    }

    fn paste(&mut self, text: String) {}

    // Undo / Redo

    fn undo(&mut self) {}

    fn redo(&mut self) {}
}