Ascii Art Widget

This commit is contained in:
2025-09-24 17:40:01 -05:00
parent 592fffd601
commit dee65c4188
2 changed files with 458 additions and 0 deletions

View File

@@ -140,6 +140,7 @@ func (w *LinearLayout) Draw(screen tcell.Screen) {
if !w.visible {
return
}
pos := w.GetPos()
if w.insetBorder {
wh.Border(pos.X, pos.Y, pos.X+w.w, pos.Y+w.h, wh.BRD_CSIMPLE, w.style, screen)
@@ -188,6 +189,9 @@ func (w *LinearLayout) WantW() int {
wantW = wantW + wd.WantW()
}
}
if w.insetBorder {
wantW += 2
}
return wantW
}
@@ -203,6 +207,9 @@ func (w *LinearLayout) WantH() int {
wantH = wh.Max(wd.WantH(), wantH)
}
}
if w.insetBorder {
wantH += 2
}
return wantH
}
@@ -487,6 +494,10 @@ func (w *LinearLayout) updateLLVWidgetPos(wd Widget) {
} else {
c.X = 0
}
if w.insetBorder {
c.X += 1
c.Y += 1
}
wd.SetPos(c)
}
@@ -533,6 +544,10 @@ func (w *LinearLayout) updateLLHWidgetPos(wd Widget) {
c.Y = int((float64(w.h) / 2) - (float64(wd.GetH()) / 2))
}
}
if w.insetBorder {
c.X += 1
c.Y += 1
}
wd.SetPos(c)
}