     rollover-gradient
     pressed-gradient
     selected-gradient
-    <button-paint> ;
+    selected-gradient
+    <button-pen> ;
 
 : bevel-button-theme ( gadget -- gadget )
     <bevel-button-paint> >>interior

M: checkbox model-changed
    swap value>> >>selected? relayout-1 ;

TUPLE: radio-paint < caching-pen color interior-vertices boundary-vertices ;

: <radio-paint> ( color -- paint ) radio-paint new swap >>color ;

<PRIVATE

CONSTANT: circle-steps 8

PRIVATE>

M: radio-paint recompute-pen
    swap dim>>
    [ { 4 4 } swap { 9 9 } v- circle-steps fill-circle-vertices >>interior-vertices ]
    [ { 1 1 } swap { 3 3 } v- circle-steps circle-vertices >>boundary-vertices ] bi
    drop ;

<PRIVATE

: (radio-paint) ( gadget paint -- )
    [ compute-pen ] [ color>> gl-color ] bi ;

PRIVATE>

M: radio-paint draw-interior
    [ (radio-paint) ] [ interior-vertices>> gl-vertex-pointer ] bi
    GL_POLYGON 0 circle-steps glDrawArrays ;

M: radio-paint draw-boundary
    [ (radio-paint) ] [ boundary-vertices>> gl-vertex-pointer ] bi
    GL_LINE_STRIP 0 circle-steps 1+ glDrawArrays ;

:: radio-knob-theme ( gadget -- gadget )
    COLOR: black <radio-paint> :> radio-paint
    gadget
    f f radio-paint radio-paint <button-paint> >>interior
    radio-paint >>boundary
    { 16 16 } >>dim ;

: <radio-knob> ( -- gadget )
    <gadget> radio-knob-theme ;

TUPLE: radio-control < button value ;


classes.tuple opengl opengl.gl math.vectors ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.labels ui.gadgets.theme
ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures
ui.pens ui.pens.solid ui.pens.image math.rectangles locals
fry combinators.smart ;
IN: ui.gadgets.buttons

TUPLE: button < border pressed? selected? quot ;
