start working on the docs

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-05 12:21:47 -06:00
parent 2613151b83
commit ec4fb6aecb
4 changed files with 72 additions and 64 deletions

View File

@ -6,22 +6,16 @@ all:
@echo The widgets are things like Windows, Buttons, Labels, etc
@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:
rm -f go.*
GO111MODULE= go mod init
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

View File

@ -9,3 +9,8 @@ Principles:
* Widget names should try to match [Wikipedia Graphical widget]
* 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
View File

@ -1,14 +1,57 @@
package widget
/*
# 2D geometry values
// passes information between the gui package and the toolkit plugins
//
// This is the only thing that is passed between the toolkit plugin
//
// what names should be used? This is not part of [[Graphical Widget]]
// Event() seems like a good name.
// Event is used too much: web dev, cloud, etc
// I'm using "Action". Maybe it should really be
// "Interaction" as per wikipedia [[User interface]]
//
// TODO: convert this to a protobuf (?)
//
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:
------------------------------ ^
| 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)
# 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
View File

@ -1,37 +1,5 @@
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 {
Left 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 |
@ -57,7 +24,7 @@ type Size struct {
| 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 |
----------
@ -67,7 +34,6 @@ type Size struct {
----------
| Widget |
----------
```
*/
type Orientation int