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
|
|
|
|
}
|
|
|
|
}
|
2024-10-22 22:37:20 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|