mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
io/pointer: [API] make cursor name into a byte
Add most of the common cursors defined by different systems. Normalize cursor names to match CSS. This is API change: some cursor names have changed, and the underlying type is no longer a string. Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
+30
-1
@@ -545,9 +545,38 @@ func (w *window) Perform(system.Action) {}
|
||||
|
||||
func (w *window) Raise() {}
|
||||
|
||||
var webCursor = [...]string{
|
||||
pointer.CursorDefault: "default",
|
||||
pointer.CursorNone: "none",
|
||||
pointer.CursorText: "text",
|
||||
pointer.CursorVerticalText: "vertical-text",
|
||||
pointer.CursorPointer: "pointer",
|
||||
pointer.CursorCrosshair: "crosshair",
|
||||
pointer.CursorAllScroll: "all-scroll",
|
||||
pointer.CursorColResize: "col-resize",
|
||||
pointer.CursorRowResize: "row-resize",
|
||||
pointer.CursorGrab: "grab",
|
||||
pointer.CursorGrabbing: "grabbing",
|
||||
pointer.CursorNotAllowed: "not-allowed",
|
||||
pointer.CursorWait: "wait",
|
||||
pointer.CursorProgress: "progress",
|
||||
pointer.CursorNorthWestResize: "nw-resize",
|
||||
pointer.CursorNorthEastResize: "ne-resize",
|
||||
pointer.CursorSouthWestResize: "sw-resize",
|
||||
pointer.CursorSouthEastResize: "se-resize",
|
||||
pointer.CursorNorthSouthResize: "ns-resize",
|
||||
pointer.CursorEastWestResize: "ew-resize",
|
||||
pointer.CursorWestResize: "w-resize",
|
||||
pointer.CursorEastResize: "e-resize",
|
||||
pointer.CursorNorthResize: "n-resize",
|
||||
pointer.CursorSouthResize: "s-resize",
|
||||
pointer.CursorNorthEastSouthWestResize: "nesw-resize",
|
||||
pointer.CursorNorthWestSouthEastResize: "nwse-resize",
|
||||
}
|
||||
|
||||
func (w *window) SetCursor(name pointer.CursorName) {
|
||||
style := w.cnv.Get("style")
|
||||
style.Set("cursor", string(name))
|
||||
style.Set("cursor", webCursor[name])
|
||||
}
|
||||
|
||||
func (w *window) Wakeup() {
|
||||
|
||||
Reference in New Issue
Block a user