Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
642929aca1 | |
|
a7cc6fa5d3 | |
|
59f97be98c | |
|
d4b7cd32d4 | |
|
ad6bb0f1c1 | |
|
73a1babad4 |
6
Makefile
6
Makefile
|
@ -1,4 +1,4 @@
|
||||||
all:
|
all: goimports vet
|
||||||
@echo
|
@echo
|
||||||
@echo This defines the primitive widgets
|
@echo This defines the primitive widgets
|
||||||
@echo
|
@echo
|
||||||
|
@ -19,3 +19,7 @@ redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@GO111MODULE=off go vet
|
||||||
|
@echo this go library builds okay
|
||||||
|
|
|
@ -8,6 +8,7 @@ Principles:
|
||||||
* Make code using this package simple to use
|
* Make code using this package simple to use
|
||||||
* Widget names should try to match [Wikipedia Graphical widget]
|
* Widget names should try to match [Wikipedia Graphical widget]
|
||||||
* It's ok to guess. Try to do something sensible.
|
* It's ok to guess. Try to do something sensible.
|
||||||
|
* TODO: use protobuf
|
||||||
```
|
```
|
||||||
|
|
||||||
### Links
|
### Links
|
||||||
|
|
23
action.go
23
action.go
|
@ -42,12 +42,15 @@ type Action struct {
|
||||||
|
|
||||||
// Make widgets fill up the space available
|
// Make widgets fill up the space available
|
||||||
Expand bool
|
Expand bool
|
||||||
|
|
||||||
|
TablePB []byte // a table protobuf
|
||||||
|
WidgetPB []byte // a tree of widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
|
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Add ActionType = iota
|
Add ActionType = iota + 1
|
||||||
Delete
|
Delete
|
||||||
SetText
|
SetText
|
||||||
AddText
|
AddText
|
||||||
|
@ -109,6 +112,22 @@ func (s ActionType) String() string {
|
||||||
return "Move"
|
return "Move"
|
||||||
case Dump:
|
case Dump:
|
||||||
return "Dump"
|
return "Dump"
|
||||||
|
case User:
|
||||||
|
return "User"
|
||||||
|
case ToolkitLoad:
|
||||||
|
return "ToolkitLoad"
|
||||||
|
case ToolkitInit:
|
||||||
|
return "ToolkitInit"
|
||||||
|
case ToolkitClose:
|
||||||
|
return "ToolkitClose"
|
||||||
|
case ToolkitPanic:
|
||||||
|
return "ToolkitPanic"
|
||||||
|
case Heartbeat:
|
||||||
|
return "Heartbeat"
|
||||||
|
case UserQuit:
|
||||||
|
return "UserQuit"
|
||||||
|
case EnableDebug:
|
||||||
|
return "EnableDebug"
|
||||||
}
|
}
|
||||||
return "ActionType.String() Error"
|
return "gui ActionType.String() Error. must be missing something in the code here"
|
||||||
}
|
}
|
||||||
|
|
2
doc.go
2
doc.go
|
@ -5,7 +5,6 @@ There are lots of issues when supporting multiple toolkit plugin
|
||||||
geometries. The geometries vary widely especially between the
|
geometries. The geometries vary widely especially between the
|
||||||
graphical displays and the serial console ones. [Graphical Widget](http://en.wikipedia.org/Graphical_Widget)
|
graphical displays and the serial console ones. [Graphical Widget](http://en.wikipedia.org/Graphical_Widget)
|
||||||
|
|
||||||
|
|
||||||
To simplyfy this, we stick to using the concepts:
|
To simplyfy this, we stick to using the concepts:
|
||||||
|
|
||||||
------------------------------ ^
|
------------------------------ ^
|
||||||
|
@ -44,6 +43,7 @@ Horizontal means layout widgets like books on a bookshelf
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Vertical means layout widgets like books in a stack
|
Vertical means layout widgets like books in a stack
|
||||||
|
|
||||||
----------
|
----------
|
||||||
| Widget |
|
| Widget |
|
||||||
----------
|
----------
|
||||||
|
|
2
geom.go
2
geom.go
|
@ -25,6 +25,7 @@ Horizontal means layout widgets like books on a bookshelf
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Vertical means layout widgets like books in a stack
|
Vertical means layout widgets like books in a stack
|
||||||
|
|
||||||
----------
|
----------
|
||||||
| Widget |
|
| Widget |
|
||||||
----------
|
----------
|
||||||
|
@ -51,5 +52,4 @@ func (s Orientation) String() string {
|
||||||
default:
|
default:
|
||||||
return "Horizontal"
|
return "Horizontal"
|
||||||
}
|
}
|
||||||
return "Horizontal"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ func GetString(A any) string {
|
||||||
// log.Warn("getString uknown kind", k, "value =", A)
|
// log.Warn("getString uknown kind", k, "value =", A)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// work like unix os.Exec() ? everything other than 0 is false
|
// work like unix os.Exec() ? everything other than 0 is false
|
||||||
|
@ -89,7 +88,6 @@ func GetBool(A any) bool {
|
||||||
// log.Warn("getString uknown kind", k, "value =", A)
|
// log.Warn("getString uknown kind", k, "value =", A)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// work like unix? everything other than 0 is false
|
// work like unix? everything other than 0 is false
|
||||||
|
@ -121,5 +119,4 @@ func GetInt(A any) int {
|
||||||
// log.Warn("getString uknown kind", k, "value =", A)
|
// log.Warn("getString uknown kind", k, "value =", A)
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
2
state.go
2
state.go
|
@ -1,5 +1,7 @@
|
||||||
package widget
|
package widget
|
||||||
|
|
||||||
|
// TODO: redo this with protocol buffers
|
||||||
|
|
||||||
// This is the state of the widget
|
// This is the state of the widget
|
||||||
|
|
||||||
// The whole state of the widget is sent
|
// The whole state of the widget is sent
|
||||||
|
|
|
@ -16,7 +16,7 @@ package widget
|
||||||
type WidgetType int // Button, Menu, Checkbox, etc.
|
type WidgetType int // Button, Menu, Checkbox, etc.
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Unknown WidgetType = iota
|
Unknown WidgetType = iota + 1
|
||||||
Root // the master 'root' node of the binary tree
|
Root // the master 'root' node of the binary tree
|
||||||
Flag // used to send configuration values to plugins
|
Flag // used to send configuration values to plugins
|
||||||
Window // in certain gui's (ncurses), these are tabs
|
Window // in certain gui's (ncurses), these are tabs
|
||||||
|
@ -33,6 +33,7 @@ const (
|
||||||
Textbox // is this a Label with edit=true
|
Textbox // is this a Label with edit=true
|
||||||
Slider // like a progress bar
|
Slider // like a progress bar
|
||||||
Spinner // like setting the oven temperature
|
Spinner // like setting the oven temperature
|
||||||
|
Table // a full window & table
|
||||||
Separator // TODO
|
Separator // TODO
|
||||||
Image // TODO
|
Image // TODO
|
||||||
Area // TODO
|
Area // TODO
|
||||||
|
@ -79,6 +80,8 @@ func (s WidgetType) String() string {
|
||||||
return "Spinner"
|
return "Spinner"
|
||||||
case Separator:
|
case Separator:
|
||||||
return "Separator"
|
return "Separator"
|
||||||
|
case Table:
|
||||||
|
return "Table"
|
||||||
case Image:
|
case Image:
|
||||||
return "Image"
|
return "Image"
|
||||||
case Area:
|
case Area:
|
||||||
|
|
Loading…
Reference in New Issue