driver.go 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. package fyne
  2. // Driver defines an abstract concept of a Fyne render driver.
  3. // Any implementation must provide at least these methods.
  4. type Driver interface {
  5. // CreateWindow creates a new UI Window.
  6. CreateWindow(string) Window
  7. // AllWindows returns a slice containing all app windows.
  8. AllWindows() []Window
  9. // RenderedTextSize returns the size required to render the given string of specified
  10. // font size and style. It also returns the height to text baseline, measured from the top.
  11. RenderedTextSize(text string, fontSize float32, style TextStyle) (size Size, baseline float32)
  12. // CanvasForObject returns the canvas that is associated with a given CanvasObject.
  13. CanvasForObject(CanvasObject) Canvas
  14. // AbsolutePositionForObject returns the position of a given CanvasObject relative to the top/left of a canvas.
  15. AbsolutePositionForObject(CanvasObject) Position
  16. // Device returns the device that the application is currently running on.
  17. Device() Device
  18. // Run starts the main event loop of the driver.
  19. Run()
  20. // Quit closes the driver and open windows, then exit the application.
  21. // On some some operating systems this does nothing, for example iOS and Android.
  22. Quit()
  23. // StartAnimation registers a new animation with this driver and requests it be started.
  24. StartAnimation(*Animation)
  25. // StopAnimation stops an animation and unregisters from this driver.
  26. StopAnimation(*Animation)
  27. }