#lang scribble/manual
@(require 
	scribble/eval
	(for-label scheme))

@title{GUIML}

This is a DSL for describing GUIs. It is inspired by SXML notation and the
HTMLPrag library. "GUIML" allows a window and all its initial contents to
be specified in a single expression. Since I've used it for all my GUI
code since I wrote it, I figured it would be useful. Here is a simple GUI:

@racketblock[
(define g (guiml (frame% (|@| (label "Foobar")
                            (width 640)
                            (height 150))
                         (vertical-panel% (|@|)
                             (message% (|@| (label "Hello, world!")))
                             (editor-canvas% 'ec (|@|))
                             (button% (|@| (label "Close")
                                         (style '(border))
                                         (callback (lambda ignored-args
                                                     (sendmsg g show #f)))))))))
]

 "g" is not an object, but an S-expression tree of structures that
 contain the widgets and their optional symbolic identifier.
 A special version of the "send" syntax is provided, which abstracts
 over this extra structure, and sends a message to the topmost widget in
 the hierarchy. All you have to remember is to type "sendmsg" instead of
 "send", and the widget hierarchy will have the same OO interface as its
 topmost widget object:

@racketblock[
(sendmsg g show #t)
]


If you use the optional symbolic identifier, it is possible to address
widgets that reside deep down in the hierarchy, using the
"get-widget-by-id" function:

@racketblock[
;; Get the editor-canvas% named 'ec and give it an editor:
(sendmsg (get-widget-by-id g 'ec) set-editor (new text%))
]
