 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs classes combinators destructors
 documents.private fonts fry io io.styles kernel locals math
-math.rectangles math.vectors memoize models namespaces sequences
-sorting splitting strings ui.baseline-alignment ui.clipboards
-ui.gadgets ui.gadgets.borders ui.gadgets.grid-lines
-ui.gadgets.grids ui.gadgets.icons ui.gadgets.incremental
-ui.gadgets.labels ui.gadgets.menus ui.gadgets.packs
-ui.gadgets.paragraphs ui.gadgets.presentations
-ui.gadgets.private ui.gadgets.scrollers ui.gadgets.tracks
-ui.gestures ui.images ui.pens.solid ui.render ui.theme
-ui.traverse unicode ;
+math.rectangles math.vectors models namespaces sequences sorting
+splitting strings ui.baseline-alignment ui.clipboards ui.gadgets
+ui.gadgets.borders ui.gadgets.grid-lines ui.gadgets.grids
+ui.gadgets.icons ui.gadgets.incremental ui.gadgets.labels
+ui.gadgets.menus ui.gadgets.packs ui.gadgets.paragraphs
+ui.gadgets.presentations ui.gadgets.private ui.gadgets.scrollers
+ui.gadgets.tracks ui.gestures ui.images ui.pens.solid ui.render
+ui.theme ui.traverse unicode ;
 FROM: io.styles => foreground background ;
 FROM: ui.gadgets.wrappers => <wrapper> ;
 IN: ui.gadgets.panes

    apply-presentation-style
    nip ;

TUPLE: nested-pane-stream < pane-stream style parent ;

: new-nested-pane-stream ( style parent class -- stream )
    new
        swap >>parent
        swap <pane> apply-wrap-style [ >>style ] [ >>pane ] bi* ; inline

: unnest-pane-stream ( stream -- child parent )
    [ [ style>> ] [ pane>> smash-pane ] bi style-pane ] [ parent>> ] bi ;

TUPLE: pane-block-stream < nested-pane-stream ;



M: pane-stream stream-write-table
    [
        swap [ [ stream>> pane>> smash-pane ] map ] map
        styled-grid
    ] dip write-gadget ;

