image buttons built in

db4
Sam Anklesaria 2009-06-21 21:08:50 -05:00
parent b8633e5e12
commit 2a26670099
2 changed files with 9 additions and 6 deletions

View 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 ) [
[

View 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?>>