DrawOffset

This commit is contained in:
2025-08-06 20:55:44 -05:00
parent 81c7ec8324
commit 7c96fbb187
20 changed files with 168 additions and 29 deletions

View File

@@ -119,13 +119,17 @@ func (w *LinearLayout) Draw(screen tcell.Screen) {
}
p := w.GetPos()
for _, wd := range w.widgets {
o := wd.GetPos()
wd.SetPos(p.Add(o))
wd.Draw(screen)
wd.SetPos(o)
wd.DrawOffset(p, screen)
}
}
func (w *LinearLayout) DrawOffset(c Coord, screen tcell.Screen) {
p := w.GetPos()
w.SetPos(p.Add(c))
w.Draw(screen)
w.SetPos(p)
}
func (w *LinearLayout) Active() bool { return w.active }
func (w *LinearLayout) SetActive(a bool) { w.active = a }
func (w *LinearLayout) Visible() bool { return w.visible }
@@ -197,7 +201,9 @@ func (w *LinearLayout) MinH() int {
}
return minH
}
func (w *LinearLayout) Append(n Widget) { w.widgets = append(w.widgets, n) }
func (w *LinearLayout) SetOrientation(o LinearLayoutOrient) { w.orientation = o }
func (w *LinearLayout) Add(n Widget) { w.widgets = append(w.widgets, n) }
func (w *LinearLayout) Delete(n Widget) {
for i := 0; i < len(w.widgets); i++ {
if w.widgets[i] == n {