### THIS PACKAGE IS UNSTABLE AND PRELIMINARY. In fact, it is presently compiled as package `main` for ease of cross-platform testing and debugging. Once major issues are dealt with and the Mac OS X build working, I will likely move to packge `ui` and move `main()` to a test.
This is a simple library for building cross-platform GUI programs in Go. It targets Windows and all Unix variants (except Mac OS X until further notice) and provides a thread-safe, channel-based API.
There is documentation, but due to the note above, you won't be able to see it just yet. Refer to `main.go` for an example.
This is a simple library for building cross-platform GUI programs in Go. It targets Windows, Mac OS X, Linux, and other Unixes, and provides a thread-safe, channel-based API. The API itself is minimal; it aims to provide only what is necessary for GUI program design. That being said, suggestions are welcome. Layout is done using various layout managers, and some effort is taken to conform to the target platform's UI guidelines. Otherwise, the library uses native toolkits.
ui aims to run on all supported versions of supported platforms. To be more precise, the system requirements are:
* Windows: Windows 2000 or newer. The Windows backend uses package `syscall` and calls Windows DLLs directly, so does not rely on cgo.
* Mac OS X: Mac OS X 10.6 (Snow Leopard) or newer. Objective-C dispatch is done by interfacing with libobjc directly, and thus this uses cgo.
* Other Unixes: The Unix backend uses GTK+, and thus cgo. It requires GTK+ 3.4 or newer; for Ubuntu this means 12.04 LTS (Precise Pangolin) at minimum. Check your distribution.
ui itself has no outside Go package dependencies; it is entirely self-contained.
To install, simply `go get` this package. On Mac OS X, make sure you have the Apple development headers. On other Unixes, make sure you have the GTK+ development files (for Ubuntu, `libgtk-3-dev` is sufficient).
Package documentation is available at http://godoc.org/github.com/andlabs/ui.
The following is an example program to illustrate what programming with ui is like:
```go
package main
import (
"fmt"
"github.com/andlabs/ui"
)
func main() {
w := ui.NewWindow("Main Window", 320, 240)
w.Closing = ui.Event()
b := ui.NewButton("Click Me")
b2 := ui.NewButton("Or Me")
s2 := ui.NewStack(Horizontal, b, b2)
c := ui.NewCheckbox("Check Me")
cb1 := ui.NewCombobox(true, "You can edit me!", "Yes you can!", "Yes you will!")
cb2 := ui.NewCombobox(false, "You can't edit me!", "No you can't!", "No you won't!")
e := ui.NewLineEdit("Enter text here too")
l := ui.NewLabel("This is a label")
b3 := ui.NewButton("List Info")
s3 := ui.NewStack(ui.Horizontal, l, b3)
s0 := ui.NewStack(ui.Vertical, s2, c, cb1, cb2, e, s3)
Contributions are welcome. File issues, pull requests, approach me on IRC (pietro10 in #go-nuts; andlabs elsewhere), etc. Even suggestions are welcome: while I'm mainly drawing from my own GUI programming experience, everyone is different.
Read implementation.md: this is a description of how the library works. (Feel free to suggest improvements to this as well). The other .md files in this repository contain various development notes.