goimport lint
This commit is contained in:
parent
ad6bb0f1c1
commit
d4b7cd32d4
Notes:
Jeff Carr
2025-02-07 09:58:15 -06:00
// `autogen:go.mod` module go.wit.com/widget go 1.22 toolchain go1.23.4 // `autogen:`
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
|
||||||
|
|
30
action.go
30
action.go
|
@ -7,13 +7,13 @@ type Action struct {
|
||||||
WidgetId int
|
WidgetId int
|
||||||
ParentId int
|
ParentId int
|
||||||
|
|
||||||
State State
|
State State
|
||||||
|
|
||||||
// Text string // what is visable to the user
|
// 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
|
// most primitive widgets just store a single thing
|
||||||
Value any
|
Value any
|
||||||
|
|
||||||
// how to arrange widgets
|
// how to arrange widgets
|
||||||
Direction Orientation
|
Direction Orientation
|
||||||
|
@ -23,25 +23,25 @@ type Action struct {
|
||||||
// These must be unique
|
// These must be unique
|
||||||
Strings []string
|
Strings []string
|
||||||
|
|
||||||
Range RangeType
|
Range RangeType
|
||||||
|
|
||||||
// RETHINK / REDO EVERYTHING BELOW HERE
|
// RETHINK / REDO EVERYTHING BELOW HERE
|
||||||
// This is used for things like a slider(0,100)
|
// This is used for things like a slider(0,100)
|
||||||
X int
|
X int
|
||||||
Y int
|
Y int
|
||||||
|
|
||||||
// This is for the grid size & widget position
|
// This is for the grid size & widget position
|
||||||
W int
|
W int
|
||||||
H int
|
H int
|
||||||
AtW int
|
AtW int
|
||||||
AtH int
|
AtH int
|
||||||
|
|
||||||
// Put space around elements to improve look & feel
|
// Put space around elements to improve look & feel
|
||||||
// Margin bool avoided due to use of action types
|
// Margin bool avoided due to use of action types
|
||||||
// Pad bool
|
// Pad bool
|
||||||
|
|
||||||
// Make widgets fill up the space available
|
// Make widgets fill up the space available
|
||||||
Expand bool
|
Expand bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
|
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
|
||||||
|
@ -66,14 +66,14 @@ const (
|
||||||
Append
|
Append
|
||||||
Move
|
Move
|
||||||
Dump
|
Dump
|
||||||
User // the user did something (mouse, keyboard, etc)
|
User // the user did something (mouse, keyboard, etc)
|
||||||
ToolkitLoad // attempts to load a new toolkit
|
ToolkitLoad // attempts to load a new toolkit
|
||||||
ToolkitInit // initializes the toolkit
|
ToolkitInit // initializes the toolkit
|
||||||
ToolkitClose // closes the toolkit
|
ToolkitClose // closes the toolkit
|
||||||
ToolkitPanic
|
ToolkitPanic
|
||||||
Heartbeat
|
Heartbeat
|
||||||
CloseWindow
|
CloseWindow
|
||||||
UserQuit // the user closed the GUI
|
UserQuit // the user closed the GUI
|
||||||
EnableDebug // open the debugging window
|
EnableDebug // open the debugging window
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
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 |
|
||||||
----------
|
----------
|
||||||
|
|
10
geom.go
10
geom.go
|
@ -1,14 +1,14 @@
|
||||||
package widget
|
package widget
|
||||||
|
|
||||||
type Geom struct {
|
type Geom struct {
|
||||||
Left any
|
Left any
|
||||||
Right any
|
Right any
|
||||||
Top any
|
Top any
|
||||||
Bottom any
|
Bottom any
|
||||||
}
|
}
|
||||||
|
|
||||||
type Size struct {
|
type Size struct {
|
||||||
Width any
|
Width any
|
||||||
Height 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
|
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"
|
|
||||||
}
|
}
|
||||||
|
|
2
grid.go
2
grid.go
|
@ -31,7 +31,7 @@ package widget
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
type GridSize struct {
|
type GridSize struct {
|
||||||
Width int
|
Width int
|
||||||
Height int
|
Height int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
range.go
2
range.go
|
@ -5,6 +5,6 @@ package widget
|
||||||
// seem to be a good idea to use 'type any' here as it
|
// seem to be a good idea to use 'type any' here as it
|
||||||
// just makes things more complicated for no good reason
|
// just makes things more complicated for no good reason
|
||||||
type RangeType struct {
|
type RangeType struct {
|
||||||
Low int
|
Low int
|
||||||
High int
|
High int
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
28
state.go
28
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
|
||||||
|
@ -11,14 +13,14 @@ package widget
|
||||||
// just makes things more complicated for no good reason
|
// just makes things more complicated for no good reason
|
||||||
type State struct {
|
type State struct {
|
||||||
// This is a unmodifiable string that is displayed to the user.
|
// This is a unmodifiable string that is displayed to the user.
|
||||||
Label string
|
Label string
|
||||||
|
|
||||||
// most primitive widgets just store a single thing
|
// most primitive widgets just store a single thing
|
||||||
// it is the default value
|
// it is the default value
|
||||||
DefaultS string
|
DefaultS string
|
||||||
CurrentS string
|
CurrentS string
|
||||||
CurrentI int
|
CurrentI int
|
||||||
NewString string
|
NewString string
|
||||||
|
|
||||||
// most primitive widgets just store a single thing
|
// most primitive widgets just store a single thing
|
||||||
// it is the default value
|
// it is the default value
|
||||||
|
@ -64,19 +66,19 @@ type State struct {
|
||||||
Strings []string
|
Strings []string
|
||||||
|
|
||||||
// for widgets that use a range
|
// for widgets that use a range
|
||||||
Range RangeType
|
Range RangeType
|
||||||
|
|
||||||
Geom Geom
|
Geom Geom
|
||||||
Size Size
|
Size Size
|
||||||
|
|
||||||
GridSize GridSize
|
GridSize GridSize
|
||||||
GridOffset GridOffset
|
GridOffset GridOffset
|
||||||
|
|
||||||
// This is for the grid size & widget position
|
// This is for the grid size & widget position
|
||||||
W int
|
W int
|
||||||
H int
|
H int
|
||||||
AtW int
|
AtW int
|
||||||
AtH int
|
AtH int
|
||||||
|
|
||||||
// a name useful for programming and the debugger.
|
// a name useful for programming and the debugger.
|
||||||
// It is not intended to be displayed to the user
|
// It is not intended to be displayed to the user
|
||||||
|
|
36
widget.go
36
widget.go
|
@ -17,30 +17,30 @@ type WidgetType int // Button, Menu, Checkbox, etc.
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Unknown WidgetType = iota + 1
|
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
|
||||||
Tab // internally, this is a window
|
Tab // internally, this is a window
|
||||||
Frame // deprecate?
|
Frame // deprecate?
|
||||||
Grid // like drawers in a chest
|
Grid // like drawers in a chest
|
||||||
Group // like the 'Appetizers' section on a menu
|
Group // like the 'Appetizers' section on a menu
|
||||||
Box // a vertical or horizontal stack of widgets
|
Box // a vertical or horizontal stack of widgets
|
||||||
Button
|
Button
|
||||||
Checkbox // select 'on' or 'off'
|
Checkbox // select 'on' or 'off'
|
||||||
Dropdown
|
Dropdown
|
||||||
Combobox // dropdown with edit=true
|
Combobox // dropdown with edit=true
|
||||||
Label
|
Label
|
||||||
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
|
||||||
Separator // TODO
|
Separator // TODO
|
||||||
Image // TODO
|
Image // TODO
|
||||||
Area // TODO
|
Area // TODO
|
||||||
Form // TODO
|
Form // TODO
|
||||||
Font // TODO
|
Font // TODO
|
||||||
Color // TODO
|
Color // TODO
|
||||||
Dialog // TODO
|
Dialog // TODO
|
||||||
Stdout // can be used to capture and display log output
|
Stdout // can be used to capture and display log output
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s WidgetType) String() string {
|
func (s WidgetType) String() string {
|
||||||
|
|
Loading…
Reference in New Issue