driver.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package fyne
  2. import "time"
  3. // Driver defines an abstract concept of a Fyne render driver.
  4. // Any implementation must provide at least these methods.
  5. type Driver interface {
  6. // CreateWindow creates a new UI Window.
  7. CreateWindow(string) Window
  8. // AllWindows returns a slice containing all app windows.
  9. AllWindows() []Window
  10. // RenderedTextSize returns the size required to render the given string of specified
  11. // font size and style. It also returns the height to text baseline, measured from the top.
  12. // If the source is specified it will be used, otherwise the current theme will be asked for the font.
  13. RenderedTextSize(text string, fontSize float32, style TextStyle, source Resource) (size Size, baseline float32)
  14. // CanvasForObject returns the canvas that is associated with a given CanvasObject.
  15. CanvasForObject(CanvasObject) Canvas
  16. // AbsolutePositionForObject returns the position of a given CanvasObject relative to the top/left of a canvas.
  17. AbsolutePositionForObject(CanvasObject) Position
  18. // Device returns the device that the application is currently running on.
  19. Device() Device
  20. // Run starts the main event loop of the driver.
  21. Run()
  22. // Quit closes the driver and open windows, then exit the application.
  23. // On some some operating systems this does nothing, for example iOS and Android.
  24. Quit()
  25. // StartAnimation registers a new animation with this driver and requests it be started.
  26. StartAnimation(*Animation)
  27. // StopAnimation stops an animation and unregisters from this driver.
  28. StopAnimation(*Animation)
  29. // DoubleTapDelay returns the maximum duration where a second tap after a first one
  30. // will be considered a DoubleTap instead of two distinct Tap events.
  31. //
  32. // Since: 2.5
  33. DoubleTapDelay() time.Duration
  34. // SetDisableScreenBlanking allows an app to ask the device not to sleep/lock/blank displays
  35. //
  36. // Since: 2.5
  37. SetDisableScreenBlanking(bool)
  38. }