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.
This commit is contained in:
parent
318f0d2d06
commit
b532b8c65f
9 changed files with 174 additions and 3 deletions
61
src/lib.rs
61
src/lib.rs
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue