Clean up ui.gadgets.grids
parent
3eb5222186
commit
69974440c4
|
|
@ -13,8 +13,7 @@ align ;
|
||||||
|
|
||||||
: new-grid ( children class -- grid )
|
: new-grid ( children class -- grid )
|
||||||
new-gadget
|
new-gadget
|
||||||
swap >>grid
|
swap [ >>grid ] [ concat add-gadgets ] bi ; inline
|
||||||
dup grid>> concat add-gadgets ; inline
|
|
||||||
|
|
||||||
: <grid> ( children -- grid )
|
: <grid> ( children -- grid )
|
||||||
grid new-grid ;
|
grid new-grid ;
|
||||||
|
|
@ -49,8 +48,7 @@ align ;
|
||||||
dupd add-gaps dim-sum v+ ;
|
dupd add-gaps dim-sum v+ ;
|
||||||
|
|
||||||
M: grid pref-dim*
|
M: grid pref-dim*
|
||||||
[ gap>> ] [ compute-grid ] bi
|
[ gap>> ] [ compute-grid [ gap-sum ] bi-curry@ ] bi bi (pair-up) ;
|
||||||
[ gap-sum ] bi-curry@ bi (pair-up) ;
|
|
||||||
|
|
||||||
: do-grid ( dims grid quot -- )
|
: do-grid ( dims grid quot -- )
|
||||||
[ grid>> ] dip '[ _ 2each ] 2each ; inline
|
[ grid>> ] dip '[ _ 2each ] 2each ; inline
|
||||||
|
|
@ -70,19 +68,16 @@ M: grid pref-dim*
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: grid-layout ( grid horiz vert -- )
|
: grid-layout ( grid horiz vert -- )
|
||||||
[ position-grid ] 3keep resize-grid ;
|
[ position-grid ] [ resize-grid ] 3bi ;
|
||||||
|
|
||||||
M: grid layout* dup compute-grid grid-layout ;
|
M: grid layout* dup compute-grid grid-layout ;
|
||||||
|
|
||||||
M: grid children-on ( rect gadget -- seq )
|
M: grid children-on ( rect gadget -- seq )
|
||||||
dup children>> empty?
|
dup children>> empty? [ 2drop f ] [
|
||||||
[ 2drop f ]
|
|
||||||
[
|
|
||||||
{ 0 1 } swap grid>>
|
{ 0 1 } swap grid>>
|
||||||
[ 0 <column> fast-children-on ] keep
|
[ 0 <column> fast-children-on ] keep
|
||||||
<slice> concat
|
<slice> concat
|
||||||
]
|
] if ;
|
||||||
if ;
|
|
||||||
|
|
||||||
M: grid gadget-text*
|
M: grid gadget-text*
|
||||||
grid>>
|
grid>>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue