Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.
Go to file
Pietro Gagliardi eeb20c316b Fixed uiSpinbox events not working on Windows. NOW let's alpha 3.1. 2016-06-05 17:12:10 -04:00
_wip Moved sv/ into _wip/. 2016-05-28 17:41:50 -04:00
common Started a new cmake file. Seems to work so far... 2016-06-03 14:56:21 -04:00
darwin More notes. 2016-06-04 00:16:37 -04:00
doc Pinned down resource numbers now. 2016-06-04 14:36:55 -04:00
examples More cmake work. That's enough of Visual Studio for now. 2016-06-03 19:25:43 -04:00
test More cmake stuff. MSVC shared builds work as we want them to so far (mostly). 2016-06-03 17:30:00 -04:00
unix Re-added the Unix stuff. 2016-06-03 21:14:55 -04:00
windows Fixed uiSpinbox events not working on Windows. NOW let's alpha 3.1. 2016-06-05 17:12:10 -04:00
.travis.yml string(APPEND) is too recent for travis's cmake (or 2.8.11, for that matter). 2016-06-05 13:48:51 -04:00
CMakeLists.txt Revert "One last try to fix the OS X builder on Travis." 2016-06-05 16:55:37 -04:00
LICENSE Split into a new repository and added a LICENSE. 2015-04-16 20:31:11 -04:00
README.md Er whoops. 2016-06-05 16:39:31 -04:00
TODO.md Removed TODO for the previous commit. 2016-06-04 00:17:19 -04:00
oldhaiku.tgz Discontinued the Haiku port for now. 2016-04-24 14:18:56 -04:00
ui.h Reworked how _UI_EXTERN works to allow MinGW static linking on Windows. 2016-06-03 22:19:33 -04:00
ui_darwin.h More TODOs. 2016-05-26 21:27:13 -04:00
ui_unix.h Removed uiControlVerifyDestroy(); we could have just had it in uiFreeControl(). 2016-05-22 01:07:25 -04:00
ui_windows.h Removed uiControlVerifyDestroy(); we could have just had it in uiFreeControl(). 2016-05-22 01:07:25 -04:00

README.md

libui: a portable GUI library for C

This README is being written.
Build Status

Announcements

  • 5 June 2016

    • The build system is now cmake. cmake 2.8.11 or higher is needed.
    • Static linking is now possible.
    • MinGW linking is back, but static only.
  • 29 May 2016

    • Alpha 3 is here! Get it here.
    • The next packaged release will introduce:
      • uiGrid, another way to lay out controls, a la GtkGrid
      • uiOpenGLArea, a way to render OpenGL content in a libui uiArea
      • uiTable, a data grid control that may or may not have tree facilities (if it does, it will be called uiTree instead)
      • a complete, possibly rewritten, drawing and text rendering infrastructure
  • 24 May 2016

  • 22 May 2016

    • Two more open questions I'd like your feedback on are available here and here.
    • Sometime in the next 48 hours (before 23:59 EDT on 24 May 2016) I will split uiCombobox into two separate controls, uiCombobox and uiEditableCombobox, each with slightly different events and "selected item" mechanics. Prepare your existing code.
  • 21 May 2016

    • I will now post announcements and updates here.
    • Now that Ubuntu 16.04 LTS is here, no earlier than next Saturday, 28 May 2016 at noon EDT, I will bump the minimum GTK+ version from 3.4 to 3.10. This will add a lot of new features that I can now add to libui, such as search-oriented uiEntries, lists of arbitrary control layouts, and more. If you are still running a Linux distribution that doesn't come with 3.10, you will either need to upgrade or use jhbuild to set up a newer version of GTK+ in a private environment.
    • You can decide if I should also drop OS X 10.7 here.

Updates

Note that today's entry may be updated later today.

  • 29 May 2016

    • Thanks to @pcwalton, we can now statically link libui! Simply do make STATIC=1 instead of just make.
      • On Windows you must link both libui.lib and libui.res AND provide a Common Controls 6 manifest for output static binaries to work properly.
  • 28 May 2016

    • As promised, the minimum system requirements are now OS X 10.8 and GTK+ 3.10 for OS X and Unix, respectively.
  • 26 May 2016

    • Two OS X-specific functions have been added: uiDarwinMarginAmount() and uiDarwinPaddingAmount(). These return the amount of margins and padding, respectively, to give to a control, and are intended for container implementations. These are suitable for the constant of a NSLayoutConstraint. They both take a pointer parameter that is reserved for future use and should be NULL.
  • 25 May 2016

    • uiDrawTextLayout attributes are now specified in units of graphemes on all platforms. This means characters as seen from a user's perspective, not Unicode codepoints or UTF-8 bytes. So a long string of combining marker codepoints after one codepoint would still count as one grapheme.
  • 24 May 2016

    • As promised, uiCombobox is now split into uiCombobox for non-editable comboboxes and uiEditableCombobox for editable comboboxes. Mind the function changes as well :)
    • There is a new function uiMainStep(), which runs one iteration of the main loop. It takes a single boolean argument, indicating whether to wait for an event to occur or not. It returns true if an event was processed (or if no event is available if you don't want to wait) and false if the event loop was told to stop (for instance, uiQuit() was called).
  • 23 May 2016

    • Fixed surrogate pair drawing on OS X.
  • 22 May 2016

    • Removed uiControlVerifyDestroy(); that is now part of uiFreeControl() itself.
    • Added uiPi, a constant for π. This is provided for C and C++ programmers, where there is no standard named constant for π; bindings authors shouldn't need to worry about this.
    • Fixed uiMultilineEntry not properly having line breaks on Windows.
    • Added uiNewNonWrappingMultilineEntry(), which creates a uiMultilineEntry that scrolls horizontally instead of wrapping lines. (This is not documented as being changeable after the fact on Windows, hence it's a creation-time choice.)
    • uiAreas on Windows and some internal Direct2D areas now respond to WM_PRINTCLIENT properly, which should hopefully increase the quality of screenshots.
    • uiDateTimePicker on GTK+ works properly on RTL layouts and no longer disappears off the bottom of the screen if not enough room is available. It will also no longer be marked for localization of the time format (what the separator should be and whether to use 24-hour time), as that information is not provided by the locale system. :(
    • Added uiUserBugCannotSetParentOnToplevel(), which should be used by implementations of toplevel controls in their SetParent() implementations. This will also be the beginning of consolidating common user bug messages into a single place, though this will be one of the only few exported user bug functions.
    • uiSpinbox and uiSlider now merely swap their min and max if min ≥ max. They will no longer panic and do nothing, respectively.
    • Matrix scaling will no longer leave the matrix in an invalid state on OS X and GTK+.
    • uiMultilineEntrySetText() and uiMutlilineEntryAppend() on GTK+ no longer fire OnChanged() events.

Runtime Requirements

  • Windows: Windows Vista SP2 with Platform Update or newer
  • Unix: GTK+ 3.10 or newer
  • Mac OS X: OS X 10.8 or newer

Build Requirements

  • All platforms:
    • CMake 2.8.11 or newer
  • Windows: either
    • Microsoft Visual Studio 2013 or newer (2013 is needed for va_copy()) — you can build either a static or a shared library
    • MinGW-w64 (other flavors of MinGW may not work) — you can only build a static library; shared library support will be re-added once the following features come in:
      • Isolation awareness, which is how you get themed controls from a DLL without needing a manifest
  • Unix: nothing else specific
  • Mac OS X: nothing else specific, so long as you can build Cocoa programs

Building

Out-of-tree builds typical of cmake are preferred:

$ mkdir build
$ cd build
$ cmake ..

Pass -DBUILD_SHARED_LIBS=OFF to cmake to build a static library. The standard cmake build configurations are provided; if none is specified, Debug is used.

If you use a makefile generator with cmake, then

$ make
$ make tester         # for the test program
$ make examples       # for examples

and pass VERBOSE=1 to see build commands. Build targets will be in the build/out folder.

Project file generators should work, but are untested by me.

On Windows, I use the Unix Makefiles generator and GNU make (built using the build_w32.bat script included in the source and run in the Visual Studio command line). In this state, if MinGW-w64 (either 32-bit or 64-bit) is not in your %PATH%, cmake will use MSVC by default; otherwise, cmake will use with whatever MinGW-w64 is in your path. set PATH=%PATH%;c:\msys2\mingw(32/64)\bin should be enough to temporarily change to a MinGW-w64 build for the current command line session only if you installed MinGW-w64 through MSYS2; no need to change global environment variables constantly.

Documentation

Needs to be written. Consult ui.h and the examples for details for now.

Language Bindings

libui was originally written as part of my package ui for Go. Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.

Other people have made bindings to other languages:

Language Bindings
C#/.net LibUI.Binding, SharpUI
Crystal libui.cr
D DerelictLibui
Haskell libui-haskell
JavaScript libui.js (merged into libui-node?)
Julia Libui.jl
Lua libuilua, libui-lua
Node.js libui-node
Python pylibui
Ruby libui-ruby
Rust libui-rs

Screenshots

From examples/controlgallery:

Windows

Unix

OS X