hex_patch/app/plugins/
event.rs1use bitflags::bitflags;
2use crossterm::event::{KeyEvent, MouseEvent};
3
4use super::ui_location::ui_location::UiLocation;
5
6pub enum Event<'app> {
7 Open,
8 Edit {
9 new_bytes: &'app mut Vec<u8>,
10 },
11 Save,
12 Key {
13 event: KeyEvent,
14 },
15 Mouse {
17 event: MouseEvent,
18 location: Option<UiLocation>,
19 },
20 Focus,
21 Blur,
22 Paste {
23 text: String,
24 },
25 Resize {
26 width: u16,
27 height: u16,
28 },
29}
30
31bitflags! {
32 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
33 pub struct Events: u16
34 {
35 const ON_OPEN = 0b0000_0000_0000_0001;
36 const ON_EDIT = 0b0000_0000_0000_0010;
37 const ON_SAVE = 0b0000_0000_0000_0100;
38 const ON_KEY = 0b0000_0000_0000_1000;
39 const ON_MOUSE = 0b0000_0000_0001_0000;
40 const ON_FOCUS = 0b0000_0000_0010_0000;
41 const ON_BLUR = 0b0000_0000_0100_0000;
42 const ON_PASTE = 0b0000_0000_1000_0000;
43 const ON_RESIZE = 0b0000_0001_0000_0000;
44
45 const NONE = 0b0000_0000_0000_0000;
46 }
47}