func (c *CheckBox) AddHandler(key Key, handler Handler) *CheckBox {
	c.handlers[key] = handler
	return c
}
AddHandler add handler
package component
import (
	"fmt"
	"github.com/jroimartin/gocui"
)
type CheckBox struct {
	*gocui.Gui
	label     string
	isChecked bool
	box       *box
	ctype     ComponentType
	*Position
	*Attributes
	handlers Handlers
}
type box struct {
	name string
	*Position
	*Attributes
}
func NewCheckBox(gui *gocui.Gui, label string, x, y, labelWidth int) *CheckBox {
	if len(label) > labelWidth {
		labelWidth = len(label)
	}
	p := &Position{
		X: x,
		Y: y,
		W: x + labelWidth + 1,
		H: y + 2,
	}
	c := &CheckBox{
		Gui:       gui,
		label:     label,
		isChecked: false,
		Position:  p,
		Attributes: &Attributes{
			textColor:   gocui.ColorYellow | gocui.AttrBold,
			textBgColor: gocui.ColorDefault,
		},
		box: &box{
			name: label + "box",
			Position: &Position{
				X: p.W,
				Y: p.Y,
				W: p.W + 2,
				H: p.H,
			},
			Attributes: &Attributes{
				textColor:   gocui.ColorBlack,
				textBgColor: gocui.ColorCyan,
			},
		},
		handlers: make(Handlers),
		ctype:    TypeCheckBox,
	}
	c.handlers[gocui.KeyEnter] = c.Check
	c.handlers[gocui.KeySpace] = c.Check
	return c
}
func (c *CheckBox) GetLabel() string {
	return c.label
}
func (c *CheckBox) GetPosition() *Position {
	return c.box.Position
}
func (c *CheckBox) Check(g *gocui.Gui, v *gocui.View) error {
	if v.Buffer() != "" {
		v.Clear()
		c.isChecked = false
	} else {
		fmt.Fprint(v, "X")
		c.isChecked = true
	}
	return nil
}