tree/common.go

78 lines
1.3 KiB
Go
Raw Permalink Normal View History

package tree
import (
"go.wit.com/log"
"go.wit.com/widget"
)
func (n *Node) GetProgName() string {
return n.State.ProgName
}
/*
func (n *Node) GetValue() any {
return n.State.Value
}
*/
func (n *Node) Bool() bool {
return false // widget.GetBool(n.State.Value)
}
func (n *Node) CurrentS() string {
return n.State.CurrentS
}
func (n *Node) Strings() []string {
return n.ddStrings
}
func (n *Node) String() string {
switch n.WidgetType {
case widget.Button:
return n.State.Label
case widget.Window:
return n.State.Label
case widget.Checkbox:
return n.State.Label
case widget.Group:
return n.State.Label
case widget.Label:
return n.State.Label
case widget.Dropdown:
return n.State.CurrentS
case widget.Combobox:
return n.State.CurrentS
}
log.Log(TREE, "do not know how to do String() on widget type", n.WidgetType)
return ""
}
func (n *Node) ProgName() string {
return n.State.ProgName
}
func (n *Node) Hidden() bool {
return n.State.Hidden
}
/* avoid this function name as confusing
func (n *Node) GetText() string {
return widget.GetString(n.State.Value)
}
*/
/*
func (n *Node) SetValue(a any) {
n.State.Value = a
}
*/
func (n *Node) SetCurrentS(s string) {
n.State.CurrentS = s
}
func (n *Node) GetLabel() string {
return n.State.Label
}