State.Hidden is honored
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
fd56d89cc8
commit
145bad6c9a
83
click.go
83
click.go
|
@ -8,87 +8,6 @@ import (
|
|||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// set isCurrent = false everywhere
|
||||
func (w *guiWidget) unsetCurrent() {
|
||||
w.isCurrent = false
|
||||
|
||||
if w.node.WidgetType == widget.Tab {
|
||||
// n.tk.color = &colorTab
|
||||
// n.setColor()
|
||||
}
|
||||
|
||||
for _, child := range w.children {
|
||||
child.unsetCurrent()
|
||||
}
|
||||
}
|
||||
|
||||
// when adding a new widget, this will update the display
|
||||
// of the current widgets if that widget is supposed
|
||||
// to be in current display
|
||||
func (w *guiWidget) updateCurrent() {
|
||||
log.Log(NOW, "updateCurrent()", w.String())
|
||||
if w.WidgetType == widget.Tab {
|
||||
if w.IsCurrent() {
|
||||
// n.tk.color = &colorActiveT
|
||||
w.setColor(&colorActiveT)
|
||||
w.hideView()
|
||||
w.showView()
|
||||
w.setCurrentTab()
|
||||
} else {
|
||||
// n.tk.color = &colorTab
|
||||
// n.setColor()
|
||||
}
|
||||
return
|
||||
}
|
||||
if w.WidgetType == widget.Window {
|
||||
if w.IsCurrent() {
|
||||
// setCurrentWindow(n)
|
||||
}
|
||||
return
|
||||
}
|
||||
if w.WidgetType == widget.Root {
|
||||
return
|
||||
}
|
||||
w.parent.updateCurrent()
|
||||
}
|
||||
|
||||
// shows the widgets in a window
|
||||
func (w *guiWidget) setCurrentWindow() {
|
||||
if w.IsCurrent() {
|
||||
return
|
||||
}
|
||||
if w.WidgetType != widget.Window {
|
||||
return
|
||||
}
|
||||
var rootTK *guiWidget
|
||||
rootTK = me.treeRoot.TK.(*guiWidget)
|
||||
rootTK.unsetCurrent()
|
||||
|
||||
if w.hasTabs {
|
||||
// set isCurrent = true on the first tab
|
||||
for _, child := range w.children {
|
||||
child.isCurrent = true
|
||||
break
|
||||
}
|
||||
} else {
|
||||
w.isCurrent = true
|
||||
}
|
||||
}
|
||||
|
||||
// shows the widgets in a tab
|
||||
func (w *guiWidget) setCurrentTab() {
|
||||
var p, rootTK *guiWidget
|
||||
if w.WidgetType != widget.Tab {
|
||||
return
|
||||
}
|
||||
rootTK = me.treeRoot.TK.(*guiWidget)
|
||||
rootTK.unsetCurrent()
|
||||
w.isCurrent = true
|
||||
p = w.parent
|
||||
p.isCurrent = true
|
||||
log.Log(NOW, "setCurrent()", w.String())
|
||||
}
|
||||
|
||||
func (w *guiWidget) doWidgetClick() {
|
||||
switch w.WidgetType {
|
||||
case widget.Root:
|
||||
|
@ -109,7 +28,7 @@ func (w *guiWidget) doWidgetClick() {
|
|||
if me.currentWindow != nil {
|
||||
var curw *guiWidget
|
||||
curw = me.currentWindow.TK.(*guiWidget)
|
||||
curw.unsetCurrent()
|
||||
// curw.unsetCurrent()
|
||||
curw.setColor(&colorWindow)
|
||||
curw.hideWidgets()
|
||||
}
|
||||
|
|
7
view.go
7
view.go
|
@ -185,8 +185,11 @@ func (w *guiWidget) showWidgets() {
|
|||
if w.isFake {
|
||||
// don't display by default
|
||||
} else {
|
||||
// w.showWidgetPlacement("current:")
|
||||
w.showView()
|
||||
if w.node.State.Hidden {
|
||||
// don't display hidden views
|
||||
} else {
|
||||
w.showView()
|
||||
}
|
||||
}
|
||||
for _, child := range w.children {
|
||||
child.showWidgets()
|
||||
|
|
Loading…
Reference in New Issue