diff options
author | Bryan Bell <bryan.w.bell@gmail.com> | 2015-01-12 16:22:37 -0800 |
---|---|---|
committer | Bryan Bell <bryan.w.bell@gmail.com> | 2015-01-12 16:22:37 -0800 |
commit | b532b8c65fd1828fd7d742d0994c6118880d07f0 (patch) | |
tree | 21931aaa0baf32a3da5b0a2f37ff213842d5a9c7 /src/lib.rs | |
parent | 318f0d2d0662194d84836899d3077b33f0f8196f (diff) | |
download | glutin-b532b8c65fd1828fd7d742d0994c6118880d07f0.tar.gz glutin-b532b8c65fd1828fd7d742d0994c6118880d07f0.zip |
Add mouse cursor support
Add a new api, window.set_cursor, for setting the cursor. The enum MouseCursor lists the possible cursors.
Only X11 is implemented. On OSX, Android, & Win32 the window.set_cursor function
either does nothing or calls the "unimplemented!" macro.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 61 |
1 files changed, 61 insertions, 0 deletions
@@ -90,6 +90,62 @@ pub enum Api { OpenGlEs, } +#[derive(Show, Copy)] +pub enum MouseCursor { + /// The platform-dependent default cursor. + Default, + /// A simple crosshair. + Crosshair, + /// A hand (often used to indicate links in web browsers). + Hand, + /// Self explanatory. + Arrow, + /// Indicates something is to be moved. + Move, + /// Indicates text that may be selected or edited. + Text, + /// Program busy indicator. + Wait, + /// Help indicator (often rendered as a "?") + Help, + /// Progress indicator. Shows that processing is being done. But in contrast + /// with "Wait" the user may still interact with the program. Often rendered + /// as a spinning beach ball, or an arrow with a watch or hourglass. + Progress, + + /// Cursor showing that something cannot be done. + NotAllowed, + ContextMenu, + NoneCursor, + Cell, + VerticalText, + Alias, + Copy, + NoDrop, + Grab, + Grabbing, + AllScroll, + ZoomIn, + ZoomOut, + + /// Indicate that some edge is to be moved. For example, the 'SeResize' cursor + /// is used when the movement starts from the south-east corner of the box. + EResize, + NResize, + NeResize, + NwResize, + SResize, + SeResize, + SwResize, + WResize, + EwResize, + NsResize, + NeswResize, + NwseResize, + ColResize, + RowResize, +} + /// Object that allows you to build windows. #[cfg(feature = "window")] pub struct WindowBuilder<'a> { @@ -559,6 +615,11 @@ impl Window { pub fn set_window_resize_callback(&mut self, callback: Option<fn(uint, uint)>) { self.window.set_window_resize_callback(callback); } + + /// Modifies the mouse cursor of the window. + pub fn set_cursor(&mut self, cursor: MouseCursor) { + self.window.set_cursor(cursor); + } } #[cfg(feature = "window")] |