]> gitweb.factorcode.org Git - factor.git/commitdiff
generalized image buttons
authorSam Anklesaria <sam@Tintin.local>
Wed, 22 Jul 2009 14:46:52 +0000 (09:46 -0500)
committerSam Anklesaria <sam@Tintin.local>
Wed, 22 Jul 2009 14:46:52 +0000 (09:46 -0500)
extra/recipes/recipes.factor
extra/ui/frp/gadgets/gadgets-docs.factor
extra/ui/frp/gadgets/gadgets.factor
extra/ui/frp/layout/layout-docs.factor
extra/ui/frp/signals/signals-docs.factor

index 71d2c41524cccab800e819b8e4fe898bc762219a..4ad9397504ecc9dc3c71315d0b154a56d50f5f8e 100644 (file)
@@ -31,11 +31,11 @@ STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } {
     interface
       <frp-table*> :> tbl
       "okay" <frp-border-button> BUTTON -> :> ok
-      IMAGE-BUTTON: submit [ store-tuple ] >>value TOOLBAR -> :> submit
-      IMAGE-BUTTON: love 1 >>value TOOLBAR ->
-      IMAGE-BUTTON: hate -1 >>value -> 2array <merge> :> votes
-      IMAGE-BUTTON: back -> [ -30 ] <$
-      IMAGE-BUTTON: more -> [ 30 ] <$ 2array <merge> :> viewed
+      IMG-FRP-BTN: submit [ store-tuple ] >>value TOOLBAR -> :> submit
+      IMG-FRP-BTN: love 1 >>value TOOLBAR ->
+      IMG-FRP-BTN: hate -1 >>value -> 2array <merge> :> votes
+      IMG-FRP-BTN: back -> [ -30 ] <$
+      IMG-FRP-BTN: more -> [ 30 ] <$ 2array <merge> :> viewed
       <spacer> <frp-field*> ->% 1 :> search
       submit ok [ [ drop ] ] <$ 2array <merge> [ drop ] >>value :> quot
       viewed 0 [ + ] <fold> search ok t <basic> "all" <frp-button> ALL ->
index 0df91947460c26c42e313181339d5b20b34e8e58..ee0c764e605049bf79aeb61cbc015054314fddad 100644 (file)
@@ -58,10 +58,14 @@ HELP: <frp-action-field>
 { $values { "field" action-field } }
 { $description "Field that updates its model with its contents when the user hits the return key" } ;
 
-HELP: IMAGE-BUTTON:
+HELP: IMG-FRP-BTN:
 { $syntax "IMAGE-BUTTON: filename" }
 { $description "Creates a button using a tiff image named as specified found in the icons subdirectory of the vocabulary path" } ;
 
+HELP: IMG-BTN:
+{ $syntax "[ do-something ] IMAGE-BUTTON: filename" }
+{ $description "Creates a button using a tiff image named as specified found in the icons subdirectory of the vocabulary path, calling the specified quotation on click" } ;
+
 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
index a5a16676ef7797d51cf71b8c971c7cc853490923..db693e350c4f091f4fa923bc3d371f5f0ecfc0df 100644 (file)
@@ -52,8 +52,10 @@ M: frp-field model-changed 2dup frp-model>> =
 : <frp-action-field> ( -- field ) f <action-field> dup [ set-control-value ] curry >>quot
     f <model> >>model ;
 
-SYNTAX: IMAGE-BUTTON: scan current-vocab name>> "vocab:" "/icons/" surround ".tiff" surround
-    <image-name> [ <frp-button> ] curry over push-all ;
+: image-prep ( -- image ) scan current-vocab name>> "vocab:" "/icons/" surround ".tiff" surround <image-name> ;
+SYNTAX: IMG-FRP-BTN: image-prep [ <frp-button> ] curry over push-all ;
+
+SYNTAX: IMG-BTN: image-prep [ swap <button> ] curry over push-all ;
 
 GENERIC: output-model ( gadget -- model )
 M: gadget output-model model>> ;
index f91f099588102bfe49b7cf1ec16a5b4bd45a7cef..2f475deb4d530fc49f97df2179be1ac203e29fab 100644 (file)
@@ -38,16 +38,16 @@ 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"
+ARTICLE: "ui.frp.layout" "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 <hbox> } " and " { $link <vbox> } ", 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 <frp-book> } ". "
 { $link <spacer> } "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 $ "
+"Like in the StringTemplate framework for java, 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 using normal layout, see the " { $vocab-link "sudokus" } " demo. "
 "For examples of templating, see " { $vocab-link "recipes" } " demo. " ;
 
-ABOUT: { "ui.frp.layout" "about" }
\ No newline at end of file
+ABOUT: "ui.frp.layout"
\ No newline at end of file
index 1996213ee2bbba45b3b48f1dc839b6388946a089..397c1e2044a9a64f032194dd6c656f37ef99099e 100644 (file)
@@ -41,10 +41,9 @@ 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"
+ARTICLE: "signals" "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" } ;
+"The output signals of some gadgets (see " { $vocab-link "ui.frp.gadgets" } " ) can be manipulated and used as the input signals of others. " ;
 
-ABOUT: { "signals" "about" }
\ No newline at end of file
+ABOUT: "signals"
\ No newline at end of file