libui

  1. libui
    1. Introduction
    2. Author
    3. Repository
    4. Current state of the bindings
    5. Requirements
    6. API
      1. Setup and teardown
        1. init!
        2. main
        3. uninit!
        4. quit!
      2. Widget helpers
        1. handler-set!
        2. margined?
        3. padded?
      3. Widgets
        1. Window widget
          1. new-window
          2. window-child-set!
          3. window-margined?-set!
        2. Button widget
          1. new-button
          2. button-text / button-text-set!
        3. Box widget
          1. new-horizontal-box
          2. new-vertical-box
          3. box-append!
          4. box-padded?-set!
        4. Checkbox widget
          1. new-checkbox
        5. Entry widget
          1. new-entry
          2. new-password-entry
          3. new-search-entry
          4. entry-text / entry-text-set!
          5. entry-read-only?-set!
        6. Label widget
          1. new-label
        7. Tab widget
          1. new-tab
          2. tab-append!
          3. tab-pages-length
          4. tab-margined?-set!
        8. Group widget
          1. new-group
          2. group-child-set!
          3. group-margined?-set!
        9. Spinbox widget
          1. new-spinbox
          2. spinbox-value / spinbox-value-set!
        10. Slider widget
          1. new-slider
          2. slider-value / slider-value-set!
        11. Progress bar widget
          1. new-progress-bar
          2. progress-bar-value / progress-bar-value-set!
        12. Separator widget
          1. new-horizontal-separator
          2. new-vertical-separator
        13. Combobox widget
          1. new-combobox
          2. combobox-append!
        14. Editable combobox widget
          1. new-editable-combobox
          2. editable-combobox-append!
        15. Radio buttons widget
          1. new-radio-buttons
          2. radio-buttons-append!
        16. Date/time widgets
          1. new-date-time-picker
          2. new-date-picker
          3. new-time-picker
        17. Multiline entry widget
          1. new-multiline-entry
          2. new-non-wrapping-multiline-entry
          3. multiline-entry-append!
          4. multiline-entry-read-only?-set!
        18. Area widget
          1. new-area
          2. area-queue-redraw-all!
          3. new-area-handler
          4. mouse-event-x
          5. mouse-event-y
          6. mouse-event-area-width
          7. mouse-event-area-height
          8. draw-params-context
          9. draw-params-area-width
          10. draw-params-area-height
        19. Font button widget
          1. new-font-button
        20. Color button widget
          1. new-color-button
          2. color-button-color / color-button-color-set!
        21. Form widget
          1. new-form
          2. form-append!
          3. form-padded?-set!
        22. Grid widget
          1. new-grid
          2. grid-append!
          3. grid-padded?-set!
      4. Controls
        1. ->control
        2. control-destroy!
        3. control-show!
      5. Dialogs
        1. open-file
        2. save-file
        3. message-box
        4. message-box-error
      6. SXML interface
        1. widgets
        2. widget-by-id
      7. Drawing procedures
        1. Brushes
          1. new-solid-brush
          2. brush-r / brush-r-set!
          3. brush-g / brush-g-set!
          4. brush-b / brush-b-set!
          5. brush-a / brush-a-set!
        2. Stroke parameters
          1. new-stroke-params
        3. Matrices
          1. new-matrix
          2. matrix-identity-set!
          3. matrix-translate!
          4. transform!
        4. Paths
          1. new-path
          2. path-free!
          3. path-new-figure!
          4. path-new-figure-with-arc!
          5. path-line-to!
          6. path-close-figure!
          7. path-add-rectangle!
          8. path-end!
          9. stroke!
          10. fill!
    7. Examples
    8. License
    9. Version history
      1. 0.5
      2. 0.4
      3. 0.3
      4. 0.2
      5. 0.1

Introduction

This egg provides an incomplete set of low-level bindings and a high-level SXML interface to the libui GUI library.

Author

Vasilij Schneidermann

Repository

https://github.com/wasamasa/libui

Current state of the bindings

Requirements

To compile the egg successfully, you'll need to have libui installed. The egg itself requires matchable.

API

Setup and teardown

init!
[procedure] (init!)

Initializes the library. This must be used before creating widgets.

main
[procedure] (main)

Enters the main event loop. Note that all widgets must have been set up and displayed before this point, otherwise they will not appear.

uninit!
[procedure] (uninit!)

Frees all GUI resources.

quit!
[procedure] (quit!)

Terminates the main event loop.

Widget helpers

handler-set!
[procedure] (handler-set! WIDGET TYPE PROC [ARGS ...])

Sets PROC as handler for WIDGET and the event TYPE. If ARGS is specified, the given arguments will be passed to PROC when firing the handler. The following table describes the valid widget-type combinations and corresponding handlers:

Procedure signature Handler signature Description
(handler-set! #f 'should-quit PROC [ARGS ...]) (should-quit [ARGS ...]) Fired on quit by menu item. Return #t to allow quit, otherwise #f
(handler-set WINDOW 'closing PROC [ARGS ...]) (window-closing WINDOW [ARGS ...]) Fired on window close. Return #t to allow window closing, otherwise #f
(handler-set BUTTON 'clicked PROC [ARGS ...]) (button-clicked BUTTON [ARGS ...]) Fired on button click
(handler-set SPINBOX 'changed PROC [ARGS ...]) (spinbox-changed SPINBOX [ARGS ...]) Fired on spinbox value changes
(handler-set SLIDER 'changed PROC [ARGS ...]) (slider-changed SLIDER [ARGS ...]) Fired on slider value changes
(handler-set COLOR-BUTTON 'changed PROC [ARGS ...]) (color-button-changed COLOR-BUTTON [ARGS ...]) Fired on color button value changes
margined?
[parameter] (margined?)
[parameter] (margined? MARGINED?)

Parameter describing whether margins are enabled for widgets by default. Defaults to #f. Affected widgets are windows, tabs and groups. Note that the default can be overridden by either using the widget-specific procedure or specifying a margined? attribute in the SXML interface.

padded?
[parameter] (padded?)
[parameter] (padded? PADDED?)

Parameter describing whether padding is enabled for widgets by default. Defaults to #f. Affected widgets are boxes, forms and grids. Note that the default can be overridden by either using the widget-specific procedure or specifying a padded? attribute in the SXML interface.

Widgets

Window widget
new-window
[procedure] (new-window TITLE WIDTH HEIGHT [MENUBAR?])

Creates and returns a new window widget with TITLE as title and the dimensions WIDTH and HEIGHT. Note that the optional MENUBAR? argument doesn't have any effect yet as menu items cannot be created yet.

window-child-set!
[procedure] (window-child-set! WINDOW CONTROL)

Sets WINDOW to contain CONTROL as its child.

window-margined?-set!
[procedure] (window-margined?-set! WINDOW MARGINED?)

Enables or disables margins for WINDOW, depending on whether MARGINED? is #t or #f.

Button widget
new-button
[procedure] (new-button TEXT)

Creates and returns a new button widget with TEXT as label.

button-text / button-text-set!
[procedure] (button-text BUTTON)
[procedure] (button-text-set! BUTTON TEXT)
[setter] (set! (button-text BUTTON) TEXT)

Retrieves or sets the text of BUTTON.

Box widget
new-horizontal-box
[procedure] (new-horizontal-box)

Creates and returns a new horizontal box widget.

new-vertical-box
[procedure] (new-vertical-box)

Creates and returns a new vertical box widget.

box-append!
[procedure] (box-append! BOX CONTROL [STRETCHY?])

Appends CONTROL to BOX. If STRETCHY? is #t, the appended control will expand as much as possible instead of adhering to its natural size.

box-padded?-set!
[procedure] (box-padded?-set! BOX PADDED?)

Enables or disables padding for BOX, depending on whether PADDED? is #t or #f.

Checkbox widget
new-checkbox
[procedure] (new-checkbox TEXT)

Creates and returns a new checkbox widget with TEXT as label.

Entry widget
new-entry
[procedure] (new-entry)

Creates and returns a new entry widget.

new-password-entry
[procedure] (new-password-entry)

Creates and returns a new password entry widget.

new-search-entry
[procedure] (new-search-entry)

Creates and returns a new search entry widget.

entry-text / entry-text-set!
[procedure] (entry-text ENTRY)
[procedure] (entry-text-set! ENTRY TEXT)
[setter] (set! (entry-text ENTRY) TEXT)

Retrieves or sets the text of ENTRY.

entry-read-only?-set!
[procedure] (entry-read-only?-set! ENTRY READ-ONLY?)

Enables or disables the read-only state of ENTRY, depending on whether READ-ONLY? is #t or #f.

Label widget
new-label
[procedure] (new-label TEXT)

Creates and returns a new label widget with TEXT as label.

Tab widget
new-tab
[procedure] (new-tab)

Creates and returns a new tab widget.

tab-append!
[procedure] (tab-append! TAB TEXT CONTROL)

Appends CONTROL as tab page to TAB with TEXT as label.

tab-pages-length
[procedure] (tab-pages-length TAB)

Returns the number of tab pages for TAB.

tab-margined?-set!
[procedure] (tab-margined?-set! TAB INDEX MARGINED?)

Enables or disables margins for the tab page at INDEX on TAB, depending on whether MARGINED? is #t or #f.

Group widget
new-group
[procedure] (new-group TEXT)

Creates and returns a new group widget with TEXT as label.

group-child-set!
[procedure] (group-child-set! GROUP CONTROL)

Sets GROUP to contain CONTROL as its child.

group-margined?-set!
[procedure] (group-margined?-set! GROUP MARGINED?)

Enables or disables margins for GROUP, depending on whether MARGINED? is #t or #f.

Spinbox widget
new-spinbox
[procedure] (new-spinbox MIN MAX)

Creates and returns a new spinbox widget with MIN and MAX as input boundaries.

spinbox-value / spinbox-value-set!
[procedure] (spinbox-value SPINBOX)
[procedure] (spinbox-value-set! SPINBOX VALUE)
[setter] (set! (spinbox-value SPINBOX) VALUE)

Retrieves or sets the value of SPINBOX.

Slider widget
new-slider
[procedure] (new-slider MIN MAX)

Creates and returns a slider widget with MIN and MAX as input boundaries.

slider-value / slider-value-set!
[procedure] (slider-value SLIDER)
[procedure] (slider-value-set! SLIDER VALUE)
[setter] (set! (slider-value SLIDER) VALUE)

Retrieves or sets the value of SLIDER.

Progress bar widget
new-progress-bar
[procedure] (new-progress-bar)

Creates and returns a new progress bar widget. The input boundaries are 0 and 100. Note that the value -1 is interpreted specially and will result in a pulsating progress bar.

progress-bar-value / progress-bar-value-set!
[procedure] (progress-bar-value PROGRESS-BAR)
[procedure] (progress-bar-value-set! PROGRESS-BAR VALUE)
[setter] (set! (progress-bar-value PROGRESS-BAR) VALUE)

Retrieves or sets the value of PROGRESS-BAR.

Separator widget
new-horizontal-separator
[procedure] (new-horizontal-separator)

Creates and returns a new horizontal separator widget.

new-vertical-separator
[procedure] (new-vertical-separator)

Creates and returns a new vertical separator widget.

Combobox widget
new-combobox
[procedure] (new-combobox)

Creates and returns a new combobox widget.

combobox-append!
[procedure] (combobox-append! COMBOBOX TEXT)

Appends a combobox item containing TEXT to COMBOBOX.

Editable combobox widget
new-editable-combobox
[procedure] (new-editable-combobox)

Creates and returns a new editable combobox widget.

editable-combobox-append!
[procedure] (editable-combobox-append! EDITABLE-COMBOBOX TEXT)

Appends an editable combobox item containing TEXT to EDITABLE-COMBOBOX.

Radio buttons widget
new-radio-buttons
[procedure] (new-radio-buttons)

Creates and returns a new radio buttons widget.

radio-buttons-append!
[procedure] (radio-buttons-append! RADIO-BUTTONS TEXT)

Appends an radio button item containing TEXT to RADIO-BUTTONS.

Date/time widgets
new-date-time-picker
[procedure] (new-date-time-picker)

Creates and returns a new date time picker widget.

new-date-picker
[procedure] (new-date-picker)

Creates and returns a new date picker widget.

new-time-picker
[procedure] (new-time-picker)

Creates and returns a new time picker widget.

Multiline entry widget
new-multiline-entry
[procedure] (new-multiline-entry)

Creates and returns a new multiline entry widget.

new-non-wrapping-multiline-entry
[procedure] (new-non-wrapping-multiline-entry)

Creates and returns a new non-wrapping multiline entry widget.

multiline-entry-append!
[procedure] (multiline-entry-append! MULTILINE-ENTRY TEXT)

Appends TEXT to the contents of MULTILINE-ENTRY.

multiline-entry-read-only?-set!
[procedure] (multiline-entry-read-only?-set! MULTILINE-ENTRY READ-ONLY?)

Enables or disables the read-only state of MULTILINE-ENTRY, depending on whether READ-ONLY? is #t or #f.

Area widget
new-area
[procedure] (new-area AREA-HANDLER)

Creates and returns a new area widget. AREA-HANDLER is a record as returned by new-area-handler.

area-queue-redraw-all!
[procedure] (area-queue-redraw-all! AREA)

Triggers the AREA widget to redraw itself with its drawing handler as soon as possible.

new-area-handler
[procedure] (new-area-handler DRAW-HANDLER MOUSE-EVENT-HANDLER MOUSE-CROSSED-HANDLER DRAG-BROKEN-HANDLER KEY-EVENT-HANDLER)

Creates a handler suitable for creating an area widget. The arguments to this procedure are procedures with the following signatures:

(draw-handler AREA-HANDLER AREA DRAW-PARAMS)
Run when the area widget is redrawn. DRAW-PARAMS contains the current drawing parameters.
(mouse-event-handler AREA-HANDLER AREA MOUSE-EVENT)
Run on mouse events with MOUSE-EVENT as argument.
(mouse-crossed-handler AREA-HANDLER AREA LEFT?)
Run when the mouse enters or leaves the area widget. LEFT? is #t if the mouse left it, otherwise #f.
(drag-broken-handler AREA-HANDLER AREA)
Run when dragging has been cancelled by the system.
(key-event-handler AREA-HANDLER AREA KEY-EVENT)
Run on key events with KEY-EVENT as argument.
mouse-event-x
[procedure] (mouse-event-x MOUSE-EVENT)

Retrieves the x component of MOUSE-EVENT as emitted by a mouse event handler.

mouse-event-y
[procedure] (mouse-event-y MOUSE-EVENT)

Retrieves the y component of MOUSE-EVENT as emitted by a mouse event handler.

mouse-event-area-width
[procedure] (mouse-event-area-width MOUSE-EVENT)

Retrieves the area width of MOUSE-EVENT as emitted by a mouse event handler.

mouse-event-area-height
[procedure] (mouse-event-area-height MOUSE-EVENT)

Retrieves the area height of MOUSE-EVENT as emitted by a mouse event handler.

draw-params-context
[procedure] (draw-params-context DRAW-PARAMS)

Retrieves the context of DRAW-PARAMS as emitted by a draw handler.

draw-params-area-width
[procedure] (draw-params-area-width DRAW-PARAMS)

Retrieves the area width of DRAW-PARAMS as emitted by a draw handler.

draw-params-area-height
[procedure] (draw-params-area-height DRAW-PARAMS)

Retrieves the area height of DRAW-PARAMS as emitted by a draw handler.

Font button widget
new-font-button
[procedure] (new-font-button)

Creates and returns a new font button widget.

Color button widget
new-color-button
[procedure] (new-color-button)

Creates and returns a new color button widget.

color-button-color / color-button-color-set!
[procedure] (color-button-color COLOR-BUTTON)
[procedure] (color-button-color-set! COLOR-BUTTON R G B A)
[setter] (set! (color-button-color COLOR-BUTTON) R G B A)

Retrieves or sets the color of COLOR-BUTTON. Its value is a list of the red, green, blue and alpha components as flonums between 0 and 1.

Form widget
new-form
[procedure] (new-form)

Creates and returns a new form widget.

form-append!
[procedure] (form-append! FORM TEXT CONTROL [STRETCHY?])

Appends CONTROL to FORM with TEXT as label. If STRETCHY? is #t, the appended control will expand as much as possible instead of adhering to its natural size.

form-padded?-set!
[procedure] (form-padded?-set! FORM PADDED?)

Enables or disables padding for FORM, depending on whether PADDED? is #t or #f.

Grid widget
new-grid
[procedure] (new-grid)

Creates and returns a new grid widget.

grid-append!
[procedure] (grid-append! GRID CONTROL LEFT TOP [XSPAN YSPAN HEXPAND HALIGN VEXPAND VALIGN])

Appends CONTROL to GRID. LEFT and TOP are integer positions in the grid with 0 and 0 referring to the upper left corner. XSPAN and YSPAN control over how many cells the appended control will span and default to 1. If HEXPAND or HALIGN is #t, the control will expand to the entire cell size instead of its natural size. HALIGN and VALIGN control the alignment and must be one of (fill start center end), with fill being the default. See the GTK3 documentation for further details.

grid-padded?-set!
[procedure] (grid-padded?-set! GRID PADDED?)

Enables or disables padding for GRID, depending on whether PADDED? is #t or #f.

Controls

->control
[procedure] (->control WIDGET)

Casts WIDGET to a control record. Used in procedures accepting controls.

control-destroy!
[procedure] (control-destroy! CONTROL)

Destroys CONTROL and frees its resources.

control-show!
[procedure] (control-show! CONTROL)

Displays CONTROL.

Dialogs

open-file
[procedure] (open-file PARENT)

Opens an "Open File" dialog. PARENT is the widget the dialog belongs to, typically the main window.

save-file
[procedure] (save-file PARENT)

Opens an "Save File" dialog. PARENT is the widget the dialog belongs to, typically the main window.

message-box
[procedure] (message-box PARENT TITLE DESCRIPTION)

Opens a message box dialog with TITLE and DESCRIPTION as labels. PARENT is the widget the dialog belongs to, typically the main window.

message-box-error
[procedure] (message-box-error PARENT TITLE DESCRIPTION)

Opens a message box error dialog with TITLE and DESCRIPTION as labels. PARENT is the widget the dialog belongs to, typically the main window.

SXML interface

widgets
[procedure] (widgets SXML)

Creates widgets as specified by SXML. Returns the created root widget of SXML. The tag name is equal to the widget type, the attributes are mapped to widget-specific procedure calls mutating these and the children are added to the widget if possible. Refer to the individual widget creation and setter procedures to know which attributes are mandatory and which are optional.

The following definition list describes the allowed attributes of all widgets not accepting children:

button
(text)
font-button
None
color-button
(color)
checkbox
(text)
entry, password-entry, search-entry
(text read-only?)
multiline-entry, non-wrapping-multiline-entry
(read-only?)
label
(text)
spinbox, slider
(min max value)
progress-bar
(value)
horizontal-separator, vertical-separator
None
date-picker, time-picker, date-time-picker
None

The remaining widgets can contain a child or children.

window
(title width height menubar? margined?)
window child
None
combobox, editable-combobox, radio-buttons
None
combobox, editable-combobox, radio-buttons children
Must be strings
hbox, vbox
(padded?)
hbox, vbox children
(stretchy?)
tab
None
tab children
(text margined?)
group
(text margined?)
group child
None
form
(padded?)
form children
(text stretchy?)
grid
(padded?)
grid children
(left top xspan yspan hexpand halign vexpand valign)

Additionally to that, one can use handler symbols as described in the documentation of handler-set! and a procedure to add a handler and the special id attribute on any widget to look it up with the widget-by-id procedure.

widget-by-id
[procedure] (widget-by-id ID)

Returns a widget that has been previously defined with the widgets procedure and an id attribute equal to ID or #f if it couldn't be found.

Drawing procedures

These are part of the separately loadable libui-draw module.

Brushes
new-solid-brush
[procedure] (new-solid-brush R G B A)

Creates a new solid brush from the color components R, G, B and A. Each component must be a flonum between 0 and 1.

brush-r / brush-r-set!
[procedure] (brush-r BRUSH)
[procedure] (brush-r-set! BRUSH R)
[setter] (set! (brush-r BRUSH) R)

Retrieves or sets the red component of BRUSH.

brush-g / brush-g-set!
[procedure] (brush-g BRUSH)
[procedure] (brush-g-set! BRUSH G)
[setter] (set! (brush-g BRUSH) G)

Retrieves or sets the green component of BRUSH.

brush-b / brush-b-set!
[procedure] (brush-b BRUSH)
[procedure] (brush-b-set! BRUSH B)
[setter] (set! (brush-b BRUSH) B)

Retrieves or sets the blue component of BRUSH.

brush-a / brush-a-set!
[procedure] (brush-a BRUSH)
[procedure] (brush-a-set! BRUSH A)
[setter] (set! (brush-a BRUSH) A)

Retrieves or sets the alpha component of BRUSH.

Stroke parameters
new-stroke-params
[procedure] (new-stroke-params #!key (cap: 'flat) (join: 'miter) (thickness: 2) (miter-limit: 10) (dashes: '()) (offset: 0))

Creates new stroke parameters for use with stroke!. cap describes the shape of line ends and must be one of (flat round square), join the join style used between path segments and must be one of (miter round bevel). thickness is the line thickness, miter-limit a treshold for deciding whether to use bevel or miter joins for the miter join type. See the Cairo documentation for further information. Note that dashes are currently unimplemented, therefore the dashes and offset keywords have no effect.

Matrices
new-matrix
[procedure] (new-matrix)

Creates and returns a new matrix.

matrix-identity-set!
[procedure] (matrix-identity-set! MATRIX)

Sets MATRIX to the identity matrix.

matrix-translate!
[procedure] (matrix-translate! MATRIX X Y)

Translates MATRIX by X and Y.

transform!
[procedure] (transform! CONTEXT MATRIX)

Applies MATRIX to CONTEXT. In other words, after this operation all drawing operations on CONTEXT will be transformed as specified by MATRIX.

Paths
new-path
[procedure] (new-path [ALTERNATE?])

Creates and returns a new path. If ALTERNATE? is #t, filling depends on the number of path intersections, otherwise on the path's winding.

path-free!
[procedure] (path-free! PATH)

Release the resources associated with PATH. This doesn't need to be called after having dealt with PATH as it is run by a finalizer, but can help reducing GC pressure.

path-new-figure!
[procedure] (path-new-figure! PATH X Y)

Starts a new figure to draw at X and Y for PATH.

path-new-figure-with-arc!
[procedure] (path-new-figure-with-arc! PATH XCENTER YCENTER RADIUS START-ANGLE SWEEP [NEGATIVE?])

Starts a new figure that starts with an arc segment at XCENTER and YCENTER with RADIUS for PATH. START-ANGLE and SWEEP describe what angle to start from and the angular length of the arc in radians. If NEGATIVE? is #t, the arc will be drawn counter-clockwise, otherwise clockwise. Note that this is commonly used to draw circles.

path-line-to!
[procedure] (path-line-to! PATH X Y)

Adds a line to the current figure of PATH ending at X and Y.

path-close-figure!
[procedure] (path-close-figure! PATH)

Closes the current figure of PATH.

path-add-rectangle!
[procedure] (path-add-rectangle! PATH X Y WIDTH HEIGHT)

Creates a new rectangle figure on PATH at X and Y with the dimensions WIDTH and HEIGHT.

path-end!
[procedure] (path-end! PATH)

Ends PATH and inhibits adding any further figures or changes to them.

stroke!
[procedure] (stroke! CONTEXT PATH BRUSH STROKE-PARAMS)

Strokes PATH on CONTEXT with BRUSH and STROKE-PARAMS.

fill!
[procedure] (fill! CONTEXT PATH BRUSH)

Fills PATH on CONTEXT with BRUSH.

Examples

Basic "Hello World!" example.

(use (prefix libui ui:))

(ui:margined? #t)
(ui:padded? #t)

(ui:init!)

(define window (ui:new-window "Hello World" 180 60 #t))
(ui:handler-set! window 'closing (lambda (_window) (ui:quit!)))

(define (greet _button)
  (ui:message-box window "Greeting" "Hello World!"))

(define greet-button (ui:new-button "Click Me!"))
(ui:handler-set! greet-button 'clicked greet)

(define quit-button (ui:new-button "Quit"))
(ui:handler-set! quit-button 'clicked (lambda (_button) (ui:quit!)))

(define hbox (ui:new-horizontal-box))
(ui:box-append! hbox (ui:->control greet-button) #t)
(ui:box-append! hbox (ui:->control quit-button) #t)

(ui:window-child-set! window (ui:->control hbox))
(ui:control-show! (ui:->control window))
(ui:main)

Same example, but with the SXML interface:

(use (prefix libui ui:))

(ui:margined? #t)
(ui:padded? #t)

(ui:init!)

(define window #f)

(define (greet _button)
  (ui:message-box window "Greeting" "Hello World!"))

(ui:widgets
 `(window
   (@ (id main)
      (title "Hello World")
      (width 180)
      (height 60)
      (menubar? #t)
      (closing ,(lambda (_window) (ui:quit!))))
   (hbox
    (button
     (@ (stretchy? #t)
        (text "Click Me!")
        (clicked ,greet)))
    (button
     (@ (stretchy? #t)
        (text "Quit")
        (clicked ,(lambda (_button) (ui:quit!))))))))

(set! window (ui:widget-by-id 'main))
(ui:control-show! (ui:->control window))
(ui:main)

Further examples can be found in the repository.

License

Copyright (c) 2016, Vasilij Schneidermann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version history

0.5

0.4

0.3

0.2

0.1