! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors combinators kernel math.vectors namespaces
-ui.gadgets ui.gadgets.packs ui.gadgets.private ;
+USING: accessors combinators kernel math math.vectors namespaces
+sequences ui.gadgets ui.gadgets.packs ui.gadgets.private ;
IN: ui.gadgets.incremental
TUPLE: incremental < pack cursor ;
M: incremental dim-changed drop ;
+: scroll-children ( incremental -- )
+ dup children>> length 200,000 > [
+ ! We let the length oscillate between 100k-200k, so we don't
+ ! have to tail* the sequence on every gadget add.
+ [ 100,000 short tail* ] change-children drop
+ ] [ drop ] if ;
+
: add-incremental ( gadget incremental -- )
not-in-layout
+ dup scroll-children
2dup (add-gadget)
t in-layout? [
{