From ec4fb6aecb83df430a378d604a52c562084b2265 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 5 Feb 2024 12:21:47 -0600 Subject: [PATCH] start working on the docs Signed-off-by: Jeff Carr --- Makefile | 24 ++++++++----------- README.md | 5 ++++ doc.go | 69 ++++++++++++++++++++++++++++++++++++++++++++----------- geom.go | 38 ++---------------------------- 4 files changed, 72 insertions(+), 64 deletions(-) diff --git a/Makefile b/Makefile index 102bea6..3402f85 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 12b5c9f..2959bdd 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/doc.go b/doc.go index 7719a9d..99f99fd 100644 --- a/doc.go +++ b/doc.go @@ -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 diff --git a/geom.go b/geom.go index 238c417..f76ea34 100644 --- a/geom.go +++ b/geom.go @@ -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