bug fixes and clean code

This commit is contained in:
2024-09-29 21:22:25 +02:00
parent e873c01e50
commit dd8f1fbc1f
14 changed files with 89 additions and 90 deletions
+11 -2
View File
@@ -9,6 +9,12 @@ import (
"github.com/orus-dev/osui/isKey"
)
type InputBoxParams struct {
Style DivStyle
Width int
Height int
}
type InputBoxStyle struct {
Background string `default:"" type:"bg"`
Foreground string `default:"" type:"fg"`
@@ -77,8 +83,11 @@ func (s *InputBoxComponent) Update(key string) bool {
return false
}
func (d *InputBoxComponent) SetStyle(c interface{}) {
d.Style = osui.SetDefaults(c.(*InputBoxStyle)).(*InputBoxStyle)
func (b *InputBoxComponent) Params(p interface{}) *InputBoxComponent {
param := p.(InputBoxParams)
b.Style = osui.SetDefaults(&param.Style).(*InputBoxStyle)
b.Data.Width = osui.LogicValueInt(param.Width == 0, 20, param.Width)
return b
}
func InputBox(max_size uint) *InputBoxComponent {