Use cursor-icon crate for CursorIcon
This crate is aimed to simplify handling of cursor icon across various crates and be used in the public API.
This commit is contained in:
parent
596c0edf0f
commit
bd9cc2a9da
11 changed files with 54 additions and 250 deletions
|
|
@ -192,47 +192,8 @@ impl Window {
|
|||
|
||||
#[inline]
|
||||
pub fn set_cursor_icon(&self, cursor: CursorIcon) {
|
||||
let text = match cursor {
|
||||
CursorIcon::Default => "auto",
|
||||
CursorIcon::Crosshair => "crosshair",
|
||||
CursorIcon::Hand => "pointer",
|
||||
CursorIcon::Arrow => "default",
|
||||
CursorIcon::Move => "move",
|
||||
CursorIcon::Text => "text",
|
||||
CursorIcon::Wait => "wait",
|
||||
CursorIcon::Help => "help",
|
||||
CursorIcon::Progress => "progress",
|
||||
|
||||
CursorIcon::NotAllowed => "not-allowed",
|
||||
CursorIcon::ContextMenu => "context-menu",
|
||||
CursorIcon::Cell => "cell",
|
||||
CursorIcon::VerticalText => "vertical-text",
|
||||
CursorIcon::Alias => "alias",
|
||||
CursorIcon::Copy => "copy",
|
||||
CursorIcon::NoDrop => "no-drop",
|
||||
CursorIcon::Grab => "grab",
|
||||
CursorIcon::Grabbing => "grabbing",
|
||||
CursorIcon::AllScroll => "all-scroll",
|
||||
CursorIcon::ZoomIn => "zoom-in",
|
||||
CursorIcon::ZoomOut => "zoom-out",
|
||||
|
||||
CursorIcon::EResize => "e-resize",
|
||||
CursorIcon::NResize => "n-resize",
|
||||
CursorIcon::NeResize => "ne-resize",
|
||||
CursorIcon::NwResize => "nw-resize",
|
||||
CursorIcon::SResize => "s-resize",
|
||||
CursorIcon::SeResize => "se-resize",
|
||||
CursorIcon::SwResize => "sw-resize",
|
||||
CursorIcon::WResize => "w-resize",
|
||||
CursorIcon::EwResize => "ew-resize",
|
||||
CursorIcon::NsResize => "ns-resize",
|
||||
CursorIcon::NeswResize => "nesw-resize",
|
||||
CursorIcon::NwseResize => "nwse-resize",
|
||||
CursorIcon::ColResize => "col-resize",
|
||||
CursorIcon::RowResize => "row-resize",
|
||||
};
|
||||
*self.previous_pointer.borrow_mut() = text;
|
||||
backend::set_canvas_style_property(self.canvas.borrow().raw(), "cursor", text);
|
||||
*self.previous_pointer.borrow_mut() = cursor.name();
|
||||
backend::set_canvas_style_property(self.canvas.borrow().raw(), "cursor", cursor.name());
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue