cursor.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package desktop
  2. import "image"
  3. // Cursor interface is used for objects that desire a specific cursor.
  4. //
  5. // Since: 2.0
  6. type Cursor interface {
  7. // Image returns the image for the given cursor, or nil if none should be shown.
  8. // It also returns the x and y pixels that should act as the hot-spot (measured from top left corner).
  9. Image() (image.Image, int, int)
  10. }
  11. // StandardCursor represents a standard Fyne cursor.
  12. // These values were previously of type `fyne.Cursor`.
  13. //
  14. // Since: 2.0
  15. type StandardCursor int
  16. // Image is not used for any of the StandardCursor types.
  17. //
  18. // Since: 2.0
  19. func (d StandardCursor) Image() (image.Image, int, int) {
  20. return nil, 0, 0
  21. }
  22. const (
  23. // DefaultCursor is the default cursor typically an arrow
  24. DefaultCursor StandardCursor = iota
  25. // TextCursor is the cursor often used to indicate text selection
  26. TextCursor
  27. // CrosshairCursor is the cursor often used to indicate bitmaps
  28. CrosshairCursor
  29. // PointerCursor is the cursor often used to indicate a link
  30. PointerCursor
  31. // HResizeCursor is the cursor often used to indicate horizontal resize
  32. HResizeCursor
  33. // VResizeCursor is the cursor often used to indicate vertical resize
  34. VResizeCursor
  35. // HiddenCursor will cause the cursor to not be shown
  36. HiddenCursor
  37. )
  38. // Cursorable describes any CanvasObject that needs a cursor change
  39. type Cursorable interface {
  40. Cursor() Cursor
  41. }