summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md141
1 files changed, 62 insertions, 79 deletions
diff --git a/README.md b/README.md
index 3ab8d30..775be32 100644
--- a/README.md
+++ b/README.md
@@ -4,19 +4,33 @@ Package gui implements a abstraction layer for Go visual elements.
Definitions:
+```go
* Toolkit: the underlying GUI library (MacOS gui, Windows gui, gtk, qt, etc)
* Node: A binary tree of all the underlying widgets
+```
Principles:
+```go
* Make code using this package simple to use
* Hide complexity internally here
* Isolate the GUI toolkit
* Widget names should try to match [Wikipedia Graphical widget]
* When in doubt, search upward in the binary tree
* It's ok to guess. Try to do something sensible.
+```
+
+## Debian Build
+
+This worked on debian sid (mate-desktop) on 2023/12/03
+I didn't record the dependances needed (gtk-dev)
+
+```go
+export GO111MODULE="off"
+make
+```
-Quick Start
+Hello World Example
```go
// This creates a simple hello world window
@@ -56,22 +70,12 @@ func addTab(w *gui.Node, title string) {
}
```
-## Debian Build
-
-This worked on debian sid on 2022/10/20
-I didn't record the dependances needed
+External Toolkits
```go
-GO111MODULE="off" go get -v -t -u git.wit.org/wit/gui
-cd ~/go/src/git.wit.org/wit/gui/cmds/helloworld/
-GO111MODULE="off" go build -v -x
-[./helloworld](./helloworld)
-```
-
-Toolkits
-
* andlabs - [https://github.com/andlabs/ui](https://github.com/andlabs/ui)
* gocui - [https://github.com/awesome-gocui/gocui](https://github.com/awesome-gocui/gocui)
+```
The next step is to allow this to work against go-gtk and go-qt.
@@ -89,75 +93,56 @@ hopefully also things like libSDL, faiface/pixel, slint
Useful links and other
external things which might be useful
-* [Wikipedia Graphical widget](https://en.wikipedia.org/wiki/Graphical_widget)
-* [GO Style Guide](https://google.github.io/styleguide/go/index) Code this way
-* [MS Windows Application Library Kit](https://github.com/lxn/walk)
-* [Federated git pull](https://github.com/forgefed/forgefed) Hopefully this will work for me with gitea
-* [Github mirror](https://github.com/wit-go/gui) This repo on mirror. Hopefully I won't have to use this.
-* [WIT GO projects](https://go.wit.org/) Attempt to model go.uber.org
-
-## Functions
-
-### func [GetDebug](/structs.go#L25)
-
-`func GetDebug() bool`
-
-### func [GetDebugToolkit](/structs.go#L37)
-
-`func GetDebugToolkit() bool`
-
-### func [IndentPrintln](/structs.go#L188)
+[Wikipedia Graphical widget]: [https://en.wikipedia.org/wiki/Graphical_widget](https://en.wikipedia.org/wiki/Graphical_widget)
+[Github mirror]: [https://github.com/witorg/gui](https://github.com/witorg/gui)
+[Federated git pull]: [https://github.com/forgefed/forgefed](https://github.com/forgefed/forgefed)
+[GO Style Guide]: [https://google.github.io/styleguide/go/index](https://google.github.io/styleguide/go/index)
-`func IndentPrintln(a ...interface{})`
-
-### func [Init](/main.go#L41)
+```go
+* [Wikipedia Graphical widget]
+* [Github mirror]
+* [Federated git pull]
+* [GO Style Guide]
+```
-`func Init()`
+## Functions
-### func [LoadToolkit](/plugin.go#L37)
+### func [DebugWidgetWindow](/debugWidget.go#L52)
-`func LoadToolkit(name string)`
+`func DebugWidgetWindow(w *Node)`
-loads and initializes a toolkit (andlabs/ui, gocui, etc)
+### func [DebugWindow](/debugWindow.go#L21)
-### func [Main](/main.go#L56)
+`func DebugWindow()`
-`func Main(f func())`
+Creates a window helpful for debugging this package
-### func [Queue](/main.go#L77)
+### func [ExampleCatcher](/chan.go#L37)
-`func Queue(f func())`
+`func ExampleCatcher(f func())`
-Other goroutines must use this to access the GUI
+### func [Indent](/debug.go#L124)
-You can not acess / process the GUI thread directly from
-other goroutines. This is due to the nature of how
-Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
-For example: gui.Queue(NewWindow())
+`func Indent(b bool, a ...interface{})`
-### func [SetDebug](/structs.go#L29)
+### func [SetDebug](/debug.go#L28)
`func SetDebug(s bool)`
-### func [SetDebugToolkit](/structs.go#L41)
+### func [SetFlag](/debug.go#L50)
-`func SetDebugToolkit(s bool)`
+`func SetFlag(s string, b bool)`
-### func [ShowDebugValues](/structs.go#L45)
+### func [ShowDebugValues](/debug.go#L82)
`func ShowDebugValues()`
-### func [StandardClose](/main.go#L83)
+### func [StandardExit](/main.go#L153)
-`func StandardClose(n *Node)`
+`func StandardExit()`
-The window is destroyed but the application does not quit
-
-### func [StandardExit](/main.go#L90)
-
-`func StandardExit(n *Node)`
-
-The window is destroyed but the application does not quit
+The window is destroyed and the application exits
+TODO: properly exit the plugin since Quit() doesn't do it
### func [Watchdog](/watchdog.go#L16)
@@ -165,43 +150,39 @@ The window is destroyed but the application does not quit
This program sits here.
If you exit here, the whole thing will os.Exit()
+TODO: use Ticker
This goroutine can be used like a watchdog timer
## Types
-### type [GuiConfig](/structs.go#L68)
+### type [GuiArgs](/structs.go#L29)
-`type GuiConfig struct { ... }`
+`type GuiArgs struct { ... }`
+
+This struct can be used with the go-arg package
#### Variables
```golang
-var Config GuiConfig
+var GuiArg GuiArgs
```
-### type [GuiOptions](/structs.go#L56)
-
-`type GuiOptions struct { ... }`
-
-This struct can be used with go-arg
-
-### type [Node](/structs.go#L87)
+### type [Node](/structs.go#L59)
`type Node struct { ... }`
-The Node is simply the name and the size of whatever GUI element exists
+The Node is a binary tree. This is how all GUI elements are stored
+simply the name and the size of whatever GUI element exists
-#### func [NewWindow](/window.go#L15)
+#### func [New](/main.go#L120)
-`func NewWindow() *Node`
+`func New() *Node`
-This routine creates a blank window with a Title and size (W x H)
-
-This routine can not have any arguements due to the nature of how
-it can be passed via the 'andlabs/ui' queue which, because it is
-cross platform, must pass UI changes into the OS threads (that is
-my guess).
+There should only be one of these per application
+This is due to restrictions by being cross platform
+some toolkit's on some operating systems don't support more than one
+Keep things simple. Do the default expected thing whenever possible
### type [Symbol](/plugin.go#L17)
@@ -209,6 +190,8 @@ my guess).
## Sub Packages
+* [log](./log)
+
* [toolkit](./toolkit)
---