aboutsummaryrefslogtreecommitdiffstats
path: root/src/win32/event.rs
blob: a77f40c5ae8889d4f764c9cab16ba8864148ed67 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
use events;
use super::ffi;

pub fn vkeycode_to_element(code: ffi::WPARAM) -> Option<events::VirtualKeyCode> {
    Some(match code {
        //ffi::VK_LBUTTON => events::VirtualKeyCode::Lbutton,
        //ffi::VK_RBUTTON => events::VirtualKeyCode::Rbutton,
        //ffi::VK_CANCEL => events::VirtualKeyCode::Cancel,
        //ffi::VK_MBUTTON => events::VirtualKeyCode::Mbutton,
        //ffi::VK_XBUTTON1 => events::VirtualKeyCode::Xbutton1,
        //ffi::VK_XBUTTON2 => events::VirtualKeyCode::Xbutton2,
        ffi::VK_BACK => events::VirtualKeyCode::Back,
        ffi::VK_TAB => events::VirtualKeyCode::Tab,
        //ffi::VK_CLEAR => events::VirtualKeyCode::Clear,
        ffi::VK_RETURN => events::VirtualKeyCode::Return,
        //ffi::VK_SHIFT => events::VirtualKeyCode::Shift,
        //ffi::VK_CONTROL => events::VirtualKeyCode::Control,
        //ffi::VK_MENU => events::VirtualKeyCode::Menu,
        ffi::VK_PAUSE => events::VirtualKeyCode::Pause,
        ffi::VK_CAPITAL => events::VirtualKeyCode::Capital,
        ffi::VK_KANA => events::VirtualKeyCode::Kana,
        //ffi::VK_HANGUEL => events::VirtualKeyCode::Hanguel,
        //ffi::VK_HANGUL => events::VirtualKeyCode::Hangul,
        //ffi::VK_JUNJA => events::VirtualKeyCode::Junja,
        //ffi::VK_FINAL => events::VirtualKeyCode::Final,
        //ffi::VK_HANJA => events::VirtualKeyCode::Hanja,
        ffi::VK_KANJI => events::VirtualKeyCode::Kanji,
        ffi::VK_ESCAPE => events::VirtualKeyCode::Escape,
        ffi::VK_CONVERT => events::VirtualKeyCode::Convert,
        //ffi::VK_NONCONVERT => events::VirtualKeyCode::Nonconvert,
        //ffi::VK_ACCEPT => events::VirtualKeyCode::Accept,
        //ffi::VK_MODECHANGE => events::VirtualKeyCode::Modechange,
        ffi::VK_SPACE => events::VirtualKeyCode::Space,
        ffi::VK_PRIOR => events::VirtualKeyCode::PageUp,
        ffi::VK_NEXT => events::VirtualKeyCode::PageDown,
        ffi::VK_END => events::VirtualKeyCode::End,
        ffi::VK_HOME => events::VirtualKeyCode::Home,
        ffi::VK_LEFT => events::VirtualKeyCode::Left,
        ffi::VK_UP => events::VirtualKeyCode::Up,
        ffi::VK_RIGHT => events::VirtualKeyCode::Right,
        ffi::VK_DOWN => events::VirtualKeyCode::Down,
        //ffi::VK_SELECT => events::VirtualKeyCode::Select,
        //ffi::VK_PRINT => events::VirtualKeyCode::Print,
        //ffi::VK_EXECUTE => events::VirtualKeyCode::Execute,
        ffi::VK_SNAPSHOT => events::VirtualKeyCode::Snapshot,
        ffi::VK_INSERT => events::VirtualKeyCode::Insert,
        ffi::VK_DELETE => events::VirtualKeyCode::Delete,
        //ffi::VK_HELP => events::VirtualKeyCode::Help,
        0x30 => events::VirtualKeyCode::Key0,
        0x31 => events::VirtualKeyCode::Key1,
        0x32 => events::VirtualKeyCode::Key2,
        0x33 => events::VirtualKeyCode::Key3,
        0x34 => events::VirtualKeyCode::Key4,
        0x35 => events::VirtualKeyCode::Key5,
        0x36 => events::VirtualKeyCode::Key6,
        0x37 => events::VirtualKeyCode::Key7,
        0x38 => events::VirtualKeyCode::Key8,
        0x39 => events::VirtualKeyCode::Key9,
        0x41 => events::VirtualKeyCode::A,
        0x42 => events::VirtualKeyCode::B,
        0x43 => events::VirtualKeyCode::C,
        0x44 => events::VirtualKeyCode::D,
        0x45 => events::VirtualKeyCode::E,
        0x46 => events::VirtualKeyCode::F,
        0x47 => events::VirtualKeyCode::G,
        0x48 => events::VirtualKeyCode::H,
        0x49 => events::VirtualKeyCode::I,
        0x4A => events::VirtualKeyCode::J,
        0x4B => events::VirtualKeyCode::K,
        0x4C => events::VirtualKeyCode::L,
        0x4D => events::VirtualKeyCode::M,
        0x4E => events::VirtualKeyCode::N,
        0x4F => events::VirtualKeyCode::O,
        0x50 => events::VirtualKeyCode::P,
        0x51 => events::VirtualKeyCode::Q,
        0x52 => events::VirtualKeyCode::R,
        0x53 => events::VirtualKeyCode::S,
        0x54 => events::VirtualKeyCode::T,
        0x55 => events::VirtualKeyCode::U,
        0x56 => events::VirtualKeyCode::V,
        0x57 => events::VirtualKeyCode::W,
        0x58 => events::VirtualKeyCode::X,
        0x59 => events::VirtualKeyCode::Y,
        0x5A => events::VirtualKeyCode::Z,
        //ffi::VK_LWIN => events::VirtualKeyCode::Lwin,
        //ffi::VK_RWIN => events::VirtualKeyCode::Rwin,
        ffi::VK_APPS => events::VirtualKeyCode::Apps,
        ffi::VK_SLEEP => events::VirtualKeyCode::Sleep,
        ffi::VK_NUMPAD0 => events::VirtualKeyCode::Numpad0,
        ffi::VK_NUMPAD1 => events::VirtualKeyCode::Numpad1,
        ffi::VK_NUMPAD2 => events::VirtualKeyCode::Numpad2,
        ffi::VK_NUMPAD3 => events::VirtualKeyCode::Numpad3,
        ffi::VK_NUMPAD4 => events::VirtualKeyCode::Numpad4,
        ffi::VK_NUMPAD5 => events::VirtualKeyCode::Numpad5,
        ffi::VK_NUMPAD6 => events::VirtualKeyCode::Numpad6,
        ffi::VK_NUMPAD7 => events::VirtualKeyCode::Numpad7,
        ffi::VK_NUMPAD8 => events::VirtualKeyCode::Numpad8,
        ffi::VK_NUMPAD9 => events::VirtualKeyCode::Numpad9,
        ffi::VK_MULTIPLY => events::VirtualKeyCode::Multiply,
        ffi::VK_ADD => events::VirtualKeyCode::Add,
        //ffi::VK_SEPARATOR => events::VirtualKeyCode::Separator,
        ffi::VK_SUBTRACT => events::VirtualKeyCode::Subtract,
        ffi::VK_DECIMAL => events::VirtualKeyCode::Decimal,
        ffi::VK_DIVIDE => events::VirtualKeyCode::Divide,
        ffi::VK_F1 => events::VirtualKeyCode::F1,
        ffi::VK_F2 => events::VirtualKeyCode::F2,
        ffi::VK_F3 => events::VirtualKeyCode::F3,
        ffi::VK_F4 => events::VirtualKeyCode::F4,
        ffi::VK_F5 => events::VirtualKeyCode::F5,
        ffi::VK_F6 => events::VirtualKeyCode::F6,
        ffi::VK_F7 => events::VirtualKeyCode::F7,
        ffi::VK_F8 => events::VirtualKeyCode::F8,
        ffi::VK_F9 => events::VirtualKeyCode::F9,
        ffi::VK_F10 => events::VirtualKeyCode::F10,
        ffi::VK_F11 => events::VirtualKeyCode::F11,
        ffi::VK_F12 => events::VirtualKeyCode::F12,
        ffi::VK_F13 => events::VirtualKeyCode::F13,
        ffi::VK_F14 => events::VirtualKeyCode::F14,
        ffi::VK_F15 => events::VirtualKeyCode::F15,
        /*ffi::VK_F16 => events::VirtualKeyCode::F16,
        ffi::VK_F17 => events::VirtualKeyCode::F17,
        ffi::VK_F18 => events::VirtualKeyCode::F18,
        ffi::VK_F19 => events::VirtualKeyCode::F19,
        ffi::VK_F20 => events::VirtualKeyCode::F20,
        ffi::VK_F21 => events::VirtualKeyCode::F21,
        ffi::VK_F22 => events::VirtualKeyCode::F22,
        ffi::VK_F23 => events::VirtualKeyCode::F23,
        ffi::VK_F24 => events::VirtualKeyCode::F24,*/
        ffi::VK_NUMLOCK => events::VirtualKeyCode::Numlock,
        ffi::VK_SCROLL => events::VirtualKeyCode::Scroll,
        /*ffi::VK_LSHIFT => events::VirtualKeyCode::Lshift,
        ffi::VK_RSHIFT => events::VirtualKeyCode::Rshift,
        ffi::VK_LCONTROL => events::VirtualKeyCode::Lcontrol,
        ffi::VK_RCONTROL => events::VirtualKeyCode::Rcontrol,
        ffi::VK_LMENU => events::VirtualKeyCode::Lmenu,
        ffi::VK_RMENU => events::VirtualKeyCode::Rmenu,
        ffi::VK_BROWSER_BACK => events::VirtualKeyCode::Browser_back,
        ffi::VK_BROWSER_FORWARD => events::VirtualKeyCode::Browser_forward,
        ffi::VK_BROWSER_REFRESH => events::VirtualKeyCode::Browser_refresh,
        ffi::VK_BROWSER_STOP => events::VirtualKeyCode::Browser_stop,
        ffi::VK_BROWSER_SEARCH => events::VirtualKeyCode::Browser_search,
        ffi::VK_BROWSER_FAVORITES => events::VirtualKeyCode::Browser_favorites,
        ffi::VK_BROWSER_HOME => events::VirtualKeyCode::Browser_home,
        ffi::VK_VOLUME_MUTE => events::VirtualKeyCode::Volume_mute,
        ffi::VK_VOLUME_DOWN => events::VirtualKeyCode::Volume_down,
        ffi::VK_VOLUME_UP => events::VirtualKeyCode::Volume_up,
        ffi::VK_MEDIA_NEXT_TRACK => events::VirtualKeyCode::Media_next_track,
        ffi::VK_MEDIA_PREV_TRACK => events::VirtualKeyCode::Media_prev_track,
        ffi::VK_MEDIA_STOP => events::VirtualKeyCode::Media_stop,
        ffi::VK_MEDIA_PLAY_PAUSE => events::VirtualKeyCode::Media_play_pause,
        ffi::VK_LAUNCH_MAIL => events::VirtualKeyCode::Launch_mail,
        ffi::VK_LAUNCH_MEDIA_SELECT => events::VirtualKeyCode::Launch_media_select,
        ffi::VK_LAUNCH_APP1 => events::VirtualKeyCode::Launch_app1,
        ffi::VK_LAUNCH_APP2 => events::VirtualKeyCode::Launch_app2,
        ffi::VK_OEM_1 => events::VirtualKeyCode::Oem_1,
        ffi::VK_OEM_PLUS => events::VirtualKeyCode::Oem_plus,
        ffi::VK_OEM_COMMA => events::VirtualKeyCode::Oem_comma,
        ffi::VK_OEM_MINUS => events::VirtualKeyCode::Oem_minus,
        ffi::VK_OEM_PERIOD => events::VirtualKeyCode::Oem_period,
        ffi::VK_OEM_2 => events::VirtualKeyCode::Oem_2,
        ffi::VK_OEM_3 => events::VirtualKeyCode::Oem_3,
        ffi::VK_OEM_4 => events::VirtualKeyCode::Oem_4,
        ffi::VK_OEM_5 => events::VirtualKeyCode::Oem_5,
        ffi::VK_OEM_6 => events::VirtualKeyCode::Oem_6,
        ffi::VK_OEM_7 => events::VirtualKeyCode::Oem_7,
        ffi::VK_OEM_8 => events::VirtualKeyCode::Oem_8,
        ffi::VK_OEM_102 => events::VirtualKeyCode::Oem_102,
        ffi::VK_PROCESSKEY => events::VirtualKeyCode::Processkey,
        ffi::VK_PACKET => events::VirtualKeyCode::Packet,
        ffi::VK_ATTN => events::VirtualKeyCode::Attn,
        ffi::VK_CRSEL => events::VirtualKeyCode::Crsel,
        ffi::VK_EXSEL => events::VirtualKeyCode::Exsel,
        ffi::VK_EREOF => events::VirtualKeyCode::Ereof,
        ffi::VK_PLAY => events::VirtualKeyCode::Play,
        ffi::VK_ZOOM => events::VirtualKeyCode::Zoom,
        ffi::VK_NONAME => events::VirtualKeyCode::Noname,
        ffi::VK_PA1 => events::VirtualKeyCode::Pa1,
        ffi::VK_OEM_CLEAR => events::VirtualKeyCode::Oem_clear,*/
        _ => return None
    })
}