 USING: accessors arrays kernel math models namespaces sequences
 strings quotations assocs combinators classes colors colors.constants
 classes.tuple opengl opengl.gl math.vectors ui.commands ui.gadgets
-ui.gadgets.borders ui.gadgets.labels
-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 ;
+ui.gadgets.borders ui.gadgets.labels ui.gadgets.tracks
+ui.gadgets.packs ui.gadgets.worlds ui.gestures ui.pens ui.pens.solid
+ui.pens.image ui.pens.tile math.rectangles locals fry
+combinators.smart ;
 IN: ui.gadgets.buttons
 
 TUPLE: button < border pressed? selected? quot ;


: roll-button-theme ( button -- button )
    f COLOR: black <solid> dup f f <button-pen> >>boundary
    f f pressed-gradient f f <button-pen> >>interior
    align-left ; inline

: <roll-button> ( label quot -- button )
    <button> roll-button-theme ;

: <border-button-pen> ( -- paint )
    plain-gradient
    rollover-gradient
    pressed-gradient
    selected-gradient
    selected-gradient
    <button-pen> ;

: border-button-theme ( gadget -- gadget )
    <border-button-pen> >>interior
    { 5 5 } >>size
    faint-boundary ; inline

: <border-button> ( label quot -- button )
    <button> border-button-theme ;

: <toolbar> ( target -- toolbar )
    <shelf>
        1 >>fill
        { 5 5 } >>gap
        swap
        [ [ "toolbar" ] dip class command-map commands>> ] keep
        '[ [ _ ] 2dip <command-button> add-gadget ] assoc-each ;

: add-toolbar ( track -- track )
    dup <toolbar> { 3 3 } <border> align-left f track-add ;
