Skip to content

Commit

Permalink
Deprecate the extending of containers, this shouldn't really have bee…
Browse files Browse the repository at this point in the history
…n supported
  • Loading branch information
andydotxyz committed Feb 7, 2021
1 parent 8f867e3 commit 0e09c18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 10 additions & 3 deletions container/apptabs.go
Expand Up @@ -56,7 +56,7 @@ func NewAppTabs(items ...*TabItem) *AppTabs {
// Current is first tab item
tabs.current = 0
}
tabs.ExtendBaseWidget(tabs)
tabs.BaseWidget.ExtendBaseWidget(tabs)

if tabs.mismatchedContent() {
internal.LogHint("AppTabs items should all have the same type of content (text, icons or both)")
Expand Down Expand Up @@ -86,7 +86,7 @@ func (c *AppTabs) Append(item *TabItem) {

// CreateRenderer is a private method to Fyne which links this widget to its renderer
func (c *AppTabs) CreateRenderer() fyne.WidgetRenderer {
c.ExtendBaseWidget(c)
c.BaseWidget.ExtendBaseWidget(c)
r := &appTabsRenderer{line: canvas.NewRectangle(theme.ShadowColor()),
underline: canvas.NewRectangle(theme.PrimaryColor()), container: c}
r.updateTabs()
Expand All @@ -106,9 +106,16 @@ func (c *AppTabs) CurrentTabIndex() int {
return c.current
}

// ExtendBaseWidget is used by an extending widget to make use of BaseWidget functionality.
//
// Deprecated: Support for extending containers is being removed
func (c *AppTabs) ExtendBaseWidget(wid fyne.Widget) {
c.BaseWidget.ExtendBaseWidget(wid)
}

// MinSize returns the size that this widget should not shrink below
func (c *AppTabs) MinSize() fyne.Size {
c.ExtendBaseWidget(c)
c.BaseWidget.ExtendBaseWidget(c)
return c.BaseWidget.MinSize()
}

Expand Down
11 changes: 9 additions & 2 deletions container/split.go
Expand Up @@ -45,13 +45,13 @@ func newSplitContainer(horizontal bool, leading, trailing fyne.CanvasObject) *Sp
Leading: leading,
Trailing: trailing,
}
s.ExtendBaseWidget(s)
s.BaseWidget.ExtendBaseWidget(s)
return s
}

// CreateRenderer is a private method to Fyne which links this widget to its renderer
func (s *Split) CreateRenderer() fyne.WidgetRenderer {
s.ExtendBaseWidget(s)
s.BaseWidget.ExtendBaseWidget(s)
d := newDivider(s)
return &splitContainerRenderer{
split: s,
Expand All @@ -60,6 +60,13 @@ func (s *Split) CreateRenderer() fyne.WidgetRenderer {
}
}

// ExtendBaseWidget is used by an extending widget to make use of BaseWidget functionality.
//
// Deprecated: Support for extending containers is being removed
func (s *Split) ExtendBaseWidget(wid fyne.Widget) {
s.BaseWidget.ExtendBaseWidget(wid)
}

// SetOffset sets the offset (0.0 to 1.0) of the Split divider.
// 0.0 - Leading is min size, Trailing uses all remaining space.
// 0.5 - Leading & Trailing equally share the available space.
Expand Down

0 comments on commit 0e09c18

Please sign in to comment.