summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--action.go30
-rw-r--r--doc.go2
-rw-r--r--geom.go10
-rw-r--r--grid.go2
-rw-r--r--range.go2
-rw-r--r--reflect.go3
-rw-r--r--state.go28
-rw-r--r--widget.go36
9 files changed, 61 insertions, 58 deletions
diff --git a/Makefile b/Makefile
index 3402f85..bf089d3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all:
+all: goimports vet
@echo
@echo This defines the primitive widgets
@echo
@@ -19,3 +19,7 @@ redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy
+
+vet:
+ @GO111MODULE=off go vet
+ @echo this go library builds okay
diff --git a/action.go b/action.go
index 31ed5ab..84a71b0 100644
--- a/action.go
+++ b/action.go
@@ -7,13 +7,13 @@ type Action struct {
WidgetId int
ParentId int
- State State
+ State State
// Text string // what is visable to the user
- ProgName string // a name useful for programming
+ ProgName string // a name useful for programming
// most primitive widgets just store a single thing
- Value any
+ Value any
// how to arrange widgets
Direction Orientation
@@ -23,25 +23,25 @@ type Action struct {
// These must be unique
Strings []string
- Range RangeType
+ Range RangeType
// RETHINK / REDO EVERYTHING BELOW HERE
// This is used for things like a slider(0,100)
- X int
- Y int
+ X int
+ Y int
// This is for the grid size & widget position
- W int
- H int
- AtW int
- AtH int
+ W int
+ H int
+ AtW int
+ AtH int
// Put space around elements to improve look & feel
// Margin bool avoided due to use of action types
// Pad bool
// Make widgets fill up the space available
- Expand bool
+ Expand bool
}
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
@@ -66,14 +66,14 @@ const (
Append
Move
Dump
- User // the user did something (mouse, keyboard, etc)
- ToolkitLoad // attempts to load a new toolkit
- ToolkitInit // initializes the toolkit
+ User // the user did something (mouse, keyboard, etc)
+ ToolkitLoad // attempts to load a new toolkit
+ ToolkitInit // initializes the toolkit
ToolkitClose // closes the toolkit
ToolkitPanic
Heartbeat
CloseWindow
- UserQuit // the user closed the GUI
+ UserQuit // the user closed the GUI
EnableDebug // open the debugging window
)
diff --git a/doc.go b/doc.go
index 99f99fd..d1f5c79 100644
--- a/doc.go
+++ b/doc.go
@@ -5,7 +5,6 @@ There are lots of issues when supporting multiple toolkit plugin
geometries. The geometries vary widely especially between the
graphical displays and the serial console ones. [Graphical Widget](http://en.wikipedia.org/Graphical_Widget)
-
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
+
----------
| Widget |
----------
diff --git a/geom.go b/geom.go
index f76ea34..a4688db 100644
--- a/geom.go
+++ b/geom.go
@@ -1,14 +1,14 @@
package widget
type Geom struct {
- Left any
- Right any
- Top any
+ Left any
+ Right any
+ Top any
Bottom any
}
type Size struct {
- Width any
+ Width any
Height any
}
@@ -25,6 +25,7 @@ Horizontal means layout widgets like books on a bookshelf
---------------------------------
Vertical means layout widgets like books in a stack
+
----------
| Widget |
----------
@@ -51,5 +52,4 @@ func (s Orientation) String() string {
default:
return "Horizontal"
}
- return "Horizontal"
}
diff --git a/grid.go b/grid.go
index 0adedff..11048b4 100644
--- a/grid.go
+++ b/grid.go
@@ -31,7 +31,7 @@ package widget
// --------------------------------------
type GridSize struct {
- Width int
+ Width int
Height int
}
diff --git a/range.go b/range.go
index b110cb8..e9ca1e1 100644
--- a/range.go
+++ b/range.go
@@ -5,6 +5,6 @@ package widget
// seem to be a good idea to use 'type any' here as it
// just makes things more complicated for no good reason
type RangeType struct {
- Low int
+ Low int
High int
}
diff --git a/reflect.go b/reflect.go
index c2d301a..f2c753d 100644
--- a/reflect.go
+++ b/reflect.go
@@ -56,7 +56,6 @@ func GetString(A any) string {
// log.Warn("getString uknown kind", k, "value =", A)
return ""
}
- return ""
}
// 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)
return false
}
- return 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)
return -1
}
- return -1
}
diff --git a/state.go b/state.go
index 7b7c7d8..c81ccf4 100644
--- a/state.go
+++ b/state.go
@@ -1,5 +1,7 @@
package widget
+// TODO: redo this with protocol buffers
+
// This is the state of the widget
// The whole state of the widget is sent
@@ -11,14 +13,14 @@ package widget
// just makes things more complicated for no good reason
type State struct {
// This is a unmodifiable string that is displayed to the user.
- Label string
+ Label string
// most primitive widgets just store a single thing
// it is the default value
- DefaultS string
- CurrentS string
- CurrentI int
- NewString string
+ DefaultS string
+ CurrentS string
+ CurrentI int
+ NewString string
// most primitive widgets just store a single thing
// it is the default value
@@ -64,19 +66,19 @@ type State struct {
Strings []string
// for widgets that use a range
- Range RangeType
+ Range RangeType
- Geom Geom
- Size Size
+ Geom Geom
+ Size Size
- GridSize GridSize
+ GridSize GridSize
GridOffset GridOffset
// This is for the grid size & widget position
- W int
- H int
- AtW int
- AtH int
+ W int
+ H int
+ AtW int
+ AtH int
// a name useful for programming and the debugger.
// It is not intended to be displayed to the user
diff --git a/widget.go b/widget.go
index e80d113..6b9849b 100644
--- a/widget.go
+++ b/widget.go
@@ -17,30 +17,30 @@ type WidgetType int // Button, Menu, Checkbox, etc.
const (
Unknown WidgetType = iota + 1
- Root // the master 'root' node of the binary tree
- Flag // used to send configuration values to plugins
- Window // in certain gui's (ncurses), these are tabs
- Tab // internally, this is a window
- Frame // deprecate?
- Grid // like drawers in a chest
- Group // like the 'Appetizers' section on a menu
- Box // a vertical or horizontal stack of widgets
+ Root // the master 'root' node of the binary tree
+ Flag // used to send configuration values to plugins
+ Window // in certain gui's (ncurses), these are tabs
+ Tab // internally, this is a window
+ Frame // deprecate?
+ Grid // like drawers in a chest
+ Group // like the 'Appetizers' section on a menu
+ Box // a vertical or horizontal stack of widgets
Button
Checkbox // select 'on' or 'off'
Dropdown
Combobox // dropdown with edit=true
Label
- Textbox // is this a Label with edit=true
- Slider // like a progress bar
- Spinner // like setting the oven temperature
+ Textbox // is this a Label with edit=true
+ Slider // like a progress bar
+ Spinner // like setting the oven temperature
Separator // TODO
- Image // TODO
- Area // TODO
- Form // TODO
- Font // TODO
- Color // TODO
- Dialog // TODO
- Stdout // can be used to capture and display log output
+ Image // TODO
+ Area // TODO
+ Form // TODO
+ Font // TODO
+ Color // TODO
+ Dialog // TODO
+ Stdout // can be used to capture and display log output
)
func (s WidgetType) String() string {