Go to file
Pietro Gagliardi ba2c1d6d20 Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
test Added a println() to the main test window to signal that window closing has happened. This is used for ensuring that closing programs from a task switcher works as expected (that is, that the appropriate w.Closing event is triggered if an individual window is asked to be closed, and something else if an application as a whole is...). 2014-04-02 10:27:41 -04:00
unmigrated Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
winbuttonsize Added question about Windows proper sizes... for now... 2014-04-03 19:19:19 -04:00
.travis.yml Changed -qq to -y in the apt-get install line in .travis.yaml because I want to see the full details of the install. 2014-03-24 11:54:30 -04:00
LICENSE Added license and README. 2014-02-17 18:38:50 -05:00
README.md Put FreeBSD dependency installation notes in the README. 2014-03-27 17:24:00 -04:00
area.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
area_darwin.go Fixed mouse move events on Mac OS X not returning buttons right, I think: turns out I was sending the wrong message in. Now I have to figure out how to filter out mouse move messages; then I can really make sure this works right... 2014-04-03 23:52:26 -04:00
area_unix.go Got rid of gtkWidget and changed to using *C.GtkWidget everywhere. This gets rid of some of the casting functions and invocations of said functions, and only adds sysdata_unix.go to the cgo list. 2014-04-01 16:30:38 -04:00
area_windows.go Fixed the major scrolling corruption on Windows: had to commit the scroll changes before we can get to them in our painting routine =P This doesn't fix ALL the issues; check the (now-updated) TODO. 2014-04-02 23:40:38 -04:00
areaplan.md Added the proper provision for numeric keypad entry. 2014-03-29 12:57:54 -04:00
bleh_darwin.m Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
button.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
callbacks_unix.go Got rid of gtkWidget and changed to using *C.GtkWidget everywhere. This gets rid of some of the casting functions and invocations of said functions, and only adds sysdata_unix.go to the cgo list. 2014-04-01 16:30:38 -04:00
checkbox.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -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 the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
comctl_windows.go Forced Common Controls version 6 on Windows by embedding the needed manifest in. 2014-04-02 13:47:11 -04:00
common_windows.go Forced Common Controls version 6 on Windows by embedding the needed manifest in. 2014-04-02 13:47:11 -04:00
control.go Updated the documentation: Area now works on all platforms, Modifiers behavior on both left and right keys simultaneously is undefined for now, and the way to create custom Controls no longer involves embedding Area. 2014-03-30 19:57:24 -04:00
controlcandidates.md Fixed odd Listbox sizing on Windows. (Windows by default sizes List Box controls so that partial items are not visible.) 2014-04-02 10:15:04 -04:00
controls_windows.go Adjusted Button and Combobox sizes on Windows to be better... 2014-04-03 21:00:38 -04: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 Removed objc_new(). The idea is to remove all the objc_* functions that aren't prefixed with C. (except objc_getClass()). 2014-04-04 17:50:27 -04:00
dialog.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
dialog_darwin.go Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
dialog_unix.go Moved <stdlib.h> includes in the GTK+ backend to gtk_unix.h; organized that file a bit. 2014-04-01 16:01:49 -04:00
dialog_windows.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
doc.go Removed ui.Event(); all event channels are initialized with their objects now. 2014-03-12 21:47:39 -04:00
events_darwin.go Another name in events_darwin.go (see previous commit). 2014-03-30 22:20:23 -04:00
events_notdarwin.go Finished re-adding the numeric keypad keys and fixing up the GTK+ Area implementation to handle the new KeyEvent. Everything seems to work on this end... 2014-03-29 13:09:27 -04:00
events_windows.go Added part of keyboard input on Windows. Need to repaint the window on event return and handle area sizes now... 2014-03-29 17:52:40 -04:00
grid.go Changed the new resizing code so that it uses the same allocated slice per window instead of making a new one to store all the resize requests each time. 2014-03-17 21:09:03 -04:00
gtk_unix.h Moved <stdlib.h> includes in the GTK+ backend to gtk_unix.h; organized that file a bit. 2014-04-01 16:01:49 -04:00
gtkcalls_unix.go Got rid of gtkWidget and changed to using *C.GtkWidget everywhere. This gets rid of some of the casting functions and invocations of said functions, and only adds sysdata_unix.go to the cgo list. 2014-04-01 16:30:38 -04:00
gtkcasts_unix.go Got rid of gtkWidget and changed to using *C.GtkWidget everywhere. This gets rid of some of the casting functions and invocations of said functions, and only adds sysdata_unix.go to the cgo list. 2014-04-01 16:30:38 -04:00
implementation.md Updated README with this decision. Also other documents as well. 2014-03-18 11:55:01 -04:00
init.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
init_windows.go Added GDI+ to the package's Windows version: DLL loaded, initialized, and shut down. It will be used for drawing to Areas because using GDI itself is more complex than it needs to be. 2014-03-24 17:01:33 -04:00
label.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
layoutplan.md Added a new layout plan for Stack. 2014-02-24 10:22:23 -05:00
lineedit.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
listbox.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
listbox_darwin.go Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
listbox_unix.go Got rid of gtkWidget and changed to using *C.GtkWidget everywhere. This gets rid of some of the casting functions and invocations of said functions, and only adds sysdata_unix.go to the cgo list. 2014-04-01 16:30:38 -04:00
menus_windows.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
objc_darwin.go Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
objc_darwin.h Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
plan.md Added version compatibility notes to plan.md. 2014-02-16 16:55:48 -05:00
prefsize_darwin.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
prefsize_unix.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
prefsize_windows.go Adjusted Button and Combobox sizes on Windows to be better... 2014-04-03 21:00:38 -04:00
progressbar.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -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 Changed the new resizing code so that it uses the same allocated slice per window instead of making a new one to store all the resize requests each time. 2014-03-17 21:09:03 -04:00
stdfont_windows.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
stdwndclass_windows.go Corrected a copy-paste fail in stdwndclass_windows.go that broke compilation (this is why you test builds on all platforms, folks!) and added a TODO about resizing on Windows in the meantime. 2014-03-24 11:36:15 -04:00
sysdata.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
sysdata_darwin.go Removed objc_msgSend_uint(). 2014-04-04 18:56:37 -04:00
sysdata_unix.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
sysdata_windows.go Fixed Listbox and LineEdit borders on Windows. Also more TODOs. 2014-04-02 19:57:49 -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 More TODOs. 2014-04-04 18:39:06 -04:00
uitask_darwin.go Removed objc_release(). 2014-04-04 18:08:23 -04:00
uitask_unix.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00
uitask_windows.go Fixed the Windows stalling when scrolling an Area problem: messages were getting lost because (I assume) scrolling is done in a modal event loop. Alas, we have to change to using a dummy window to handle events. Also altered the respective TODO to document bugs now exposed by this fix. 2014-04-01 19:10:30 -04:00
window.go Removed the initText parameter from sysData.make() and changed all invocations to call sysData.setText() separately; this avoids the need to check if sysData.setText() is valid. Also implemented that on GTK+. 2014-04-01 16:43:56 -04:00
windows_windows.go Separated file creation dates from the package comment. 2014-03-12 21:55:45 -04:00

README.md

Build Status

Native UI library for Go

THIS PACKAGE IS UNDER ACTIVE DEVELOPMENT. It can be used; the API is stable enough at this point, but keep in mind there may still be crashes and API changes, as suggestions are always open. 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).

UPDATE 12 March 2014: Windows 2000 is no longer supported as it is no longer supported by Go.

UPDATE 18 March 2014: Resizes are now assumed to stop other UI event processing, and thus do not run with locks anymore. I changed real control resizing so that it doesn't need to lock (it just fills an array with data fed in), but real control preferredSize() and Stack/Grid.setRect() could potentially still be racy... if I am right it won't be an issue, but if anyone else knows, please let me know. (Everything else is thread-safe again.)

UPDATE 27 March 2014: Unix builds now require go tip due to a cgo fix that affected this package.

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 XP 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 (so until it is released, go tip) 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.
    • Note: you will need Go 1.3 or newer (as above) due to various cgo errors fixed in this version (such as this one).

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
  • for FreeBSD with the pkgng system, gtk3 is sufficient, however you will need to manually install pkgconf to please cgo (and you may need to specify CC=gcc47) (this should be put on the Go wiki)

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. "(invalid)" means the given OS/arch combination is not supported by Go.

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* (invalid)
dragonfly untested untested (invalid)
freebsd works untested (VM failure) untested
netbsd untested untested untested
openbsd untested untested (invalid)
solaris (invalid) Oracle Solaris 11: GTK+ 3 not available from official repos (invalid)
plan9 (not written yet; problems building Go) (not written) (invalid)
nacl (not sure how to handle) (not sure how to handle) (invalid)
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 (TODO choose between PCLinuxOS and Mageia - it appears the original Mandriva is either dead or nonfree and I would rather choose the fork that structures packages identically for parity; do they both?) 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 any possible conflicts between libthread and Go's runtime (I need to see how the Go runtime implements OS threads on Plan 9).)

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. I have received emails, however I am not likely to see those right away, so I don't suggest contacting me by email if your communication is urgent.

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.