summaryrefslogtreecommitdiff
path: root/nocui
diff options
context:
space:
mode:
Diffstat (limited to 'nocui')
-rw-r--r--nocui/action.go94
-rw-r--r--nocui/common.go20
-rw-r--r--nocui/event.go20
-rw-r--r--nocui/main.go8
-rw-r--r--nocui/stdin.go8
-rw-r--r--nocui/widget.go6
6 files changed, 78 insertions, 78 deletions
diff --git a/nocui/action.go b/nocui/action.go
index b746c25..19a42b4 100644
--- a/nocui/action.go
+++ b/nocui/action.go
@@ -1,7 +1,7 @@
package main
import (
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
func (n *node) show(b bool) {
@@ -10,24 +10,24 @@ func (n *node) show(b bool) {
func (n *node) enable(b bool) {
}
-func (n *node) pad(at toolkit.ActionType) {
+func (n *node) pad(at widget.ActionType) {
switch n.WidgetType {
- case toolkit.Group:
+ case widget.Group:
switch at {
- case toolkit.Margin:
+ case widget.Margin:
// SetMargined(true)
- case toolkit.Unmargin:
+ case widget.Unmargin:
// SetMargined(false)
- case toolkit.Pad:
+ case widget.Pad:
// SetMargined(true)
- case toolkit.Unpad:
+ case widget.Unpad:
// SetMargined(false)
}
- case toolkit.Tab:
- case toolkit.Window:
- case toolkit.Grid:
- case toolkit.Box:
- case toolkit.Textbox:
+ case widget.Tab:
+ case widget.Window:
+ case widget.Grid:
+ case widget.Box:
+ case widget.Textbox:
log(logError, "TODO: implement ActionType =", at)
default:
log(logError, "TODO: implement pad() for", at)
@@ -38,14 +38,14 @@ func (n *node) move(newParent *node) {
p := n.parent
switch p.WidgetType {
- case toolkit.Group:
- case toolkit.Tab:
+ case widget.Group:
+ case widget.Tab:
// tabSetMargined(tParent.uiTab, true)
- case toolkit.Window:
+ case widget.Window:
// t.uiWindow.SetBorderless(false)
- case toolkit.Grid:
+ case widget.Grid:
// t.uiGrid.SetPadded(true)
- case toolkit.Box:
+ case widget.Box:
log(logInfo, "TODO: move() where =", p.ParentId)
log(logInfo, "TODO: move() for widget =", n.WidgetId)
default:
@@ -60,15 +60,15 @@ func (n *node) Delete() {
log(logNow, "uiDelete()", n.WidgetId, "to", p.WidgetId)
switch p.WidgetType {
- case toolkit.Group:
+ case widget.Group:
// tParent.uiGroup.SetMargined(true)
- case toolkit.Tab:
+ case widget.Tab:
// tabSetMargined(tParent.uiTab, true)
- case toolkit.Window:
+ case widget.Window:
// t.uiWindow.SetBorderless(false)
- case toolkit.Grid:
+ case widget.Grid:
// t.uiGrid.SetPadded(true)
- case toolkit.Box:
+ case widget.Box:
log(logNow, "tWidget.boxC =", p.Name)
log(logNow, "is there a tParent parent? =", p.parent)
// this didn't work:
@@ -81,11 +81,11 @@ func (n *node) Delete() {
}
}
-func doAction(a *toolkit.Action) {
+func doAction(a *widget.Action) {
log(logNow, "doAction() START a.ActionType =", a.ActionType)
log(logNow, "doAction() START a.S =", a.S)
- if (a.ActionType == toolkit.InitToolkit) {
+ if (a.ActionType == widget.InitToolkit) {
// TODO: make sure to only do this once
// go uiMain.Do(func() {
// ui.Main(demoUI)
@@ -97,11 +97,11 @@ func doAction(a *toolkit.Action) {
log(logNow, "doAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId)
switch a.WidgetType {
- case toolkit.Root:
+ case widget.Root:
me.rootNode = addNode(a)
log(logNow, "doAction() found rootNode")
return
- case toolkit.Flag:
+ case widget.Flag:
// flag(&a)
return
}
@@ -109,40 +109,40 @@ func doAction(a *toolkit.Action) {
n := me.rootNode.findWidgetId(a.WidgetId)
switch a.ActionType {
- case toolkit.Add:
+ case widget.Add:
addNode(a)
- case toolkit.Show:
+ case widget.Show:
n.show(true)
- case toolkit.Hide:
+ case widget.Hide:
n.show(false)
- case toolkit.Enable:
+ case widget.Enable:
n.enable(true)
- case toolkit.Disable:
+ case widget.Disable:
n.enable(false)
- case toolkit.Get:
+ case widget.Get:
// n.setText(a.S)
- case toolkit.GetText:
+ case widget.GetText:
switch a.WidgetType {
- case toolkit.Textbox:
+ case widget.Textbox:
a.S = n.S
}
- case toolkit.Set:
+ case widget.Set:
// n.setText(a.S)
- case toolkit.SetText:
+ case widget.SetText:
// n.setText(a.S)
- case toolkit.AddText:
+ case widget.AddText:
// n.setText(a.S)
- case toolkit.Margin:
- n.pad(toolkit.Unmargin)
- case toolkit.Unmargin:
- n.pad(toolkit.Margin)
- case toolkit.Pad:
- n.pad(toolkit.Pad)
- case toolkit.Unpad:
- n.pad(toolkit.Unpad)
- case toolkit.Delete:
+ case widget.Margin:
+ n.pad(widget.Unmargin)
+ case widget.Unmargin:
+ n.pad(widget.Margin)
+ case widget.Pad:
+ n.pad(widget.Pad)
+ case widget.Unpad:
+ n.pad(widget.Unpad)
+ case widget.Delete:
n.Delete()
- case toolkit.Move:
+ case widget.Move:
log(logNow, "doAction() attempt to move() =", a.ActionType, a.WidgetType)
newParent := me.rootNode.findWidgetId(a.ParentId)
n.move(newParent)
diff --git a/nocui/common.go b/nocui/common.go
index 91b34dd..077055e 100644
--- a/nocui/common.go
+++ b/nocui/common.go
@@ -12,22 +12,22 @@ package main
*/
import (
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
// this is the channel we send user events like
// mouse clicks or keyboard events back to the program
-var callback chan toolkit.Action
+var callback chan widget.Action
// this is the channel we get requests to make widgets
-var pluginChan chan toolkit.Action
+var pluginChan chan widget.Action
type node struct {
parent *node
children []*node
WidgetId int // widget ID
- WidgetType toolkit.WidgetType
+ WidgetType widget.WidgetType
ParentId int // parent ID
Name string
@@ -90,21 +90,21 @@ func (n *node) doUserEvent() {
log(logError, "doUserEvent() callback == nil", n.WidgetId)
return
}
- var a toolkit.Action
+ var a widget.Action
a.WidgetId = n.WidgetId
a.Name = n.Name
a.Text = n.Text
a.S = n.S
a.I = n.I
a.B = n.B
- a.ActionType = toolkit.User
+ a.ActionType = widget.User
log(logInfo, "doUserEvent() START: send a user event to the callback channel")
callback <- a
log(logInfo, "doUserEvent() END: sent a user event to the callback channel")
return
}
-func addNode(a *toolkit.Action) *node {
+func addNode(a *widget.Action) *node {
n := new(node)
n.WidgetType = a.WidgetType
n.WidgetId = a.WidgetId
@@ -129,7 +129,7 @@ func addNode(a *toolkit.Action) *node {
n.tk = initWidget(n)
// n.tk = new(guiWidget)
- if (a.WidgetType == toolkit.Root) {
+ if (a.WidgetType == widget.Root) {
log(logInfo, "addNode() Root")
return n
}
@@ -157,10 +157,10 @@ func addNode(a *toolkit.Action) *node {
// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
//
// this sets the channel to send user events back from the plugin
-func Callback(guiCallback chan toolkit.Action) {
+func Callback(guiCallback chan widget.Action) {
callback = guiCallback
}
-func PluginChannel() chan toolkit.Action {
+func PluginChannel() chan widget.Action {
return pluginChan
}
diff --git a/nocui/event.go b/nocui/event.go
index 103e1b1..406e634 100644
--- a/nocui/event.go
+++ b/nocui/event.go
@@ -1,46 +1,46 @@
package main
import (
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
func (n *node) doWidgetClick() {
switch n.WidgetType {
- case toolkit.Root:
+ case widget.Root:
// THIS IS THE BEGINING OF THE LAYOUT
// rootNode.nextW = 0
// rootNode.nextH = 0
// rootNode.redoTabs(true)
- case toolkit.Flag:
+ case widget.Flag:
// me.rootNode.redoColor(true)
// rootNode.dumpTree(true)
- case toolkit.Window:
+ case widget.Window:
// setCurrentWindow(w)
n.doUserEvent()
- case toolkit.Tab:
+ case widget.Tab:
// setCurrentTab(w)
- case toolkit.Group:
+ case widget.Group:
// n.placeWidgets()
// n.toggleTree()
- case toolkit.Checkbox:
+ case widget.Checkbox:
if (n.B) {
// n.setCheckbox(false)
} else {
// n.setCheckbox(true)
}
n.doUserEvent()
- case toolkit.Grid:
+ case widget.Grid:
// rootNode.hideWidgets()
// n.placeGrid()
// n.showWidgets()
- case toolkit.Box:
+ case widget.Box:
// n.showWidgetPlacement(logNow, "drawTree()")
if (n.B) {
log(true, "BOX IS HORIZONTAL", n.Name)
} else {
log(true, "BOX IS VERTICAL", n.Name)
}
- case toolkit.Button:
+ case widget.Button:
n.doUserEvent()
default:
}
diff --git a/nocui/main.go b/nocui/main.go
index dfaf50c..2188928 100644
--- a/nocui/main.go
+++ b/nocui/main.go
@@ -2,7 +2,7 @@ package main
import (
"sync"
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
var muAction sync.Mutex
@@ -31,11 +31,11 @@ func catchActionChannel() {
// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
//
// this sets the channel to send user events back from the plugin
-func Callback(guiCallback chan toolkit.Action) {
+func Callback(guiCallback chan widget.Action) {
callback = guiCallback
}
-func PluginChannel() chan toolkit.Action {
+func PluginChannel() chan widget.Action {
return pluginChan
}
*/
@@ -46,7 +46,7 @@ func init() {
log(logInfo, "Init()")
// andlabs = make(map[int]*andlabsT)
- pluginChan = make(chan toolkit.Action, 1)
+ pluginChan = make(chan widget.Action, 1)
log(logNow, "Init() start channel reciever")
go catchActionChannel()
diff --git a/nocui/stdin.go b/nocui/stdin.go
index 2c16e24..0cf2783 100644
--- a/nocui/stdin.go
+++ b/nocui/stdin.go
@@ -7,7 +7,7 @@ import (
"strings"
"strconv"
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
func simpleStdin() {
@@ -23,8 +23,8 @@ func simpleStdin() {
log(true, "show buttons")
me.rootNode.showButtons()
case "d":
- var a toolkit.Action
- a.ActionType = toolkit.EnableDebug
+ var a widget.Action
+ a.ActionType = widget.EnableDebug
callback <- a
case "":
fmt.Println("")
@@ -45,7 +45,7 @@ func simpleStdin() {
}
func (n *node) showButtons() {
- if n.WidgetType == toolkit.Button {
+ if n.WidgetType == widget.Button {
n.dumpWidget("Button:")
}
diff --git a/nocui/widget.go b/nocui/widget.go
index 71082a6..989634d 100644
--- a/nocui/widget.go
+++ b/nocui/widget.go
@@ -1,7 +1,7 @@
package main
import (
- "go.wit.com/gui/toolkits"
+ "go.wit.com/gui/widget"
)
// this is specific to the nocui toolkit
@@ -10,14 +10,14 @@ func initWidget(n *node) *guiWidget {
w = new(guiWidget)
// Set(w, "default")
- if n.WidgetType == toolkit.Root {
+ if n.WidgetType == widget.Root {
log(logInfo, "setupWidget() FOUND ROOT w.id =", n.WidgetId)
n.WidgetId = 0
me.rootNode = n
return w
}
- if (n.WidgetType == toolkit.Box) {
+ if (n.WidgetType == widget.Box) {
if (n.B) {
n.horizontal = true
} else {