tuimenu/simple/options.go

36 lines
693 B
Go
Raw Normal View History

2024-10-16 22:07:31 +02:00
package simple
type SimpleMenuOption func(conf *MenuConfig)
func WithCustomTitle(title string) SimpleMenuOption {
return func(conf *MenuConfig) {
conf.Title = title
}
}
func WithCustomBackKey(back string) SimpleMenuOption {
return func(conf *MenuConfig) {
conf.BackKey = back
}
}
2024-10-18 06:27:26 +02:00
func WithUsageOfEscapeCodes() SimpleMenuOption {
return func(conf *MenuConfig) {
conf.UsingEscapeCodes = true
}
}
type InterruptOption func(intr *MenuInterrupt)
type IntrOptStatus uint32
const (
IntrOptStatus_ClearAfterFinish IntrOptStatus = 1 << iota
)
func ClearAfterFinishingFunc() InterruptOption {
return func(intr *MenuInterrupt) {
intr.Status |= IntrOptStatus_ClearAfterFinish
}
}