diff --git a/wdgt_button.go b/wdgt_button.go index bd8ca9f..befe581 100644 --- a/wdgt_button.go +++ b/wdgt_button.go @@ -79,16 +79,20 @@ func (w *Button) Draw(screen tcell.Screen) { if !w.visible { return } - dStyle := w.style.Dim(!w.active) + dStyle := w.style.Dim(!w.active).Bold(w.active) + lbl := w.label switch w.h { case 1: - lbl := w.label + lb, rb := "[", "]" + if w.active { + lb, rb = ">", "<" + } if w.w < len(lbl) { lbl = lbl[:w.w] } else if w.w == len(w.label)+2 { - lbl = fmt.Sprintf("[%s]", lbl) + lbl = fmt.Sprintf("%s%s%s", lb, lbl, rb) } else if w.w > len(w.label)+2 { - lbl = fmt.Sprintf("[%s]", wh.Center(lbl, w.w-2)) + lbl = fmt.Sprintf("%s%s%s", lb, wh.Center(lbl, w.w-2), rb) } wh.DrawText(w.x, w.y, lbl, dStyle, screen) return @@ -111,7 +115,7 @@ func (w *Button) Draw(screen tcell.Screen) { wh.DrawText(w.x, w.y, "[]", dStyle, screen) return } - lbl := wh.Center(w.label, w.w-2) + lbl = wh.Center(w.label, w.w-2) wh.DrawText(w.x, w.y, fmt.Sprintf("╭%s╮", strings.Repeat("─", w.w-2)), dStyle, screen) wh.DrawText(w.x, w.y+1, fmt.Sprintf("│%s│", wh.Center(lbl, w.w-2)), dStyle, screen) wh.DrawText(w.x, w.y+2, fmt.Sprintf("╰%s╯", strings.Repeat("─", w.w-2)), dStyle, screen)