app: add support for system cursors

Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
pierre
2020-12-02 16:50:56 +01:00
committed by Elias Naur
parent 951d45a2c6
commit 69cc2c795c
15 changed files with 297 additions and 18 deletions
+27
View File
@@ -79,9 +79,29 @@ type Source uint8
// Buttons is a set of mouse buttons
type Buttons uint8
// CursorName is the name of a cursor.
type CursorName string
// Must match app/internal/input.areaKind
type areaKind uint8
const (
// CursorDefault is the default cursor.
CursorDefault CursorName = ""
// CursorText is the cursor for text.
CursorText CursorName = "text"
// CursorPointer is the cursor for a link.
CursorPointer CursorName = "pointer"
// CursorCrossHair is the cursor for precise location.
CursorCrossHair CursorName = "crosshair"
// CursorColResize is the cursor for vertical resize.
CursorColResize CursorName = "col-resize"
// CursorRowResize is the cursor for horizontal resize.
CursorRowResize CursorName = "row-resize"
// CursorNone hides the cursor. To show it again, use any other cursor.
CursorNone CursorName = "none"
)
const (
// A Cancel event is generated when the current gesture is
// interrupted by other handlers or the system.
@@ -242,4 +262,11 @@ func (b Buttons) String() string {
return strings.Join(strs, "|")
}
func (c CursorName) String() string {
if c == CursorDefault {
return "default"
}
return string(c)
}
func (Event) ImplementsEvent() {}