]> gitweb.factorcode.org Git - factor.git/commitdiff
image buttons built in
authorSam Anklesaria <sam@Tintin.local>
Mon, 22 Jun 2009 02:08:50 +0000 (21:08 -0500)
committerSam Anklesaria <sam@Tintin.local>
Mon, 22 Jun 2009 02:08:50 +0000 (21:08 -0500)
extra/recipes/recipes.factor
extra/ui/frp/gadgets/gadgets.factor

index 125f187e7f6406cac22db00c5bf7f1b858491a70..89c0eab393e4e19b53db38a7ccdc8585e238cc48 100644 (file)
@@ -11,7 +11,6 @@ STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } {
 : top-recipes ( offset search -- recipes ) <query> T{ recipe } rot >>title >>tuple
     "votes" >>order 30 >>limit swap >>offset get-tuples ;
 : top-genres ( -- genres ) f f top-recipes [ genre>> ] map prune 4 (head-slice) ;
-: <image-button> ( str -- button ) "vocab:recipes/icons/" ".tiff" surround <image-name> <frp-button> ;
 
 : interface ( -- book ) [ 
      [
index 15b1aa4c30917c7979ddf9ce62c3333e6d3c8cff..b8651701935fe18ac17fc27a314c2e0bfa8adfc3 100644 (file)
@@ -1,9 +1,9 @@
-USING: accessors arrays kernel models monads ui.frp.signals ui.gadgets
-ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.editors
-ui.gadgets.tables sequences splitting ui.gadgets.labels
-ui.gadgets.scrollers ui.gadgets.borders ;
+USING: accessors arrays kernel models monads
+sequences ui.frp.signals ui.gadgets ui.gadgets.borders
+ui.gadgets.buttons ui.gadgets.buttons.private
+ui.gadgets.editors ui.gadgets.labels ui.gadgets.scrollers
+ui.gadgets.tables ui.images vocabs.parser ;
 IN: ui.frp.gadgets
-
 TUPLE: frp-button < button hook value ;
 : <frp-button> ( gadget -- button ) [
       [ dup hook>> [ call( button -- ) ] [ drop ] if* ]
@@ -54,6 +54,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 ;
 
+: image-button ( filename path -- button ) ".tiff" surround <image-name> <frp-button> ;
+SYNTAX: <image-button> current-vocab name>> "vocab:" "/icons/" surround
+    [ image-button ] curry over push-all ;
+
 GENERIC: output-model ( gadget -- model )
 M: gadget output-model model>> ;
 M: table output-model dup multiple-selection?>>