diff --git a/extra/models/models-docs.factor b/extra/models/models-docs.factor old mode 100644 new mode 100755 index 2b58381fe0..ace7a3ba03 --- a/extra/models/models-docs.factor +++ b/extra/models/models-docs.factor @@ -106,7 +106,7 @@ $nl ": 100 over set-slider-max ;" " 2array" "dup make-pile gadget." - "dup [ control-model ] map [ unparse ] " + "dup [ gadget-model ] map [ unparse ] " " gadget." } } ; @@ -146,7 +146,7 @@ HELP: delay ": " " 0 0 0 100 500 over set-slider-max ;" " dup gadget." - "control-model 500 [ number>string ] " + "gadget-model 500 [ number>string ] " " gadget." } } ; diff --git a/extra/slides/slides.factor b/extra/slides/slides.factor index 40980a72e6..864361b302 100755 --- a/extra/slides/slides.factor +++ b/extra/slides/slides.factor @@ -75,7 +75,7 @@ TUPLE: slides ; : change-page ( book n -- ) over control-value + over gadget-children length rem - swap control-model set-model ; + swap gadget-model set-model ; : next-page ( book -- ) 1 change-page ; diff --git a/extra/ui/gadgets/books/books-docs.factor b/extra/ui/gadgets/books/books-docs.factor index e2c4e49673..14528cef07 100755 --- a/extra/ui/gadgets/books/books-docs.factor +++ b/extra/ui/gadgets/books/books-docs.factor @@ -2,10 +2,10 @@ USING: ui.gadgets.books help.markup help.syntax ui.gadgets models ; HELP: book -{ $class-description "A book is a " { $link control } " containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget." +{ $class-description "A book is a control containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget." $nl "Books are created by calling " { $link } "." } ; HELP: { $values { "pages" "a sequence of gadgets" } { "model" model } { "book" book } } -{ $description "Creates a " { $link book } { $link control } ", which contains the gadgets in " { $snippet "pages" } ". A book shows one child at a time, determined by the value of the model, which must be an integer " } ; +{ $description "Creates a " { $link book } " control, which contains the gadgets in " { $snippet "pages" } ". A book shows one child at a time, determined by the value of the model, which must be an integer " } ; diff --git a/extra/ui/gadgets/buttons/buttons-tests.factor b/extra/ui/gadgets/buttons/buttons-tests.factor old mode 100644 new mode 100755 index e093751fed..b8cf5892eb --- a/extra/ui/gadgets/buttons/buttons-tests.factor +++ b/extra/ui/gadgets/buttons/buttons-tests.factor @@ -1,6 +1,6 @@ IN: temporary USING: ui.commands ui.gadgets.buttons ui.gadgets.labels -ui.gadgets tools.test namespaces sequences kernel ; +ui.gadgets tools.test namespaces sequences kernel models ; TUPLE: foo-gadget ; @@ -17,3 +17,20 @@ T{ foo-gadget } "t" set [ 2 ] [ "t" get gadget-children length ] unit-test [ "Foo a" ] [ "t" get gadget-child gadget-child label-string ] unit-test + +[ ] [ + 2 { + { 0 "atheist" } + { 1 "christian" } + { 2 "muslim" } + { 3 "jewish" } + } "religion" set +] unit-test + +[ 0 ] [ + "religion" get gadget-child radio-control-value +] unit-test + +[ 2 ] [ + "religion" get gadget-child control-value +] unit-test diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor index b24b97ac5c..6c10a11d3c 100755 --- a/extra/ui/gadgets/buttons/buttons.factor +++ b/extra/ui/gadgets/buttons/buttons.factor @@ -183,13 +183,14 @@ M: radio-control model-changed over set-button-selected? relayout-1 ; -: ( model assoc quot -- gadget ) - swapd [ >r -rot r> call gadget, ] 2curry assoc-each ; inline +: ( model assoc quot -- ) + #! quot has stack effect ( value model label -- ) + swapd [ swapd call gadget, ] 2curry assoc-each ; inline : radio-button-theme { 5 5 } over set-pack-gap 1/2 swap set-pack-align ; -: ( model value label -- gadget ) +: ( value model label -- gadget ) label-on-right [