scroll.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package container
  2. import (
  3. "fyne.io/fyne/v2"
  4. "fyne.io/fyne/v2/internal/widget"
  5. )
  6. // Scroll defines a container that is smaller than the Content.
  7. // The Offset is used to determine the position of the child widgets within the container.
  8. //
  9. // Since: 1.4
  10. type Scroll = widget.Scroll
  11. // ScrollDirection represents the directions in which a Scroll container can scroll its child content.
  12. //
  13. // Since: 1.4
  14. type ScrollDirection = widget.ScrollDirection
  15. // Constants for valid values of ScrollDirection.
  16. const (
  17. // ScrollBoth supports horizontal and vertical scrolling.
  18. ScrollBoth ScrollDirection = widget.ScrollBoth
  19. // ScrollHorizontalOnly specifies the scrolling should only happen left to right.
  20. ScrollHorizontalOnly = widget.ScrollHorizontalOnly
  21. // ScrollVerticalOnly specifies the scrolling should only happen top to bottom.
  22. ScrollVerticalOnly = widget.ScrollVerticalOnly
  23. // ScrollNone turns off scrolling for this container.
  24. //
  25. // Since: 2.1
  26. ScrollNone = widget.ScrollNone
  27. )
  28. // NewScroll creates a scrollable parent wrapping the specified content.
  29. // Note that this may cause the MinSize to be smaller than that of the passed object.
  30. //
  31. // Since: 1.4
  32. func NewScroll(content fyne.CanvasObject) *Scroll {
  33. return widget.NewScroll(content)
  34. }
  35. // NewHScroll create a scrollable parent wrapping the specified content.
  36. // Note that this may cause the MinSize.Width to be smaller than that of the passed object.
  37. //
  38. // Since: 1.4
  39. func NewHScroll(content fyne.CanvasObject) *Scroll {
  40. return widget.NewHScroll(content)
  41. }
  42. // NewVScroll a scrollable parent wrapping the specified content.
  43. // Note that this may cause the MinSize.Height to be smaller than that of the passed object.
  44. //
  45. // Since: 1.4
  46. func NewVScroll(content fyne.CanvasObject) *Scroll {
  47. return widget.NewVScroll(content)
  48. }