From 5c52732c0aafe1c3db5716cead09207863fc0aab Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Fri, 15 Jan 2010 17:06:50 -0800 Subject: [PATCH] document MAIN-WINDOW: --- basis/ui/ui-docs.factor | 16 +++++++++++++++- basis/ui/ui.factor | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index 51ff4c2609..9421fdf2d7 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -2,7 +2,7 @@ USING: help.markup help.syntax strings quotations debugger namespaces ui.backend ui.gadgets ui.gadgets.worlds ui.gadgets.tracks ui.gadgets.packs ui.gadgets.grids ui.gadgets.private math.rectangles colors ui.text fonts -kernel ui.private classes sequences ; +kernel ui.private vocabs.loader classes sequences ; IN: ui HELP: windows @@ -325,6 +325,20 @@ HELP: normal-title-bar HELP: textured-background { $description "Asks for a window to have a background that blends seamlessly with the window frame. Factor will leave the window background transparent and pass mouse button gestures not handled directly by a gadget through to the window system so that the window can be dragged from anywhere on its background." } ; +HELP: MAIN-WINDOW: +{ $syntax "MAIN-WINDOW: window-word { attributes } + attribute-code ;" } +{ $description "Defines a " { $link POSTPONE: MAIN: } " word for the current vocabulary named " { $snippet "window-word" } " that opens a UI window when the vocabulary is " { $link run } ". The " { $snippet "attributes" } " specify the key-value pairs of the window's " { $link world-attributes } ". The " { $snippet "attribute-code" } " is run with the " { $snippet "world-attributes" } " on the stack; this allows the word to construct gadget objects to place in the " { $snippet "gadget" } " slot or set other runtime-dependent world attributes." } +{ $examples +"From the " { $vocab-link "hello-ui" } " vocabulary. Creates a window with the title \"Hi\" containing a label reading \"Hello world\":" +{ $code +"""USING: accessors ui ui.gadgets.labels ; +IN: hello-ui + +MAIN-WINDOW: hello { { title "Hi" } } + "Hello world"