move to "gui/widget"
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
80d0f34bc0
commit
6f1a7e9257
6
box.go
6
box.go
|
@ -1,14 +1,14 @@
|
|||
package gui
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewBox(name string, b bool) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Box)
|
||||
newNode := parent.newNode(name, widget.Box)
|
||||
newNode.B = b
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package gui
|
||||
|
||||
import "go.wit.com/gui/toolkits"
|
||||
import "go.wit.com/gui/widget"
|
||||
|
||||
func (parent *Node) NewButton(name string, custom func()) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Button)
|
||||
newNode := parent.newNode(name, widget.Button)
|
||||
newNode.Custom = custom
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package gui
|
||||
|
||||
import "go.wit.com/gui/toolkits"
|
||||
import "go.wit.com/gui/widget"
|
||||
|
||||
func (n *Node) Checked() bool {
|
||||
return n.B
|
||||
}
|
||||
|
||||
func (n *Node) NewCheckbox(name string) *Node {
|
||||
newNode := n.newNode(name, toolkit.Checkbox)
|
||||
newNode := n.newNode(name, widget.Checkbox)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
30
common.go
30
common.go
|
@ -6,31 +6,31 @@ import (
|
|||
"regexp"
|
||||
"errors"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// functions for handling text related GUI elements
|
||||
|
||||
func (n *Node) Show() *Node {
|
||||
a := newAction(n, toolkit.Show)
|
||||
a := newAction(n, widget.Show)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Hide() *Node {
|
||||
a := newAction(n, toolkit.Hide)
|
||||
a := newAction(n, widget.Hide)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Enable() *Node {
|
||||
a := newAction(n, toolkit.Enable)
|
||||
a := newAction(n, widget.Enable)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Disable() *Node {
|
||||
a := newAction(n, toolkit.Disable)
|
||||
a := newAction(n, widget.Disable)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ func (n *Node) Add(str string) {
|
|||
|
||||
n.S = str
|
||||
|
||||
a := newAction(n, toolkit.Add)
|
||||
a := newAction(n, widget.Add)
|
||||
sendAction(a)
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ func (n *Node) AddText(str string) {
|
|||
n.Text = str
|
||||
n.S = str
|
||||
|
||||
a := newAction(n, toolkit.AddText)
|
||||
a := newAction(n, widget.AddText)
|
||||
sendAction(a)
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ func (n *Node) SetText(text string) *Node {
|
|||
n.Text = text
|
||||
n.S = text
|
||||
|
||||
a := newAction(n, toolkit.SetText)
|
||||
a := newAction(n, widget.SetText)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ func (n *Node) Set(val any) {
|
|||
log.Error(errors.New("Set() unknown type"), "v =", v)
|
||||
}
|
||||
|
||||
a := newAction(n, toolkit.Set)
|
||||
a := newAction(n, widget.Set)
|
||||
sendAction(a)
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ func (n *Node) AppendText(str string) {
|
|||
n.Text = tmp
|
||||
n.S = tmp
|
||||
|
||||
a := newAction(n, toolkit.SetText)
|
||||
a := newAction(n, widget.SetText)
|
||||
sendAction(a)
|
||||
}
|
||||
|
||||
|
@ -169,31 +169,31 @@ func commonCallback(n *Node) {
|
|||
}
|
||||
|
||||
func (n *Node) Margin() *Node {
|
||||
a := newAction(n, toolkit.Margin)
|
||||
a := newAction(n, widget.Margin)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Unmargin() *Node {
|
||||
a := newAction(n, toolkit.Unmargin)
|
||||
a := newAction(n, widget.Unmargin)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Pad() *Node {
|
||||
a := newAction(n, toolkit.Pad)
|
||||
a := newAction(n, widget.Pad)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Unpad() *Node {
|
||||
a := newAction(n, toolkit.Unpad)
|
||||
a := newAction(n, widget.Unpad)
|
||||
sendAction(a)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) Expand() *Node {
|
||||
a := newAction(n, toolkit.Pad)
|
||||
a := newAction(n, widget.Pad)
|
||||
a.Expand = true
|
||||
sendAction(a)
|
||||
return n
|
||||
|
|
6
debug.go
6
debug.go
|
@ -9,7 +9,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// for printing out the binary tree
|
||||
|
@ -38,8 +38,8 @@ func (n *Node) Dump() {
|
|||
}
|
||||
Indent(b, "NODE DUMP END")
|
||||
|
||||
a := new(toolkit.Action)
|
||||
a.ActionType = toolkit.Dump
|
||||
a := new(widget.Action)
|
||||
a.ActionType = widget.Dump
|
||||
a.WidgetId = n.id
|
||||
sendAction(a)
|
||||
}
|
||||
|
|
10
dropdown.go
10
dropdown.go
|
@ -6,7 +6,7 @@ package gui
|
|||
// since it is the same. confusing names? maybe...
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// add a new entry to the dropdown name
|
||||
|
@ -20,18 +20,18 @@ func (n *Node) SetDropdownName(name string) {
|
|||
}
|
||||
|
||||
func (n *Node) NewDropdown(name string) *Node {
|
||||
newNode := n.newNode(name, toolkit.Dropdown)
|
||||
newNode := n.newNode(name, widget.Dropdown)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
|
||||
return newNode
|
||||
}
|
||||
|
||||
func (n *Node) NewCombobox(name string) *Node {
|
||||
newNode := n.newNode(name, toolkit.Combobox)
|
||||
newNode := n.newNode(name, widget.Combobox)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
|
||||
return newNode
|
||||
|
|
6
grid.go
6
grid.go
|
@ -2,7 +2,7 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// Grid numbering examples (H) or (W,H)
|
||||
|
@ -24,14 +24,14 @@ import (
|
|||
// -----------------------------
|
||||
|
||||
func (n *Node) NewGrid(name string, w int, h int) *Node {
|
||||
newNode := n.newNode(name, toolkit.Grid)
|
||||
newNode := n.newNode(name, widget.Grid)
|
||||
|
||||
newNode.W = w
|
||||
newNode.H = h
|
||||
newNode.NextW = 1
|
||||
newNode.NextH = 1
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
|
||||
// by default, always pad grids
|
||||
|
|
6
group.go
6
group.go
|
@ -1,7 +1,7 @@
|
|||
package gui
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// TODO: make a "Group" a "Grid" ?
|
||||
|
@ -9,9 +9,9 @@ import (
|
|||
// pre-canned andlabs/ui gtk,macos,windows thing
|
||||
func (parent *Node) NewGroup(name string) *Node {
|
||||
var newNode *Node
|
||||
newNode = parent.newNode(name, toolkit.Group)
|
||||
newNode = parent.newNode(name, widget.Group)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
|
||||
// by default, always pad groups
|
||||
|
|
6
image.go
6
image.go
|
@ -1,14 +1,14 @@
|
|||
package gui
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewImage(name string) *Node {
|
||||
var newNode *Node
|
||||
newNode = parent.newNode(name, toolkit.Image)
|
||||
newNode = parent.newNode(name, widget.Image)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
6
label.go
6
label.go
|
@ -1,12 +1,12 @@
|
|||
package gui
|
||||
|
||||
import (
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewLabel(text string) *Node {
|
||||
newNode := parent.newNode(text, toolkit.Label)
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
newNode := parent.newNode(text, widget.Label)
|
||||
a := newAction(newNode, widget.Add)
|
||||
a.Text = text
|
||||
a.S = text
|
||||
sendAction(a)
|
||||
|
|
32
main.go
32
main.go
|
@ -4,7 +4,7 @@ import (
|
|||
"os"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// TODO: make a fake 'plugin' channel of communication to andlabs for mswindows
|
||||
|
@ -23,16 +23,16 @@ func init() {
|
|||
|
||||
// Populates the top of the binary tree
|
||||
me.rootNode = addNode("guiBinaryTree")
|
||||
me.rootNode.WidgetType = toolkit.Root
|
||||
me.rootNode.WidgetType = widget.Root
|
||||
|
||||
// used to pass debugging flags to the toolkit plugins
|
||||
me.flag = me.rootNode.newNode("flag", 0)
|
||||
me.flag.WidgetType = toolkit.Flag
|
||||
me.flag.WidgetType = widget.Flag
|
||||
|
||||
me.flag = me.rootNode.newNode("stdout", 0)
|
||||
me.flag.WidgetType = toolkit.Stdout
|
||||
me.flag.WidgetType = widget.Stdout
|
||||
|
||||
me.guiChan = make(chan toolkit.Action, 1)
|
||||
me.guiChan = make(chan widget.Action, 1)
|
||||
go watchCallback()
|
||||
}
|
||||
|
||||
|
@ -42,13 +42,13 @@ func watchCallback() {
|
|||
log.Info("watchCallback() restarted select for toolkit user events")
|
||||
select {
|
||||
case a := <-me.guiChan:
|
||||
if (a.ActionType == toolkit.UserQuit) {
|
||||
if (a.ActionType == widget.UserQuit) {
|
||||
log.Info("doUserEvent() User sent Quit()")
|
||||
me.rootNode.doCustom()
|
||||
log.Exit("wit/gui toolkit.UserQuit")
|
||||
break
|
||||
}
|
||||
if (a.ActionType == toolkit.EnableDebug) {
|
||||
if (a.ActionType == widget.EnableDebug) {
|
||||
log.Warn("doUserEvent() Enable Debugging Window")
|
||||
log.Warn("doUserEvent() TODO: not implemented")
|
||||
// DebugWindow()
|
||||
|
@ -78,37 +78,37 @@ func (n *Node) doCustom() {
|
|||
go n.Custom()
|
||||
}
|
||||
|
||||
func (n *Node) doUserEvent(a toolkit.Action) {
|
||||
func (n *Node) doUserEvent(a widget.Action) {
|
||||
log.Info("doUserEvent() node =", n.id, n.Name)
|
||||
switch n.WidgetType {
|
||||
case toolkit.Checkbox:
|
||||
case widget.Checkbox:
|
||||
n.B = a.B
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.B)
|
||||
n.doCustom()
|
||||
case toolkit.Button:
|
||||
case widget.Button:
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "button clicked")
|
||||
n.doCustom()
|
||||
case toolkit.Combobox:
|
||||
case widget.Combobox:
|
||||
n.S = a.S
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.S)
|
||||
n.doCustom()
|
||||
case toolkit.Dropdown:
|
||||
case widget.Dropdown:
|
||||
n.S = a.S
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.S)
|
||||
n.doCustom()
|
||||
case toolkit.Textbox:
|
||||
case widget.Textbox:
|
||||
n.S = a.S
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.S)
|
||||
n.doCustom()
|
||||
case toolkit.Spinner:
|
||||
case widget.Spinner:
|
||||
n.I = a.I
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.I)
|
||||
n.doCustom()
|
||||
case toolkit.Slider:
|
||||
case widget.Slider:
|
||||
n.I = a.I
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "set to:", n.I)
|
||||
n.doCustom()
|
||||
case toolkit.Window:
|
||||
case widget.Window:
|
||||
log.Info("doUserEvent() node =", n.id, n.Name, "window closed")
|
||||
n.doCustom()
|
||||
default:
|
||||
|
|
6
node.go
6
node.go
|
@ -2,19 +2,19 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
/*
|
||||
generic function to create a new node on the binary tree
|
||||
*/
|
||||
func (n *Node) newNode(title string, t toolkit.WidgetType) *Node {
|
||||
func (n *Node) newNode(title string, t widget.WidgetType) *Node {
|
||||
var newN *Node
|
||||
|
||||
newN = addNode(title)
|
||||
newN.WidgetType = t
|
||||
|
||||
if n.WidgetType == toolkit.Grid {
|
||||
if n.WidgetType == widget.Grid {
|
||||
n.gridIncrement()
|
||||
}
|
||||
newN.AtW = n.NextW
|
||||
|
|
34
plugin.go
34
plugin.go
|
@ -11,7 +11,7 @@ import (
|
|||
"plugin"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
var err error
|
||||
|
@ -31,7 +31,7 @@ type aplug struct {
|
|||
// From this channel, the information is then passed into the main program
|
||||
// Custom() function
|
||||
//
|
||||
Callback func(chan toolkit.Action)
|
||||
Callback func(chan widget.Action)
|
||||
|
||||
// This is how actions are sent to the toolkit.
|
||||
// For example:
|
||||
|
@ -42,8 +42,8 @@ type aplug struct {
|
|||
// each toolkit has it's own goroutine and each one is sent this
|
||||
// add button request
|
||||
//
|
||||
pluginChan chan toolkit.Action
|
||||
PluginChannel func() chan toolkit.Action
|
||||
pluginChan chan widget.Action
|
||||
PluginChannel func() chan widget.Action
|
||||
}
|
||||
|
||||
var allPlugins []*aplug
|
||||
|
@ -65,8 +65,8 @@ func initPlugin(name string) *aplug {
|
|||
}
|
||||
|
||||
// newPlug.PluginChannel = getPluginChannel(newPlug, "PluginChannel")
|
||||
func getPluginChannel(p *aplug, funcName string) func() chan toolkit.Action {
|
||||
var newfunc func() chan toolkit.Action
|
||||
func getPluginChannel(p *aplug, funcName string) func() chan widget.Action {
|
||||
var newfunc func() chan widget.Action
|
||||
var ok bool
|
||||
var test plugin.Symbol
|
||||
|
||||
|
@ -76,7 +76,7 @@ func getPluginChannel(p *aplug, funcName string) func() chan toolkit.Action {
|
|||
return nil
|
||||
}
|
||||
|
||||
newfunc, ok = test.(func() chan toolkit.Action)
|
||||
newfunc, ok = test.(func() chan widget.Action)
|
||||
if !ok {
|
||||
log.Log(PLUG, "function name =", funcName, "names didn't map correctly. Fix the plugin name =", p.name)
|
||||
return nil
|
||||
|
@ -84,8 +84,8 @@ func getPluginChannel(p *aplug, funcName string) func() chan toolkit.Action {
|
|||
return newfunc
|
||||
}
|
||||
|
||||
func sendCallback(p *aplug, funcName string) func(chan toolkit.Action) {
|
||||
var newfunc func(chan toolkit.Action)
|
||||
func sendCallback(p *aplug, funcName string) func(chan widget.Action) {
|
||||
var newfunc func(chan widget.Action)
|
||||
var ok bool
|
||||
var test plugin.Symbol
|
||||
|
||||
|
@ -95,7 +95,7 @@ func sendCallback(p *aplug, funcName string) func(chan toolkit.Action) {
|
|||
return nil
|
||||
}
|
||||
|
||||
newfunc, ok = test.(func(chan toolkit.Action))
|
||||
newfunc, ok = test.(func(chan widget.Action))
|
||||
if !ok {
|
||||
log.Log(PLUG, "function name =", funcName, "names didn't map correctly. Fix the plugin name =", p.name)
|
||||
return nil
|
||||
|
@ -216,8 +216,8 @@ func initToolkit(name string, filename string) *aplug {
|
|||
|
||||
// 2023/05/09 pretty clean
|
||||
// 2023/04/06 Queue() is also being used and channels are being used. memcopy() only
|
||||
func newAction(n *Node, atype toolkit.ActionType) *toolkit.Action {
|
||||
var a toolkit.Action
|
||||
func newAction(n *Node, atype widget.ActionType) *widget.Action {
|
||||
var a widget.Action
|
||||
a.ActionType = atype
|
||||
if (n == nil) {
|
||||
return &a
|
||||
|
@ -244,7 +244,7 @@ func newAction(n *Node, atype toolkit.ActionType) *toolkit.Action {
|
|||
}
|
||||
|
||||
// sends the action/event to each toolkit via a golang plugin channel
|
||||
func sendAction(a *toolkit.Action) {
|
||||
func sendAction(a *widget.Action) {
|
||||
for _, aplug := range allPlugins {
|
||||
log.Log(PLUG, "Action() aplug =", aplug.name, "Action type=", a.ActionType)
|
||||
if (aplug.pluginChan == nil) {
|
||||
|
@ -302,8 +302,8 @@ func (n *Node) LoadToolkit(name string) *Node {
|
|||
}
|
||||
|
||||
log.Log(PLUG, "LoadToolkit() sending InitToolkit action to the plugin channel")
|
||||
var a toolkit.Action
|
||||
a.ActionType = toolkit.InitToolkit
|
||||
var a widget.Action
|
||||
a.ActionType = widget.InitToolkit
|
||||
plug.pluginChan <- a
|
||||
// sleep(.5) // temp hack until chan communication is setup
|
||||
|
||||
|
@ -319,8 +319,8 @@ func (n *Node) CloseToolkit(name string) bool {
|
|||
log.Log(PLUG, "CloseToolkit() found", plug.name)
|
||||
if (plug.name == name) {
|
||||
log.Log(PLUG, "CloseToolkit() sending close", name)
|
||||
var a toolkit.Action
|
||||
a.ActionType = toolkit.CloseToolkit
|
||||
var a widget.Action
|
||||
a.ActionType = widget.CloseToolkit
|
||||
plug.pluginChan <- a
|
||||
// sleep(.5) // is this needed? TODO: properly close channel
|
||||
return true
|
||||
|
|
|
@ -2,7 +2,7 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// This recreates the whole GUI for a plugin
|
||||
|
@ -23,12 +23,12 @@ func (n *Node) redraw(p *aplug) {
|
|||
func (n *Node) redo(plug *aplug) {
|
||||
log.Info("redo()", plug.name, n.id, n.WidgetType, n.Name)
|
||||
|
||||
var a *toolkit.Action
|
||||
a = new(toolkit.Action)
|
||||
var a *widget.Action
|
||||
a = new(widget.Action)
|
||||
a.Name = n.Name
|
||||
a.Text = n.Text
|
||||
|
||||
a.ActionType = toolkit.Add
|
||||
a.ActionType = widget.Add
|
||||
a.WidgetType = n.WidgetType
|
||||
a.WidgetId = n.id
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewSlider(name string, x int, y int) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Slider)
|
||||
newNode := parent.newNode(name, widget.Slider)
|
||||
|
||||
newNode.Custom = func() {
|
||||
log.Log(GUI, "even newer clicker() name in NewSlider name =", name)
|
||||
|
@ -14,7 +14,7 @@ func (parent *Node) NewSlider(name string, x int, y int) *Node {
|
|||
|
||||
newNode.X = x
|
||||
newNode.Y = y
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
a.X = x
|
||||
a.Y = y
|
||||
sendAction(a)
|
||||
|
|
|
@ -2,11 +2,11 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewSpinner(name string, x int, y int) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Spinner)
|
||||
newNode := parent.newNode(name, widget.Spinner)
|
||||
|
||||
newNode.Custom = func() {
|
||||
log.Info("default NewSpinner() change", name)
|
||||
|
@ -15,7 +15,7 @@ func (parent *Node) NewSpinner(name string, x int, y int) *Node {
|
|||
newNode.X = x
|
||||
newNode.Y = y
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package gui
|
|||
import (
|
||||
"sync"
|
||||
"embed"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
//
|
||||
|
@ -35,7 +35,7 @@ type guiConfig struct {
|
|||
counter int // used to make unique WidgetId's
|
||||
|
||||
// sets the chan for the plugins to call back too
|
||||
guiChan chan toolkit.Action
|
||||
guiChan chan widget.Action
|
||||
|
||||
// option to pass in compiled plugins as embedded files
|
||||
resFS embed.FS
|
||||
|
@ -50,7 +50,7 @@ type guiConfig struct {
|
|||
type Node struct {
|
||||
id int
|
||||
|
||||
WidgetType toolkit.WidgetType
|
||||
WidgetType widget.WidgetType
|
||||
|
||||
// for NewLabel("hello"), Text = 'hello'
|
||||
Text string // what is visable to the user
|
||||
|
|
10
textbox.go
10
textbox.go
|
@ -3,23 +3,23 @@ package gui
|
|||
import (
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (parent *Node) NewTextbox(name string) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Textbox)
|
||||
newNode := parent.newNode(name, widget.Textbox)
|
||||
|
||||
newNode.Custom = func() {
|
||||
log.Log(GUI, "NewTextbox changed =", name)
|
||||
}
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
||||
func (parent *Node) NewEntryLine(name string) *Node {
|
||||
newNode := parent.newNode(name, toolkit.Textbox)
|
||||
newNode := parent.newNode(name, widget.Textbox)
|
||||
|
||||
newNode.X = 1
|
||||
|
||||
|
@ -27,7 +27,7 @@ func (parent *Node) NewEntryLine(name string) *Node {
|
|||
log.Log(GUI, "NewTextbox changed =", name)
|
||||
}
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package gui
|
|||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/toolkits"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// This routine creates a blank window with a Title and size (W x H)
|
||||
|
@ -11,12 +11,12 @@ func (parent *Node) NewWindow(title string) *Node {
|
|||
var newNode *Node
|
||||
|
||||
// Windows are created off of the master node of the Binary Tree
|
||||
newNode = parent.newNode(title, toolkit.Window)
|
||||
newNode = parent.newNode(title, widget.Window)
|
||||
newNode.Custom = StandardExit
|
||||
|
||||
log.Info("NewWindow()", title)
|
||||
|
||||
a := newAction(newNode, toolkit.Add)
|
||||
a := newAction(newNode, widget.Add)
|
||||
sendAction(a)
|
||||
return newNode
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue