Skip to content

Commit

Permalink
Refactor scroll direction consts to be public, improving docs and rem…
Browse files Browse the repository at this point in the history
…oving confusion!
  • Loading branch information
andydotxyz committed Jan 29, 2025
1 parent 1df903e commit a72cca4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
10 changes: 5 additions & 5 deletions container/scroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ type Scroll = widget.Scroll
// ScrollDirection represents the directions in which a Scroll container can scroll its child content.
//
// Since: 1.4
type ScrollDirection = widget.ScrollDirection
type ScrollDirection = fyne.ScrollDirection

// Constants for valid values of ScrollDirection.
const (
// ScrollBoth supports horizontal and vertical scrolling.
ScrollBoth ScrollDirection = widget.ScrollBoth
ScrollBoth ScrollDirection = fyne.ScrollBoth
// ScrollHorizontalOnly specifies the scrolling should only happen left to right.
ScrollHorizontalOnly = widget.ScrollHorizontalOnly
ScrollHorizontalOnly = fyne.ScrollHorizontalOnly
// ScrollVerticalOnly specifies the scrolling should only happen top to bottom.
ScrollVerticalOnly = widget.ScrollVerticalOnly
ScrollVerticalOnly = fyne.ScrollVerticalOnly
// ScrollNone turns off scrolling for this container.
//
// Since: 2.1
ScrollNone = widget.ScrollNone
ScrollNone = fyne.ScrollNone
)

// NewScroll creates a scrollable parent wrapping the specified content.
Expand Down
2 changes: 1 addition & 1 deletion internal/widget/scroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// ScrollDirection represents the directions in which a Scroll can scroll its child content.
type ScrollDirection int
type ScrollDirection = fyne.ScrollDirection

// Constants for valid values of ScrollDirection.
const (
Expand Down
18 changes: 18 additions & 0 deletions scroll.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fyne

// ScrollDirection represents the directions in which a scrollable container or widget can scroll its child content.
type ScrollDirection int

// Constants for valid values of ScrollDirection used in containers and widgets.
const (
// ScrollBoth supports horizontal and vertical scrolling.
ScrollBoth ScrollDirection = iota
// ScrollHorizontalOnly specifies the scrolling should only happen left to right.
ScrollHorizontalOnly
// ScrollVerticalOnly specifies the scrolling should only happen top to bottom.
ScrollVerticalOnly
// ScrollNone turns off scrolling for this container.
//
// Since: 2.6
ScrollNone
)
2 changes: 1 addition & 1 deletion widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Entry struct {
// Scroll can be used to turn off the scrolling of our entry when Wrapping is WrapNone.
//
// Since: 2.4
Scroll widget.ScrollDirection
Scroll fyne.ScrollDirection

// Set a validator that this entry will check against
// Since: 1.4
Expand Down
2 changes: 1 addition & 1 deletion widget/richtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type RichText struct {
BaseWidget
Segments []RichTextSegment
Wrapping fyne.TextWrap
Scroll widget.ScrollDirection
Scroll fyne.ScrollDirection

// The truncation mode of the text
//
Expand Down
2 changes: 1 addition & 1 deletion widget/textgrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type TextGrid struct {
// Scroll can be used to turn off the scrolling of our TextGrid.
//
// Since: 2.6
Scroll widget.ScrollDirection
Scroll fyne.ScrollDirection
}

// Append will add new lines to the end of this TextGrid.
Expand Down

0 comments on commit a72cca4

Please sign in to comment.