]> gitweb.factorcode.org Git - factor.git/commitdiff
illusion models activated automatically
authorSam Anklesaria <sam@Tintin.local>
Sun, 24 May 2009 20:35:03 +0000 (15:35 -0500)
committerSam Anklesaria <sam@Tintin.local>
Sun, 24 May 2009 20:35:03 +0000 (15:35 -0500)
basis/models/illusion/illusion.factor
extra/ui/frp/gadgets/gadgets.factor
extra/ui/frp/signals/signals.factor
extra/ui/gadgets/alerts/alerts.factor
extra/ui/gadgets/comboboxes/comboboxes.factor

index 6cab6e6371a77b3745ecd48ab8ee69282e00969a..f41a4a2444714b4bd44cb7a59fcc9cb97d5659dc 100644 (file)
@@ -5,7 +5,7 @@ TUPLE: illusion < arrow ;
 
 : <illusion> ( model quot -- illusion )
     illusion new V{ } clone >>connections V{ } clone >>dependencies 0 >>ref
-    swap >>quot over >>model [ add-dependency ] keep ;
+    swap >>quot over >>model [ add-dependency ] keep dup activate-model ;
 
 : backtalk ( value object -- )
    [ quot>> [undo] call( a -- b ) ] [ model>> ] bi set-model ;
index 02bc8f45cb4c7e4028c944c0ea4c49bff60fd6fe..08c7b440028a6a1fb78f3db6948b598eb5d33f2d 100644 (file)
@@ -4,10 +4,12 @@ ui.gadgets.editors ui.gadgets.tables ;
 IN: ui.frp.gadgets
 
 TUPLE: frp-button < button hook ;
-: <frp-button> ( text -- button ) [
+: <frp-button> ( gadget -- button ) [
       [ dup hook>> [ call( button -- ) ] [ drop ] if* ] keep
       t swap set-control-value
-   ] frp-button new-button border-button-theme f <basic> >>model ;
+   ] frp-button new-button f <basic> >>model ;
+
+: <frp-bevel-button> ( text -- button ) <frp-button> border-button-theme ;
 
 TUPLE: frp-table < table { quot initial: [ ] } { val-quot initial: [ ] } color-quot column-titles column-alignment ;
 M: frp-table column-titles column-titles>> ;
index 184dd05365ccbe04ff33f91b520a2bb80197e1d1..c7c9736111bca389a0a177e6b176696b5d4f5968 100644 (file)
@@ -38,6 +38,7 @@ M: switch-model (model-changed) 2dup switcher>> =
 : <switch> ( signal1 signal2 -- signal' ) [ 2array switch-model <multi-model> ] 2keep
    [ >>original ] [ >>switcher ] bi* ;
 M: switch-model model-activated [ original>> ] keep model-changed ;
+: >behavior ( event -- behavior ) t <model> swap <switch> ;
 
 TUPLE: mapped-model < multi-model model quot ;
 : new-mapped-model ( model quot class -- const-model ) [ over 1array ] dip
index 265c0fdc7485aa392558915efaf5a5bdf2dda2d0..e948c92d43c115c88c3c7b1c305aee6816765255 100644 (file)
@@ -10,7 +10,7 @@ IN: ui.gadgets.alerts
 :: ask-user* ( model string -- model' )
    [ [let | lbl  [ string <label>  T{ font { name "sans-serif" } { size 14 } } >>font dup , ]
             fldm [ <frp-field> ->% 1 ]
-            btn  [ "okay" <frp-button> model >>model ] |
+            btn  [ "okay" <frp-bevel-button> model >>model ] |
          btn -> [ fldm swap <updates> ]
                 [ [ drop lbl close-window ] $> , ] bi
    ] ] <vbox> { 161 86 } >>pref-dim "" open-window ;
@@ -20,7 +20,7 @@ IN: ui.gadgets.alerts
 MACRO: ask-buttons ( buttons -- quot ) dup length [
       [ swap
          [ 22 wrap-lines <label> T{ font { name "sans-serif" } { size 18 } } >>font ,
-         [ [ <frp-button> [ close-window ] >>hook -> ] map ] <hbox> , ] <vbox>
+         [ [ <frp-bevel-button> [ close-window ] >>hook -> ] map ] <hbox> , ] <vbox>
          { 200 110 } >>pref-dim "" open-window
       ] dip firstn
    ] 2curry ;
\ No newline at end of file
index a937b73d35f5734cd6cc33e6ef6d034dc6945c57..137150001cda9586045e2649c50199b964189cdf 100644 (file)
@@ -1,6 +1,6 @@
 USING: accessors arrays kernel math.rectangles models sequences
-ui.frp ui.gadgets ui.gadgets.glass ui.gadgets.labels
-ui.gadgets.tables ui.gestures colors.constants fonts ;
+ui.gadgets ui.gadgets.glass ui.gadgets.labels
+ui.gadgets.tables ui.gestures ;
 IN: ui.gadgets.comboboxes
 
 TUPLE: combo-table < table spawner ;
@@ -19,4 +19,4 @@ combobox H{
 
 : <combobox> ( options -- combobox ) [ first [ combobox new-label ] keep <model> >>model ] keep
    [ 1array ] map <model> trivial-renderer combo-table new-table
-   >>table dup font>> COLOR: gray >>background 12 >>size >>font ;
\ No newline at end of file
+   >>table ;
\ No newline at end of file