1 USING: accessors fry kernel lexer math.parser models sequences
2 ui.frp.signals ui.gadgets ui.gadgets.editors ui.gadgets.scrollers
3 ui.gadgets.tables ui.gadgets.tracks ;
6 TUPLE: layout gadget width ; C: <layout> layout
8 GENERIC: output-model ( gadget -- model )
9 M: gadget output-model model>> ;
10 M: table output-model dup multiple-selection?>>
11 [ dup val-quot>> [ selected-values>> ] [ selected-indices*>> ] if ]
12 [ dup val-quot>> [ selected-value>> ] [ selected-index*>> ] if ] if ;
13 M: model-field output-model field-model>> ;
14 M: scroller output-model viewport>> children>> first output-model ;
16 GENERIC: , ( uiitem -- )
17 M: gadget , f <layout> make:, ;
18 M: model , activate-model ;
20 SYNTAX: ,% scan string>number [ <layout> make:, ] curry over push-all ;
21 SYNTAX: ->% scan string>number '[ [ _ <layout> make:, ] [ output-model ] bi ] over push-all ;
23 GENERIC: -> ( uiitem -- model )
24 M: gadget -> dup , output-model ;
27 : <spacer> ( -- ) <gadget> 1 <layout> make:, ;
28 : <box> ( gadgets type -- track )
29 [ { } make:make ] dip <track> swap [ [ gadget>> ] [ width>> ] bi track-add ] each ; inline
30 : <box*> ( gadgets type -- track ) [ <box> ] [ [ model>> ] map <|> ] bi >>model ; inline
31 : <hbox> ( gadgets -- track ) horizontal <box> ; inline
32 : <hbox*> ( gadgets -- track ) horizontal <box*> ; inline
33 : <vbox> ( gadgets -- track ) vertical <box> ; inline
34 : <vbox*> ( gadgets -- track ) vertical <box*> ; inline