From 93641c534db34db0db05bc19f12fd59b598ab2f8 Mon Sep 17 00:00:00 2001 From: Sam Anklesaria Date: Thu, 25 Jun 2009 23:23:09 -0500 Subject: [PATCH] frp documentation updated --- extra/ui/frp/gadgets/gadgets-docs.factor | 42 ++++++++++++++++++++++-- extra/ui/frp/gadgets/gadgets.factor | 4 +-- extra/ui/frp/layout/layout-docs.factor | 27 +++++++++++++-- extra/ui/frp/signals/signals-docs.factor | 22 ++++++++++++- 4 files changed, 86 insertions(+), 9 deletions(-) diff --git a/extra/ui/frp/gadgets/gadgets-docs.factor b/extra/ui/frp/gadgets/gadgets-docs.factor index 208e87f4a3..b3440aefb3 100644 --- a/extra/ui/frp/gadgets/gadgets-docs.factor +++ b/extra/ui/frp/gadgets/gadgets-docs.factor @@ -1,11 +1,15 @@ -USING: help.markup help.syntax ui.gadgets.buttons -ui.gadgets.editors ui.frp.gadgets ; +USING: accessors help.markup help.syntax ui.gadgets.buttons +ui.gadgets.editors ui.frp.gadgets models ui.gadgets ; IN: ui.frp.gadgets HELP: { $values { "gadget" "the button's label" } { "button" button } } { $description "Creates an button whose signal updates on clicks. " } ; +HELP: +{ $values { "text" "the button's label" } { "button" button } } +{ $description "Creates an button whose signal updates on clicks. " } ; + HELP: { $values { "model" "values the table is to display" } { "table" frp-table } } { $description "Creates an " { $link frp-table } } ; @@ -27,5 +31,37 @@ HELP: indexed { $description "Sets the output model of an frp-table to the selected-index, rather than the selected-value" } ; HELP: +{ $values { "model" model } { "gadget" model-field } } +{ $description "Creates a field with an initial value" } ; + +HELP: { $values { "field" model-field } } -{ $description "Creates a field with an empty initial value" } ; \ No newline at end of file +{ $description "Creates a field with an empty initial value" } ; + +HELP: +{ $values { "model" model } { "field" model-field } } +{ $description "Creates a field with an empty initial value that switches to another signal on its update" } ; + +HELP: +{ $values { "model" model } { "gadget" model-field } } +{ $description "Creates an editor with an initial value" } ; + +HELP: +{ $values { "editor" "an editor" } } +{ $description "Creates a editor with an empty initial value" } ; + +HELP: +{ $values { "model" model } { "editor" "an editor" } } +{ $description "Creates a field with an empty initial value that switches to another signal on its update" } ; + +HELP: +{ $values { "field" action-field } } +{ $description "Field that updates its model with its contents when the user hits the return key" } ; + +HELP: +{ $syntax "filename " } +{ $description "Creates a button using a tiff image named as specified found in the icons subdirectory of the vocabulary path" } ; + +HELP: output-model +{ $values { "gadget" gadget } { "model" model } } +{ $description "Returns the model a gadget uses for output. Often the same as " { $link model>> } } ; \ No newline at end of file diff --git a/extra/ui/frp/gadgets/gadgets.factor b/extra/ui/frp/gadgets/gadgets.factor index 3c9bbda1b3..6355271e96 100644 --- a/extra/ui/frp/gadgets/gadgets.factor +++ b/extra/ui/frp/gadgets/gadgets.factor @@ -43,13 +43,11 @@ M: frp-field model-changed 2dup frp-model>> = : ( -- field ) "" ; : ( model -- field ) "" ; -: ( -- field ) "" ; : ( model -- gadget ) frp-field [ ] dip new-border dup gadget-child >>editor field-theme swap init-field >>frp-model { 1 0 } >>align ; : ( -- editor ) "" ; -: ( -- field ) "" ; -: ( model -- field ) "" ; +: ( model -- editor ) "" ; : ( -- field ) f dup [ set-control-value ] curry >>quot f >>model ; diff --git a/extra/ui/frp/layout/layout-docs.factor b/extra/ui/frp/layout/layout-docs.factor index 3679572669..f91f099588 100644 --- a/extra/ui/frp/layout/layout-docs.factor +++ b/extra/ui/frp/layout/layout-docs.factor @@ -2,7 +2,7 @@ USING: help.markup help.syntax models ui.gadgets.tracks ui.frp.layout ; IN: ui.frp.layout HELP: , -{ $values { "uiitem" "a gadget or model" } } +{ $values { "item" "a gadget or model" } } { $description "Used in a series of gadgets created by a box, accumulating the gadget" } ; HELP: ,% @@ -24,7 +24,30 @@ HELP: { $values { "gadgets" "a list of gadgets" } { "track" track } } { $syntax "[ gadget , gadget , ... ] " } { $description "Creates an horizontal track containing the gadgets listed in the quotation" } ; + HELP: { $values { "gadgets" "a list of gadgets" } { "track" track } } { $syntax "[ gadget , gadget , ... ] " } -{ $description "Creates an vertical track containing the gadgets listed in the quotation" } ; \ No newline at end of file +{ $description "Creates an vertical track containing the gadgets listed in the quotation" } ; + +HELP: $ +{ $syntax "$ PLACEHOLDER-NAME $" } +{ $description "Defines an insertion point in a template named PLACEHOLDER-NAME which can be used by calling its name" } ; + +HELP: with-interface +{ $values { "quot" "quotation that builds a template and inserts into it" } } +{ $description "Create templates, used with " { $link POSTPONE: $ } } ; + +ARTICLE: { "ui.frp.layout" "about" } "GUI Layout" +"Laying out GUIs works the same way as building lists with " { $vocab-link "make" } +". Gadgets are layed out using " { $vocab-link "ui.gadgets.tracks" } " through " { $link } " and " { $link } ", which allow both fixed and percentage widths. " +{ $link , } " and " { $link -> } " add a signal or gadget to the gadget you're building. " +"Also, books can be made with " { $link } ". " +{ $link } "s add flexable space between items. " $nl +"Using " { $link with-interface } ", one can pre-build templates to add items to later: " +"Like in Java's StringTemplate, placeholders are defined using $ PLACERHOLDER-NAME $ " +"Using PLACEHOLDER-NAME again sets it as the current insertion point. " +"For examples using normal layout, see the " { $vocab-link "gui-sudoku" } " demo. " +"For examples of templating, see " { $vocab-link "recipes" } " demo. " ; + +ABOUT: { "ui.frp.layout" "about" } \ No newline at end of file diff --git a/extra/ui/frp/signals/signals-docs.factor b/extra/ui/frp/signals/signals-docs.factor index e2b14234e1..e542424c2a 100644 --- a/extra/ui/frp/signals/signals-docs.factor +++ b/extra/ui/frp/signals/signals-docs.factor @@ -27,4 +27,24 @@ HELP: $> HELP: <$ { $values { "model" model } { "quot" "applied to model's value on updates" } { "signal" model } } -{ $description "Opposite of " { $link <$ } "- gives output, but takes no input" } ; \ No newline at end of file +{ $description "Opposite of " { $link <$ } "- gives output, but takes no input" } ; + +HELP: frp-when +{ $values { "model" model } { "quot" "called on the model if the quot yields true" } { "cond" "a quotation called on the model's value, yielding a boolean value" } } +{ $description "Calls quot when model updates if its value meets the condition set in cond" } ; + +HELP: with-self +{ $values { "quot" "quotation that recieves its own return value" } { "model" model } } +{ $description "Fixed points for signals: the quot reacts to the same signal to gives" } ; + +HELP: #1 +{ $values { "model" model } { "model'" model } } +{ $description "Moves a signal to the top of its dependencies' connections, thus being notified before the others" } ; + +ARTICLE: { "signals" "about" } "FRP Signals" +"Unlike models, which always have a value, signals have discrete start and end times. " +"They are the core of the frp library: program flow using frp is controlled entirely through manipulating and combining signals. " +"The output signals of some gadgets (see " { $vocab-link "ui.frp.gadgets" } " ) can be manipulated and used as the input signals of others. " +"To combine signals see " { $vocab-link "ui.frp.functors" } ; + +ABOUT: { "signals" "about" } \ No newline at end of file