TabFrame: SetTabsHidden Option
SetTabsHidden(bool) can hide the tab row on a TabFrame, leaving only the content frames behind. This way the caller can provide the transition changes via SetTab and use the TabFrame only for its management features.
This commit is contained in:
parent
79210ae8c9
commit
0a6054baa6
13
tabframe.go
13
tabframe.go
|
@ -108,6 +108,17 @@ func (w *TabFrame) AddTab(key string, child Widget) *Frame {
|
||||||
return frame
|
return frame
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetTabsHidden can hide the tab buttons and reveal only their frames.
|
||||||
|
// It would be up to the caller to SetTab between the frames, using the
|
||||||
|
// TabFrame only for placement and tab handling.
|
||||||
|
func (w *TabFrame) SetTabsHidden(hidden bool) {
|
||||||
|
if hidden {
|
||||||
|
w.header.Hide()
|
||||||
|
} else {
|
||||||
|
w.header.Show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set the tab style between active and inactive
|
// set the tab style between active and inactive
|
||||||
func (w *TabFrame) setButtonStyle(button *Button, active bool) {
|
func (w *TabFrame) setButtonStyle(button *Button, active bool) {
|
||||||
var style = button.GetStyle()
|
var style = button.GetStyle()
|
||||||
|
@ -218,7 +229,7 @@ The tabs are simple Button widgets but drawn with no borders. Instead,
|
||||||
borders are painted on post-hoc in the Present function.
|
borders are painted on post-hoc in the Present function.
|
||||||
*/
|
*/
|
||||||
func (w *TabFrame) presentBorders(e render.Engine, P render.Point) {
|
func (w *TabFrame) presentBorders(e render.Engine, P render.Point) {
|
||||||
if len(w.tabButtons) == 0 {
|
if len(w.tabButtons) == 0 || w.header.Hidden() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user