aboutsummaryrefslogtreecommitdiffstats
path: root/src/win32/event.rs
blob: 16080eb47e99c73b5ba92da53b7e0cd7c29045d8 (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 winapi;

pub fn vkeycode_to_element(code: winapi::WPARAM) -> Option<events::VirtualKeyCode> {
    Some(match code {
        //winapi::VK_LBUTTON => events::VirtualKeyCode::Lbutton,
        //winapi::VK_RBUTTON => events::VirtualKeyCode::Rbutton,
        //winapi::VK_CANCEL => events::VirtualKeyCode::Cancel,
        //winapi::VK_MBUTTON => events::VirtualKeyCode::Mbutton,
        //winapi::VK_XBUTTON1 => events::VirtualKeyCode::Xbutton1,
        //winapi::VK_XBUTTON2 => events::VirtualKeyCode::Xbutton2,
        winapi::VK_BACK => events::VirtualKeyCode::Back,
        winapi::VK_TAB => events::VirtualKeyCode::Tab,
        //winapi::VK_CLEAR => events::VirtualKeyCode::Clear,
        winapi::VK_RETURN => events::VirtualKeyCode::Return,
        //winapi::VK_SHIFT => events::VirtualKeyCode::Shift,
        //winapi::VK_CONTROL => events::VirtualKeyCode::Control,
        //winapi::VK_MENU => events::VirtualKeyCode::Menu,
        winapi::VK_PAUSE => events::VirtualKeyCode::Pause,
        winapi::VK_CAPITAL => events::VirtualKeyCode::Capital,
        winapi::VK_KANA => events::VirtualKeyCode::Kana,
        //winapi::VK_HANGUEL => events::VirtualKeyCode::Hanguel,
        //winapi::VK_HANGUL => events::VirtualKeyCode::Hangul,
        //winapi::VK_JUNJA => events::VirtualKeyCode::Junja,
        //winapi::VK_FINAL => events::VirtualKeyCode::Final,
        //winapi::VK_HANJA => events::VirtualKeyCode::Hanja,
        winapi::VK_KANJI => events::VirtualKeyCode::Kanji,
        winapi::VK_ESCAPE => events::VirtualKeyCode::Escape,
        winapi::VK_CONVERT => events::VirtualKeyCode::Convert,
        //winapi::VK_NONCONVERT => events::VirtualKeyCode::Nonconvert,
        //winapi::VK_ACCEPT => events::VirtualKeyCode::Accept,
        //winapi::VK_MODECHANGE => events::VirtualKeyCode::Modechange,
        winapi::VK_SPACE => events::VirtualKeyCode::Space,
        winapi::VK_PRIOR => events::VirtualKeyCode::PageUp,
        winapi::VK_NEXT => events::VirtualKeyCode::PageDown,
        winapi::VK_END => events::VirtualKeyCode::End,
        winapi::VK_HOME => events::VirtualKeyCode::Home,
        winapi::VK_LEFT => events::VirtualKeyCode::Left,
        winapi::VK_UP => events::VirtualKeyCode::Up,
        winapi::VK_RIGHT => events::VirtualKeyCode::Right,
        winapi::VK_DOWN => events::VirtualKeyCode::Down,
        //winapi::VK_SELECT => events::VirtualKeyCode::Select,
        //winapi::VK_PRINT => events::VirtualKeyCode::Print,
        //winapi::VK_EXECUTE => events::VirtualKeyCode::Execute,
        winapi::VK_SNAPSHOT => events::VirtualKeyCode::Snapshot,
        winapi::VK_INSERT => events::VirtualKeyCode::Insert,
        winapi::VK_DELETE => events::VirtualKeyCode::Delete,
        //winapi::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,
        //winapi::VK_LWIN => events::VirtualKeyCode::Lwin,
        //winapi::VK_RWIN => events::VirtualKeyCode::Rwin,
        winapi::VK_APPS => events::VirtualKeyCode::Apps,
        winapi::VK_SLEEP => events::VirtualKeyCode::Sleep,
        winapi::VK_NUMPAD0 => events::VirtualKeyCode::Numpad0,
        winapi::VK_NUMPAD1 => events::VirtualKeyCode::Numpad1,
        winapi::VK_NUMPAD2 => events::VirtualKeyCode::Numpad2,
        winapi::VK_NUMPAD3 => events::VirtualKeyCode::Numpad3,
        winapi::VK_NUMPAD4 => events::VirtualKeyCode::Numpad4,
        winapi::VK_NUMPAD5 => events::VirtualKeyCode::Numpad5,
        winapi::VK_NUMPAD6 => events::VirtualKeyCode::Numpad6,
        winapi::VK_NUMPAD7 => events::VirtualKeyCode::Numpad7,
        winapi::VK_NUMPAD8 => events::VirtualKeyCode::Numpad8,
        winapi::VK_NUMPAD9 => events::VirtualKeyCode::Numpad9,
        winapi::VK_MULTIPLY => events::VirtualKeyCode::Multiply,
        winapi::VK_ADD => events::VirtualKeyCode::Add,
        //winapi::VK_SEPARATOR => events::VirtualKeyCode::Separator,
        winapi::VK_SUBTRACT => events::VirtualKeyCode::Subtract,
        winapi::VK_DECIMAL => events::VirtualKeyCode::Decimal,
        winapi::VK_DIVIDE => events::VirtualKeyCode::Divide,
        winapi::VK_F1 => events::VirtualKeyCode::F1,
        winapi::VK_F2 => events::VirtualKeyCode::F2,
        winapi::VK_F3 => events::VirtualKeyCode::F3,
        winapi::VK_F4 => events::VirtualKeyCode::F4,
        winapi::VK_F5 => events::VirtualKeyCode::F5,
        winapi::VK_F6 => events::VirtualKeyCode::F6,
        winapi::VK_F7 => events::VirtualKeyCode::F7,
        winapi::VK_F8 => events::VirtualKeyCode::F8,
        winapi::VK_F9 => events::VirtualKeyCode::F9,
        winapi::VK_F10 => events::VirtualKeyCode::F10,
        winapi::VK_F11 => events::VirtualKeyCode::F11,
        winapi::VK_F12 => events::VirtualKeyCode::F12,
        winapi::VK_F13 => events::VirtualKeyCode::F13,
        winapi::VK_F14 => events::VirtualKeyCode::F14,
        winapi::VK_F15 => events::VirtualKeyCode::F15,
        /*winapi::VK_F16 => events::VirtualKeyCode::F16,
        winapi::VK_F17 => events::VirtualKeyCode::F17,
        winapi::VK_F18 => events::VirtualKeyCode::F18,
        winapi::VK_F19 => events::VirtualKeyCode::F19,
        winapi::VK_F20 => events::VirtualKeyCode::F20,
        winapi::VK_F21 => events::VirtualKeyCode::F21,
        winapi::VK_F22 => events::VirtualKeyCode::F22,
        winapi::VK_F23 => events::VirtualKeyCode::F23,
        winapi::VK_F24 => events::VirtualKeyCode::F24,*/
        winapi::VK_NUMLOCK => events::VirtualKeyCode::Numlock,
        winapi::VK_SCROLL => events::VirtualKeyCode::Scroll,
        /*winapi::VK_LSHIFT => events::VirtualKeyCode::Lshift,
        winapi::VK_RSHIFT => events::VirtualKeyCode::Rshift,
        winapi::VK_LCONTROL => events::VirtualKeyCode::Lcontrol,
        winapi::VK_RCONTROL => events::VirtualKeyCode::Rcontrol,
        winapi::VK_LMENU => events::VirtualKeyCode::Lmenu,
        winapi::VK_RMENU => events::VirtualKeyCode::Rmenu,
        winapi::VK_BROWSER_BACK => events::VirtualKeyCode::Browser_back,
        winapi::VK_BROWSER_FORWARD => events::VirtualKeyCode::Browser_forward,
        winapi::VK_BROWSER_REFRESH => events::VirtualKeyCode::Browser_refresh,
        winapi::VK_BROWSER_STOP => events::VirtualKeyCode::Browser_stop,
        winapi::VK_BROWSER_SEARCH => events::VirtualKeyCode::Browser_search,
        winapi::VK_BROWSER_FAVORITES => events::VirtualKeyCode::Browser_favorites,
        winapi::VK_BROWSER_HOME => events::VirtualKeyCode::Browser_home,
        winapi::VK_VOLUME_MUTE => events::VirtualKeyCode::Volume_mute,
        winapi::VK_VOLUME_DOWN => events::VirtualKeyCode::Volume_down,
        winapi::VK_VOLUME_UP => events::VirtualKeyCode::Volume_up,
        winapi::VK_MEDIA_NEXT_TRACK => events::VirtualKeyCode::Media_next_track,
        winapi::VK_MEDIA_PREV_TRACK => events::VirtualKeyCode::Media_prev_track,
        winapi::VK_MEDIA_STOP => events::VirtualKeyCode::Media_stop,
        winapi::VK_MEDIA_PLAY_PAUSE => events::VirtualKeyCode::Media_play_pause,
        winapi::VK_LAUNCH_MAIL => events::VirtualKeyCode::Launch_mail,
        winapi::VK_LAUNCH_MEDIA_SELECT => events::VirtualKeyCode::Launch_media_select,
        winapi::VK_LAUNCH_APP1 => events::VirtualKeyCode::Launch_app1,
        winapi::VK_LAUNCH_APP2 => events::VirtualKeyCode::Launch_app2,
        winapi::VK_OEM_1 => events::VirtualKeyCode::Oem_1,
        winapi::VK_OEM_PLUS => events::VirtualKeyCode::Oem_plus,
        winapi::VK_OEM_COMMA => events::VirtualKeyCode::Oem_comma,
        winapi::VK_OEM_MINUS => events::VirtualKeyCode::Oem_minus,
        winapi::VK_OEM_PERIOD => events::VirtualKeyCode::Oem_period,
        winapi::VK_OEM_2 => events::VirtualKeyCode::Oem_2,
        winapi::VK_OEM_3 => events::VirtualKeyCode::Oem_3,
        winapi::VK_OEM_4 => events::VirtualKeyCode::Oem_4,
        winapi::VK_OEM_5 => events::VirtualKeyCode::Oem_5,
        winapi::VK_OEM_6 => events::VirtualKeyCode::Oem_6,
        winapi::VK_OEM_7 => events::VirtualKeyCode::Oem_7,
        winapi::VK_OEM_8 => events::VirtualKeyCode::Oem_8,
        winapi::VK_OEM_102 => events::VirtualKeyCode::Oem_102,
        winapi::VK_PROCESSKEY => events::VirtualKeyCode::Processkey,
        winapi::VK_PACKET => events::VirtualKeyCode::Packet,
        winapi::VK_ATTN => events::VirtualKeyCode::Attn,
        winapi::VK_CRSEL => events::VirtualKeyCode::Crsel,
        winapi::VK_EXSEL => events::VirtualKeyCode::Exsel,
        winapi::VK_EREOF => events::VirtualKeyCode::Ereof,
        winapi::VK_PLAY => events::VirtualKeyCode::Play,
        winapi::VK_ZOOM => events::VirtualKeyCode::Zoom,
        winapi::VK_NONAME => events::VirtualKeyCode::Noname,
        winapi::VK_PA1 => events::VirtualKeyCode::Pa1,
        winapi::VK_OEM_CLEAR => events::VirtualKeyCode::Oem_clear,*/
        _ => return None
    })
}