Go to file
Pietro Gagliardi 353c949f64 Removed error returns from sysData.setText() now that we no longer care. 2014-03-10 10:39:08 -04:00
test Added bounds checks for Listbox.InsertBefore(). This stupid 32-bit Mac bug keeps Listbox.Delete() unchecked for now... 2014-03-09 10:51:01 -04:00
unmigrated Re-added Windows font grabbing code. I won't use it just yet, since I only now realize I don't actually need it for preferred sizes, but eh 2014-02-24 11:55:38 -05:00
.travis.yml Remove the 32-bit GTK+ from linux/386 Travis.ci builds; I have no idea how to fix this. 2014-03-05 12:38:49 -05:00
LICENSE Added license and README. 2014-02-17 18:38:50 -05:00
README.md Added a known build matrix for documentation purposes. 2014-03-10 01:06:22 -04:00
bleh_darwin.m Have ui.Go() return on main() return on Mac OS X. 2014-03-05 20:09:15 -05:00
button.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
callbacks_unix.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
checkbox.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
cocoalists Added the beginning of the Mac OS X implementation of Combobox; also added a file to plan out how lists will be implemented/are being implemented. 2014-03-02 17:19:25 -05:00
combobox.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
comctl_windows.go Removed a stray TODO about a constant in comctl_windows.go. 2014-02-25 13:17:22 -05:00
common_windows.go Added Windows implementation of ProgressBar and the requisite comctl32.dll code. 2014-02-25 08:28:10 -05:00
control.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
controlcandidates.md More control candidate information. 2014-03-07 09:12:15 -05:00
controls_windows.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
d32 cgo inserts -m32 automatically, so we don't need to in ./d32. 2014-03-08 17:32:56 -05:00
delegate_darwin.go Fixed Mac OS X control placement flipping. This is done by passing the height of the window around setRect() calls to avoid polling the content view frame each time. 2014-03-03 17:44:03 -05:00
dialog.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
dialog_darwin.go Added the Mac OS X implementation of messageboxes. 2014-03-02 18:37:25 -05:00
dialog_unix.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
dialog_windows.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
grid.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
gtkcalls_unix.go Added Combobox/Listbox.Len() and its GTK+ implementation. 2014-03-08 16:42:57 -05:00
gtkcasts_unix.go Added GTK+ implementation of ProgressBar and added a ProgressBar to the test program. 2014-02-25 00:49:08 -05:00
implementation.md Updated the implementation.md file for Mac OS X. 2014-03-03 18:04:33 -05:00
init.go Update ui.Go() documentation to show that it will return nil when its main() returns now that that behavior is fully implemented. 2014-03-05 20:11:45 -05:00
init_windows.go Added Windows implementation of ProgressBar and the requisite comctl32.dll code. 2014-02-25 08:28:10 -05:00
label.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
layoutplan.md Added a new layout plan for Stack. 2014-02-24 10:22:23 -05:00
lineedit.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
listbox.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
listbox_darwin.go Made Listboxes non-editable in Mac OS X; also more TODOs. 2014-03-09 11:33:05 -04:00
listbox_unix.go Removed gListboxSelected; it was never being called anyway (only gListboxSelectedMulti is; Windows still uses selectedIndex() for Listbox because of differences in how multi-selection listboxes are handled there and Mac OS X never had this function written to begin with). 2014-03-09 11:36:44 -04:00
menus_windows.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
objc_darwin.go Added initial Mac OS X sysData code. Almost ready for first test build, hopefully? 2014-03-01 13:29:24 -05:00
objc_darwin.h Have ui.Go() return on main() return on Mac OS X. 2014-03-05 20:09:15 -05:00
plan.md Added version compatibility notes to plan.md. 2014-02-16 16:55:48 -05:00
prefsize_darwin.go Removed a leftover crash guard from the Mac OS X sysData code (in this case sysData.preferredSize()). 2014-03-03 15:45:26 -05:00
prefsize_unix.go Added the preferred widget size basework and its GTK+ implementation. 2014-02-23 20:04:33 -05:00
prefsize_windows.go Changed Windows sysData.preferredSize() to panic on error, since the other platforms don't return explicit errors either. 2014-03-09 19:34:43 -04:00
progressbar.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
restrictions.md Windows sysData has been adjusted to deal with child controls. Rather than storing the parent window, it is passed as an argument to sysData.make(), which does the child ID allocation. Child IDs are now window-local, getting rid of that restriction. 2014-02-12 21:08:10 -05:00
stack.go Removed error returns from Control.preferredSize() since errors are not going to be returned anymore. 2014-03-09 19:44:41 -04:00
stdfont_windows.go Re-added Windows font grabbing code. I won't use it just yet, since I only now realize I don't actually need it for preferred sizes, but eh 2014-02-24 11:55:38 -05:00
stdwndclass_windows.go Fixed Mac OS X control placement flipping. This is done by passing the height of the window around setRect() calls to avoid polling the content view frame each time. 2014-03-03 17:44:03 -05:00
sysdata.go Removed error returns from sysData.setText() now that we no longer care. 2014-03-10 10:39:08 -04:00
sysdata_darwin.go Removed error returns from sysData.setText() now that we no longer care. 2014-03-10 10:39:08 -04:00
sysdata_unix.go Removed error returns from sysData.setText() now that we no longer care. 2014-03-10 10:39:08 -04:00
sysdata_windows.go Removed error returns from sysData.setText() now that we no longer care. 2014-03-10 10:39:08 -04:00
test.sh Changed the ".." import in the test binary to a proper "github.com/andlabs/ui" import. (This means I finally moved my working environment out of a folder src/wingo and into the proper src/github.com/andlabs/ui.) 2014-03-04 23:10:48 -05:00
todo.md Removed now-unused error returns from sysData.show() and sysData.hide(). 2014-03-09 21:56:17 -04:00
uitask_darwin.go Have ui.Go() return on main() return on Mac OS X. 2014-03-05 20:09:15 -05:00
uitask_unix.go Have ui.Go() return on main() return on Unix. 2014-03-05 13:25:19 -05:00
uitask_windows.go Have ui.Go() return on main() return on Windows. 2014-03-05 13:21:45 -05:00
window.go Removed error returns from Window.Show() and Window.Hide(). Also properly locked the Window's mutex lock in both functions. 2014-03-09 21:47:22 -04:00
windows_windows.go Moved to a proper package; main() is now a test and go test -c is used to build. Once I iron out a bug with Windows event handling, I'll add a README. 2014-02-19 11:41:10 -05:00
winerrors.md More TODO reduction. 2014-02-15 15:41:50 -05:00

README.md

Build Status

Native UI library for Go

THIS PACKAGE IS UNDER ACTIVE DEVELOPMENT. Feel free to start using it, but mind: it's far from feature-complete, it's still in need of testing and crash-fixing, and the API can (and will) change. If you can help, please do! Run ./test to build a test binary test/test which runs a (mostly) feature-complete UI test. Run ./d32 ./test to build a 32-bit version (you will need a cgo-enabled 32-bit go environment, and I have only tested this on Mac OS X).

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.
    • Note: you will need Go 1.3 or newer for this verison, as it uses a single .m file due to technical restrictions (read the comments in bleh_darwin.m for details), and earlier versions of Go do not auto-build .m files.
  • 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.

For an example of how ui is used, see https://github.com/andlabs/wakeup, which is a small program that implements a basic alarm clock.

Known To Have Ever Been Built Matrices

For convenience's sake, here are matrices of builds that I have personally done at least once. Each cell represents the run status. These matrices represent builds that I have done at any point in development; it is not a guarantee that the current version works. (I built this list to answer questions of whether or not ui works with a specific configuration.) Only configurations marked with a * are tested during active development.

386 amd64 arm
windows works on windows; works on wine* works on windows; fails on wine (invalid)
linux see table below see table below Raspian: works
darwin (Mac OS X) works* (cross-compiled from 64-bit) works* (not applicable)
dragonfly untested untested ????
freebsd untested (VM failure) untested (VM failure) untested
netbsd untested untested ????
openbsd untested untested ????
solaris (invalid) untested (invalid)
plan9 (not written yet; problems building Go) (invalid?) ????
nacl (not sure how to handle) (not sure how to handle) ????
linux 386 amd64
Kubuntu (14.04) works; cross-compiling on 64-bit Linux fails due to nonexistent .so symlinks works*
Fedora untested untested
openSUSE untested untested
Arch Linux untested untested
Mandriva untested untested
Slackware untested untested
Gentoo untested untested

(The above list should cover all the bases of major Linux distributions and variants thereof; I might add a dedicated Debian test later but other than that... suggestions welcome. Kubuntu 64-bit is my main system and the main development platform; the Windows builds are cross-compiled from here. And yes, this also implies I seriously consider a Plan 9 port of the library using libcontrol, though I'm guessing this will blow up in my face due to the conflict between libthread and Go's runtime.)

Contributing

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.

If you want to dive in, 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.

Please suggest documentation improvements as well.