From 145bad6c9aadf8bb398131ea42da24a536dc72bb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 4 Feb 2024 10:08:08 -0600 Subject: [PATCH] State.Hidden is honored Signed-off-by: Jeff Carr --- click.go | 83 +------------------------------------------------------- view.go | 7 +++-- 2 files changed, 6 insertions(+), 84 deletions(-) diff --git a/click.go b/click.go index c1e91a3..abb1ac9 100644 --- a/click.go +++ b/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() } diff --git a/view.go b/view.go index 22e0373..0f4563f 100644 --- a/view.go +++ b/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()