forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move spacer to layout as that's what it is
- Loading branch information
1 parent
20c2757
commit 120b904
Showing
5 changed files
with
54 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package layout | ||
|
||
import "github.com/fyne-io/fyne" | ||
|
||
// SpacerObject is a simple object that can be used in a list layout to space | ||
// out child objects | ||
type SpacerObject interface { | ||
ExpandVertical() bool | ||
ExpandHorizontal() bool | ||
} | ||
|
||
type spacerObject struct { | ||
size fyne.Size | ||
pos fyne.Position | ||
} | ||
|
||
func (s *spacerObject) ExpandVertical() bool { | ||
return true | ||
} | ||
|
||
func (s *spacerObject) ExpandHorizontal() bool { | ||
return true | ||
} | ||
|
||
func (s *spacerObject) CurrentSize() fyne.Size { | ||
return s.size | ||
} | ||
|
||
func (s *spacerObject) Resize(size fyne.Size) { | ||
s.size = size | ||
} | ||
|
||
func (s *spacerObject) CurrentPosition() fyne.Position { | ||
return s.pos | ||
} | ||
|
||
func (s *spacerObject) Move(pos fyne.Position) { | ||
s.pos = pos | ||
} | ||
|
||
func (s *spacerObject) MinSize() fyne.Size { | ||
return fyne.NewSize(0, 0) | ||
} | ||
|
||
// NewSpacer returns a spacer object which can fill vertical and horizontal | ||
// space. This is primarily used with a list layout. | ||
func NewSpacer() fyne.CanvasObject { | ||
return &spacerObject{} | ||
} |