-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle set_mouse_cursor event on windows
- Loading branch information
Showing
4 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use crate::MouseCursor; | ||
use winapi::{ | ||
shared::ntdef::LPCWSTR, | ||
um::winuser::{ | ||
IDC_APPSTARTING, IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP, IDC_IBEAM, IDC_NO, IDC_SIZEALL, | ||
IDC_SIZENESW, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZEWE, IDC_WAIT, | ||
}, | ||
}; | ||
|
||
pub fn cursor_to_lpcwstr(cursor: MouseCursor) -> LPCWSTR { | ||
match cursor { | ||
MouseCursor::Default => IDC_ARROW, | ||
MouseCursor::Hand => IDC_HAND, | ||
MouseCursor::HandGrabbing => IDC_SIZEALL, | ||
MouseCursor::Help => IDC_HELP, | ||
|
||
// hiding cursor can't be turned into an lpcwstr since it's done by ShowCursor instead of SetCursor | ||
MouseCursor::Hidden => IDC_ARROW, | ||
|
||
MouseCursor::Text => IDC_IBEAM, | ||
MouseCursor::VerticalText => IDC_IBEAM, | ||
|
||
MouseCursor::Working => IDC_WAIT, | ||
MouseCursor::PtrWorking => IDC_APPSTARTING, | ||
|
||
MouseCursor::NotAllowed => IDC_NO, | ||
MouseCursor::PtrNotAllowed => IDC_NO, | ||
|
||
MouseCursor::ZoomIn => IDC_ARROW, | ||
MouseCursor::ZoomOut => IDC_ARROW, | ||
|
||
MouseCursor::Alias => IDC_ARROW, | ||
MouseCursor::Copy => IDC_ARROW, | ||
MouseCursor::Move => IDC_SIZEALL, | ||
MouseCursor::AllScroll => IDC_SIZEALL, | ||
MouseCursor::Cell => IDC_CROSS, | ||
MouseCursor::Crosshair => IDC_CROSS, | ||
|
||
MouseCursor::EResize => IDC_SIZEWE, | ||
MouseCursor::NResize => IDC_SIZENS, | ||
MouseCursor::NeResize => IDC_SIZENESW, | ||
MouseCursor::NwResize => IDC_SIZENWSE, | ||
MouseCursor::SResize => IDC_SIZENS, | ||
MouseCursor::SeResize => IDC_SIZENWSE, | ||
MouseCursor::SwResize => IDC_SIZENESW, | ||
MouseCursor::WResize => IDC_SIZEWE, | ||
MouseCursor::EwResize => IDC_SIZEWE, | ||
MouseCursor::NsResize => IDC_SIZENS, | ||
MouseCursor::NwseResize => IDC_SIZENWSE, | ||
MouseCursor::NeswResize => IDC_SIZENESW, | ||
|
||
MouseCursor::ColResize => IDC_SIZEWE, | ||
MouseCursor::RowResize => IDC_SIZENS, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod cursor; | ||
mod drop_target; | ||
mod keyboard; | ||
mod window; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters