Platform-native GUI library for Go.
Branch: master
Clone or download
Latest commit 867a9e5 Sep 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Added a winmanifest package for including a generic Windows manifest.… Sep 2, 2018
winmanifest Added a winmanifest package for including a generic Windows manifest.… Sep 2, 2018
LICENSE Added license and README. Feb 17, 2014
README.md Oops Sep 2, 2018
TODO.md More TODOs. Jan 7, 2016
area.go And finally migrated Area back. Aug 26, 2018
areahandler.go And finally migrated Area back. Aug 26, 2018
box.go Migrated window.go, box.go, button.go, and checkbox.go back. Aug 26, 2018
button.go Migrated window.go, box.go, button.go, and checkbox.go back. Aug 26, 2018
checkbox.go Migrated window.go, box.go, button.go, and checkbox.go back. Aug 26, 2018
colorbutton.go Migrated drawtext.go and fontbutton.go. Aug 26, 2018
combobox.go Migrated more controls. Aug 26, 2018
control.go Migrate the link_darwin_amd64.go and control.go files back; fixed up … Aug 26, 2018
datetimepicker.go Migrated datetimepicker.go and brought stddialogs.go back again. Aug 26, 2018
draw.go And migrated the examples back; also fixed a spot I missed. Aug 26, 2018
drawtext.go Migrated drawtext.go and fontbutton.go. Aug 26, 2018
dummy_windows.cpp Set up the Windows builds. Almost working! Jun 5, 2016
editablecombobox.go Migrated more controls. Aug 26, 2018
entry.go Migrated more controls. Aug 26, 2018
fontbutton.go Migrated drawtext.go and fontbutton.go. Aug 26, 2018
form.go Migrated more controls. Aug 26, 2018
grid.go Migrated more controls. Aug 26, 2018
group.go Migrated more controls. Aug 26, 2018
image.go Changed image.NRGBA to image.RGBA for Alpha 4.1. Sep 1, 2018
label.go Migrated more controls. Aug 26, 2018
libui_darwin_amd64.a And let's try the alpha 4.1 release again. Sep 2, 2018
libui_linux_386.a And let's try the alpha 4.1 release again. Sep 2, 2018
libui_linux_amd64.a And let's try the alpha 4.1 release again. Sep 2, 2018
libui_windows_386.a And finally replaced the Windows binaries with Alpha 4.1. Sep 2, 2018
libui_windows_amd64.a And finally replaced the Windows binaries with Alpha 4.1. Sep 2, 2018
link_darwin_amd64.go Migrate the link_darwin_amd64.go and control.go files back; fixed up … Aug 26, 2018
link_linux_386.go Migrated link_linux_386.go back. Nice to see it really working at last. Sep 2, 2018
link_linux_amd64.go Of course I had to redo that release. Anyway also merge link_linux_am… Sep 2, 2018
link_windows_386.go And moved the other link files back. It works! Sep 2, 2018
link_windows_amd64.go And moved the other link files back. It works! Sep 2, 2018
main.go Migrated util.go and main.go to the new pkgui convention and C file. … Aug 26, 2018
multilineentry.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
pkgui.c And FINALLY ported Table. Now to write an example program. Aug 26, 2018
pkgui.h And FINALLY ported Table. Now to write an example program. Aug 26, 2018
progressbar.go Migrated more controls. Aug 26, 2018
radiobuttons.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
separator.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
slider.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
spinbox.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
stddialogs.go Migrated datetimepicker.go and brought stddialogs.go back again. Aug 26, 2018
tab.go More control migration. Everything beyond this point is nontrivial. Aug 26, 2018
table.go And FINALLY ported Table. Now to write an example program. Aug 26, 2018
tablemodel.go And migrated tablemodel.go back. And now we can finally build it prop… Aug 26, 2018
ui.h Updated ui.h and the OS X and Linux binaries for Alpha 4.1. Need to w… Sep 1, 2018
util.go Zero-fill pkguiAlloc()'s output. Aug 26, 2018
window.go Migrated window.go, box.go, button.go, and checkbox.go back. Aug 26, 2018

README.md

ui: platform-native GUI library for Go

This is a library that aims to provide simple GUI software development in Go. It is based on my libui, a simple cross-platform library that does the same thing, but written in C.

It runs on/requires:

  • Windows: cgo, Windows Vista SP2 with Platform Update and newer
  • Mac OS X: cgo, Mac OS X 10.8 and newer
  • other Unixes: cgo, GTK+ 3.10 and newer
    • Debian, Ubuntu, etc.: sudo apt-get install libgtk-3-dev
    • Red Hat/Fedora, etc.: sudo dnf install gtk3-devel

It also requires Go 1.8 or newer.

It currently aligns to libui's Alpha 4.1, with only a small handful of functions not available.

Status

Package ui is currently mid-alpha software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. The libui README has more information.

Installation

Once you have the dependencies installed, a simple

go get github.com/andlabs/ui/...

should suffice.

Documentation

The in-code documentation is sufficient to get started, but needs improvement.

Some simple example programs are in the examples directory. You can go build each of them individually.

Windows manifests

Package ui requires a manifest that specifies Common Controls v6 to run on Windows. It should at least also state as supported Windows Vista and Windows 7, though to avoid surprises with other packages (or with Go itself; see this issue) you should state compatibility with higher versions of Windows too.

The simplest option is provided as a subpackage winmanifest; you can simply import it without a name, and it'll set things up properly:

import _ "github.com/andlabs/ui/winmanifest"

You do not have to worry about importing this in non-Windows-only files; it does nothing on non-Windows platforms.

If you wish to use your own manifest instead, you can use the one in winmanifest as a template to see what's required and how. You'll need to specify the template in a .rc file and use windres in MinGW-w64 to generate a .syso file as follows:

windres -i resources.rc -o winmanifest_windows_GOARCH.syso -O coff

You may also be interested in the github.com/akavel/rsrc and github.com/josephspurrier/goversioninfo packages, which provide other Go-like options for embedding the manifest.

Note that if you choose to ship a manifest as a separate .exe.manifest file instead of embedding it in your binary, and you use Cygwin or MSYS2 as the source of your MinGW-w64, Cygwin and MSYS2 instruct gcc to embed a default manifest of its own if none is specified. This default will override your manifest file! See this issue for more details, including workaround instructions.

macOS program execution

If you run a macOS program binary directly from the command line, it will start in the background. This is intentional; see this for more details.