Fix TopMenu

Add Shrinkwrap
This commit is contained in:
2025-08-14 08:29:58 -05:00
parent 0c6f212e18
commit 566f35e655
5 changed files with 109 additions and 35 deletions

View File

@@ -69,6 +69,7 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
w.id = id
w.style = s
w.visible = true
w.tabbable = true
w.layoutFlags = make(map[Widget]LayoutFlag)
w.layoutWeights = make(map[Widget]int)
}
@@ -83,7 +84,9 @@ func (w *LinearLayout) HandleResize(ev *tcell.EventResize) {
func (w *LinearLayout) HandleKey(ev *tcell.EventKey) bool {
// First, see if the active widget handles the key
w.Log("LL: Handling Event: %s", ev.Name())
if len(w.widgets) > w.cursor {
w.Log("LL: Pushing to Widget: %s", w.widgets[w.cursor].Id())
if w.widgets[w.cursor].HandleKey(ev) {
return true
}
@@ -195,7 +198,13 @@ func (w *LinearLayout) MinH() int {
// All others to inactive
// If this layout is not active, everything is inactive
func (w *LinearLayout) updateActive() {
if !w.active {
w.Log("LL: Not Active")
}
for i, wd := range w.widgets {
if i == w.cursor {
w.Log("LL: Setting Active: %s", w.widgets[i].Id())
}
wd.SetActive(i == w.cursor && w.active)
}
}