2024-01-18 00:05:54 -06:00
|
|
|
package tree
|
|
|
|
|
|
|
|
import (
|
2024-02-05 15:03:11 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-18 04:08:11 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:05:54 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func (n *Node) GetProgName() string {
|
|
|
|
return n.State.ProgName
|
|
|
|
}
|
|
|
|
|
2024-02-05 15:03:11 -06:00
|
|
|
/*
|
2024-01-18 00:05:54 -06:00
|
|
|
func (n *Node) GetValue() any {
|
|
|
|
return n.State.Value
|
|
|
|
}
|
2024-02-05 15:03:11 -06:00
|
|
|
*/
|
2024-01-18 00:05:54 -06:00
|
|
|
|
|
|
|
func (n *Node) Bool() bool {
|
2024-02-05 15:03:11 -06:00
|
|
|
return false // widget.GetBool(n.State.Value)
|
2024-01-18 00:05:54 -06:00
|
|
|
}
|
|
|
|
|
2024-02-07 07:41:35 -06:00
|
|
|
func (n *Node) CurrentS() string {
|
|
|
|
return n.State.CurrentS
|
|
|
|
}
|
|
|
|
|
2024-02-09 03:43:55 -06:00
|
|
|
func (n *Node) Strings() []string {
|
|
|
|
return n.ddStrings
|
|
|
|
}
|
|
|
|
|
2024-01-18 00:05:54 -06:00
|
|
|
func (n *Node) String() string {
|
2024-02-05 15:03:11 -06:00
|
|
|
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 ""
|
2024-01-18 00:05:54 -06:00
|
|
|
}
|
|
|
|
|
2024-02-05 09:05:09 -06:00
|
|
|
func (n *Node) ProgName() string {
|
|
|
|
return n.State.ProgName
|
|
|
|
}
|
|
|
|
|
2024-02-05 07:20:57 -06:00
|
|
|
func (n *Node) Hidden() bool {
|
|
|
|
return n.State.Hidden
|
|
|
|
}
|
|
|
|
|
2024-01-18 00:05:54 -06:00
|
|
|
/* avoid this function name as confusing
|
|
|
|
func (n *Node) GetText() string {
|
|
|
|
return widget.GetString(n.State.Value)
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2024-02-05 15:03:11 -06:00
|
|
|
/*
|
2024-01-18 00:05:54 -06:00
|
|
|
func (n *Node) SetValue(a any) {
|
|
|
|
n.State.Value = a
|
|
|
|
}
|
2024-02-05 15:03:11 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
func (n *Node) SetCurrentS(s string) {
|
|
|
|
n.State.CurrentS = s
|
|
|
|
}
|
2024-01-18 00:05:54 -06:00
|
|
|
|
|
|
|
func (n *Node) GetLabel() string {
|
|
|
|
return n.State.Label
|
|
|
|
}
|