     #! the mouse is held down.
     repeat-button new-button bevel-button-theme ;
 
-TUPLE: checkmark-paint < caching-pen color last-vertices ;
-
-: <checkmark-paint> ( color -- paint )
-    checkmark-paint new swap >>color ;
-
-<PRIVATE
-
-: checkmark-points ( dim -- points )
-    [
-        {
-            [ { 0 0 } v* { 0.5 0.5 } v+ ]
-            [ { 1 1 } v* { 0.5 0.5 } v+ ]
-            [ { 1 0 } v* { -0.3 0.5 } v+ ]
-            [ { 0 1 } v* { -0.3 0.5 } v+ ]
-        } cleave
-    ] output>array ;
-
-: checkmark-vertices ( dim -- vertices )
-    checkmark-points concat >float-array ;
-
-PRIVATE>
-
-M: checkmark-paint recompute-pen
-    swap dim>> checkmark-vertices >>last-vertices drop ;
-
-M: checkmark-paint draw-interior
-    [ compute-pen ]
-    [ color>> gl-color ]
-    [ last-vertices>> gl-vertex-pointer ] tri
-    GL_LINES 0 4 glDrawArrays ;
-
-: checkmark-theme ( gadget -- gadget )
-    f
-    f
-    COLOR: black <solid>
-    COLOR: black <checkmark-paint>
-    <button-paint> >>interior
-    COLOR: black <solid> >>boundary ;
+: <checkmark-paint> ( -- pen )
+    "checkbox" theme-image <image-pen>
+    "checkbox" theme-image <image-pen>
+    "checkbox-clicked" theme-image <image-pen>
+    "checkbox-set" theme-image <image-pen>
+    "checkbox-set-clicked" theme-image <image-pen>
+    <button-pen> ;
 
 : <checkmark> ( -- gadget )
     <gadget>
-    checkmark-theme
-    { 14 14 } >>dim ;
+    <checkmark-paint> >>interior
+    dup dup interior>> pen-pref-dim >>dim ;
 
 : toggle-model ( model -- )
     [ not ] change-model ;

: <button> ( label quot -- button )
    button new-button ;

TUPLE: button-paint plain rollover pressed selected ;

C: <button-paint> button-paint

: find-button ( gadget -- button )
    [ button? ] find-parent ;

: button-paint ( button paint -- button paint )
    over find-button {
        { [ dup pressed?>> ] [ drop pressed>> ] }
        { [ dup selected?>> ] [ drop selected>> ] }
        { [ dup button-rollover? ] [ drop rollover>> ] }
        [ drop plain>> ]
    } cond ;

M: button-paint draw-interior
    button-paint dup [ draw-interior ] [ 2drop ] if ;

M: button-paint draw-boundary
    button-paint dup [ draw-boundary ] [ 2drop ] if ;

M: button-paint pen-pref-dim
    [
        {
            [ plain>> pen-pref-dim ]

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

: <radio-paint> ( -- pen )
    "radio" theme-image <image-pen>
    "radio" theme-image <image-pen>
    "radio-clicked" theme-image <image-pen>
    "radio-set" theme-image <image-pen>
    "radio-set-clicked" theme-image <image-pen>
    <button-pen> ;

: <radio-knob> ( -- gadget )
    <gadget>
    <radio-paint> >>interior
    dup dup interior>> pen-pref-dim >>dim ;

TUPLE: radio-control < button value ;

