     table new-gadget
         swap >>model
         trivial-renderer >>renderer
+        [ drop ] >>action
         f <model> >>selected-value
-        { "sans-serif" plain 12 } >>font
-        T{ rgba f 0.8 0.8 1.0 1.0 } >>selection-color
+        sans-serif-font >>font
+        selection-color >>selection-color
         black >>mouse-color
         black >>text-color ;
 

USING: accessors arrays colors fry io.styles kernel math
math.geometry.rect math.order math.vectors namespaces opengl
sequences ui.gadgets ui.gadgets.scrollers ui.gadgets.status-bar
ui.gadgets.worlds ui.gestures ui.render models math.ranges sequences
combinators ;
IN: ui.gadgets.tables

! Row rendererer protocol

: validate-row ( m table -- n )
    control-value length 1- min 0 max ;

: visible-row ( table quot -- n )
    '[
        [ clip get @ origin get [ second ] bi@ - ] dip
        y>row
    ] keep validate-row ; inline

: first-visible-row ( table -- n )
    [ loc>> ] visible-row ;

: last-visible-row ( table -- n )
    [ rect-extent nip ] visible-row 1+ ;

: column-loc ( font column width align -- loc )
    [ [ [ open-font ] dip string-width ] dip swap - ] dip
