aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-02-27 11:51:35 +0100
committertomaka <pierre.krieger1708@gmail.com>2015-02-27 11:51:35 +0100
commit77d8a113385e8bb85f145d514724a1e3bd574cfd (patch)
tree52a5fc63c252801c5a68e2109322b188ea3d31c3
parent76a69e2e7bf5461aa1831a875a60d1815c52fb40 (diff)
parent903c9b1aad951e683de08c1d902a12c95bcd84c2 (diff)
downloadglutin-77d8a113385e8bb85f145d514724a1e3bd574cfd.tar.gz
glutin-77d8a113385e8bb85f145d514724a1e3bd574cfd.zip
Merge pull request #300 from bjwbell/osx-cursors
Implement set_cursor for osx
-rw-r--r--src/cocoa/mod.rs34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs
index 877c9b7..e39df9f 100644
--- a/src/cocoa/mod.rs
+++ b/src/cocoa/mod.rs
@@ -620,7 +620,39 @@ impl Window {
}
pub fn set_cursor(&self, cursor: MouseCursor) {
- unimplemented!()
+ let cursor_name = match cursor {
+ MouseCursor::Arrow => "arrowCursor",
+ MouseCursor::Text => "IBeamCursor",
+ MouseCursor::ContextMenu => "contextualMenuCursor",
+ MouseCursor::Copy => "dragCopyCursor",
+ MouseCursor::Crosshair => "crosshairCursor",
+ MouseCursor::Default => "arrowCursor",
+ MouseCursor::Grabbing => "openHandCursor",
+ MouseCursor::Hand | MouseCursor::Grab => "pointingHandCursor",
+ MouseCursor::NoDrop => "operationNotAllowedCursor",
+ MouseCursor::NotAllowed => "operationNotAllowedCursor",
+ MouseCursor::Alias => "dragLinkCursor",
+
+
+ /// Resize cursors
+ MouseCursor::EResize | MouseCursor::NResize |
+ MouseCursor::NeResize | MouseCursor::NwResize |
+ MouseCursor::SResize | MouseCursor::SeResize |
+ MouseCursor::SwResize | MouseCursor::WResize |
+ MouseCursor::EwResize | MouseCursor::ColResize |
+ MouseCursor::NsResize | MouseCursor::RowResize |
+ MouseCursor::NwseResize | MouseCursor::NeswResize => "arrowCursor",
+
+ /// TODO: Find appropriate OSX cursors
+ MouseCursor::Cell | MouseCursor::VerticalText | MouseCursor::NoneCursor |
+ MouseCursor::Wait | MouseCursor::Progress | MouseCursor::Help |
+ MouseCursor::Move | MouseCursor::AllScroll | MouseCursor::ZoomIn |
+ MouseCursor::ZoomOut => "arrowCursor",
+ };
+ unsafe {
+ let cursor : id = msg_send()(class("NSCursor"), selector(cursor_name));
+ let _ : id = msg_send()(cursor, selector("set"));
+ }
}
pub fn hidpi_factor(&self) -> f32 {