Really figuring some things out

This commit is contained in:
2025-08-07 11:18:03 -05:00
parent 7c96fbb187
commit b476c74683
23 changed files with 737 additions and 249 deletions

View File

@@ -24,7 +24,7 @@ package widgets
import (
"fmt"
h "git.bullercodeworks.com/brian/tcell-widgets/helpers"
wh "git.bullercodeworks.com/brian/tcell-widgets/helpers"
"github.com/gdamore/tcell"
)
@@ -63,8 +63,12 @@ func (w *Checkbox) Init(id string, style tcell.Style) {
w.stateRunes = []rune{'X', ' ', '-'}
w.tabbable = true
}
func (w *Checkbox) Id() string { return w.id }
func (w *Checkbox) HandleResize(ev *tcell.EventResize) { w.w, w.h = ev.Size() }
func (w *Checkbox) Id() string { return w.id }
func (w *Checkbox) HandleResize(ev *tcell.EventResize) {
w.w, w.h = ev.Size()
w.w = wh.Min(w.w, w.WantW())
w.h = wh.Min(w.h, w.WantH())
}
func (w *Checkbox) HandleKey(ev *tcell.EventKey) bool {
if !w.active {
@@ -89,7 +93,7 @@ func (w *Checkbox) Draw(screen tcell.Screen) {
if w.active {
dStyle = w.style.Bold(true)
}
h.DrawText(w.x, w.y, fmt.Sprintf("[%s] %s", string(w.state), w.label), dStyle, screen)
wh.DrawText(w.x, w.y, fmt.Sprintf("[%s] %s", string(w.state), w.label), dStyle, screen)
}
func (w *Checkbox) DrawOffset(c Coord, screen tcell.Screen) {