-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathcursor.rs
More file actions
38 lines (36 loc) · 1.42 KB
/
cursor.rs
File metadata and controls
38 lines (36 loc) · 1.42 KB
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
use winapi::{
shared::ntdef::PCWSTR,
um::winuser::{
IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP, IDC_IBEAM, IDC_NO, IDC_SIZEALL, IDC_WAIT,
},
};
use crate::MouseCursor;
impl MouseCursor {
pub(crate) fn to_windows_cursor(self) -> PCWSTR {
match self {
MouseCursor::Default => IDC_ARROW,
MouseCursor::Hand | MouseCursor::Pointer => IDC_HAND,
MouseCursor::HandGrabbing
| MouseCursor::Move
| MouseCursor::ZoomIn
| MouseCursor::ZoomOut
| MouseCursor::AllScroll => IDC_SIZEALL,
MouseCursor::Help => IDC_HELP,
MouseCursor::Text | MouseCursor::VerticalText => IDC_IBEAM,
MouseCursor::Working | MouseCursor::PtrWorking => IDC_WAIT,
MouseCursor::NotAllowed | MouseCursor::PtrNotAllowed => IDC_NO,
MouseCursor::Crosshair => IDC_CROSS,
MouseCursor::EResize
| MouseCursor::WResize
| MouseCursor::EwResize
| MouseCursor::ColResize => IDC_SIZEALL,
MouseCursor::NResize
| MouseCursor::SResize
| MouseCursor::NsResize
| MouseCursor::RowResize => IDC_SIZEALL,
MouseCursor::NeResize | MouseCursor::SwResize | MouseCursor::NeswResize => IDC_SIZEALL,
MouseCursor::NwResize | MouseCursor::SeResize | MouseCursor::NwseResize => IDC_SIZEALL,
_ => IDC_ARROW,
}
}
}