start working on the docs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2613151b83
commit
ec4fb6aecb
24
Makefile
24
Makefile
|
@ -6,22 +6,16 @@ all:
|
||||||
@echo The widgets are things like Windows, Buttons, Labels, etc
|
@echo The widgets are things like Windows, Buttons, Labels, etc
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
# Test the README.md & doc.go file
|
||||||
|
# this runs pkgsite, the binary that does dev.go.dev
|
||||||
|
# go install golang.org/x/pkgsite/cmd/pkgsite@latest
|
||||||
|
pkgsite:
|
||||||
|
GO111MODULE= pkgsite
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
goimports -w *.go
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
|
|
||||||
# sync repo to the github backup
|
|
||||||
# git remote add github git@github.com:wit-go/widget.git
|
|
||||||
|
|
||||||
github:
|
|
||||||
git push origin master
|
|
||||||
git push origin devel
|
|
||||||
git push origin --tags
|
|
||||||
git push github master
|
|
||||||
git push github devel
|
|
||||||
git push github --tags
|
|
||||||
@echo
|
|
||||||
@echo check https://git.wit.org/gui/widget
|
|
||||||
@echo check https://github.com/wit-go/widget
|
|
||||||
@echo
|
|
||||||
|
|
|
@ -9,3 +9,8 @@ Principles:
|
||||||
* 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.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Links
|
||||||
|
|
||||||
|
- [A History of the GUI](https://arstechnica.com/features/2005/05/gui/)
|
||||||
|
- [Go Sources](https://go.googlesource.com/go)
|
||||||
|
|
69
doc.go
69
doc.go
|
@ -1,14 +1,57 @@
|
||||||
package widget
|
/*
|
||||||
|
# 2D geometry values
|
||||||
|
|
||||||
// passes information between the gui package and the toolkit plugins
|
There are lots of issues when supporting multiple toolkit plugin
|
||||||
//
|
geometries. The geometries vary widely especially between the
|
||||||
// This is the only thing that is passed between the toolkit plugin
|
graphical displays and the serial console ones. [Graphical Widget](http://en.wikipedia.org/Graphical_Widget)
|
||||||
//
|
|
||||||
// what names should be used? This is not part of [[Graphical Widget]]
|
|
||||||
// Event() seems like a good name.
|
To simplyfy this, we stick to using the concepts:
|
||||||
// Event is used too much: web dev, cloud, etc
|
|
||||||
// I'm using "Action". Maybe it should really be
|
------------------------------ ^
|
||||||
// "Interaction" as per wikipedia [[User interface]]
|
| top | |
|
||||||
//
|
| | |
|
||||||
// TODO: convert this to a protobuf (?)
|
| left right | height
|
||||||
//
|
| | |
|
||||||
|
| bottom | |
|
||||||
|
------------------------------ v
|
||||||
|
|
||||||
|
<----------- width ---------->
|
||||||
|
|
||||||
|
This way, width & height are always positive numbers.
|
||||||
|
|
||||||
|
The qustion of (top,bottom) & (left,right) becomes problematic.
|
||||||
|
|
||||||
|
In almost every toolkit, right > left. However, top & bottom
|
||||||
|
vary and a choice can not be made easily. Luckily, we maybe do
|
||||||
|
not have to make that decision here and can pass that determination
|
||||||
|
to the toolkits. So, we use excusively:
|
||||||
|
|
||||||
|
geom(left, right, top, bottom)
|
||||||
|
size(width, height)
|
||||||
|
|
||||||
|
# Orientation
|
||||||
|
|
||||||
|
Horizontal means layout widgets like books on a bookshelf
|
||||||
|
|
||||||
|
---------------------------------
|
||||||
|
| W | W | W | W | W | W | W | W |
|
||||||
|
| i | i | i | i | i | i | i | i |
|
||||||
|
| d | d | d | d | d | d | d | d |
|
||||||
|
| g | g | g | g | g | g | g | g |
|
||||||
|
| e | e | e | e | e | e | e | e |
|
||||||
|
| t | t | t | t | t | t | t | t |
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
Vertical means layout widgets like books in a stack
|
||||||
|
----------
|
||||||
|
| Widget |
|
||||||
|
----------
|
||||||
|
| Widget |
|
||||||
|
----------
|
||||||
|
| Widget |
|
||||||
|
----------
|
||||||
|
| Widget |
|
||||||
|
----------
|
||||||
|
*/
|
||||||
|
package widget
|
||||||
|
|
38
geom.go
38
geom.go
|
@ -1,37 +1,5 @@
|
||||||
package widget
|
package widget
|
||||||
|
|
||||||
/*
|
|
||||||
2D geometry values
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To simplyfy this, we stick to using the concepts:
|
|
||||||
|
|
||||||
------------------------------ ^
|
|
||||||
| top | |
|
|
||||||
| | |
|
|
||||||
| left right | height
|
|
||||||
| | |
|
|
||||||
| bottom | |
|
|
||||||
------------------------------ v
|
|
||||||
|
|
||||||
<----------- width ---------->
|
|
||||||
|
|
||||||
This way, width & height are always positive numbers.
|
|
||||||
|
|
||||||
The qustion of (top,bottom) & (left,right) becomes problematic.
|
|
||||||
|
|
||||||
In almost every toolkit, right > left. However, top & bottom
|
|
||||||
vary and a choice can not be made easily. Luckily, we maybe do
|
|
||||||
not have to make that decision here and can pass that determination
|
|
||||||
to the toolkits. So, we use excusively:
|
|
||||||
|
|
||||||
geom(left, right, top, bottom)
|
|
||||||
size(width, height)
|
|
||||||
*/
|
|
||||||
|
|
||||||
type Geom struct {
|
type Geom struct {
|
||||||
Left any
|
Left any
|
||||||
Right any
|
Right any
|
||||||
|
@ -45,8 +13,7 @@ type Size struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
```go
|
Horizontal means layout widgets like books on a bookshelf
|
||||||
Horizontal means layout widgets like books on a bookshelf
|
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
| W | W | W | W | W | W | W | W |
|
| W | W | W | W | W | W | W | W |
|
||||||
|
@ -57,7 +24,7 @@ type Size struct {
|
||||||
| t | t | t | t | t | t | t | t |
|
| t | t | t | t | t | t | t | t |
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Vertical means layout widgets like books in a stack
|
Vertical means layout widgets like books in a stack
|
||||||
----------
|
----------
|
||||||
| Widget |
|
| Widget |
|
||||||
----------
|
----------
|
||||||
|
@ -67,7 +34,6 @@ type Size struct {
|
||||||
----------
|
----------
|
||||||
| Widget |
|
| Widget |
|
||||||
----------
|
----------
|
||||||
```
|
|
||||||
*/
|
*/
|
||||||
type Orientation int
|
type Orientation int
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue