change remove-gadget semantics so that removing glass from world doesn't break
parent
773d292688
commit
f6f9b0874e
|
@ -295,16 +295,22 @@ PRIVATE>
|
|||
|
||||
GENERIC: remove-gadget ( gadget parent -- )
|
||||
|
||||
M: gadget remove-gadget
|
||||
over (unparent)
|
||||
[ unfocus-gadget ]
|
||||
[ children>> delete ]
|
||||
[ nip relayout ]
|
||||
2tri ;
|
||||
M: gadget remove-gadget 2drop ;
|
||||
|
||||
: unparent ( gadget -- )
|
||||
not-in-layout
|
||||
[ dup parent>> dup [ remove-gadget ] [ 2drop ] if ] when* ;
|
||||
[
|
||||
dup parent>> dup
|
||||
[
|
||||
[ remove-gadget ] [
|
||||
over (unparent)
|
||||
[ unfocus-gadget ]
|
||||
[ children>> delete ]
|
||||
[ nip relayout ]
|
||||
2tri
|
||||
] 2bi
|
||||
] [ 2drop ] if
|
||||
] when* ;
|
||||
|
||||
: clear-gadget ( gadget -- )
|
||||
not-in-layout
|
||||
|
|
|
@ -48,14 +48,12 @@ IN: ui.gadgets.worlds.tests
|
|||
|
||||
TUPLE: focusing < gadget ;
|
||||
|
||||
: <focusing>
|
||||
focusing new ;
|
||||
: <focusing> ( -- gadget ) focusing new ;
|
||||
|
||||
TUPLE: focus-test < gadget ;
|
||||
|
||||
: <focus-test>
|
||||
focus-test new
|
||||
dup <focusing> add-gadget drop ;
|
||||
: <focus-test> ( -- gadget )
|
||||
focus-test new <focusing> add-gadget ;
|
||||
|
||||
M: focus-test focusable-child* gadget-child ;
|
||||
|
||||
|
|
|
@ -61,6 +61,9 @@ M: world focusable-child* gadget-child ;
|
|||
|
||||
M: world children-on nip children>> ;
|
||||
|
||||
M: world remove-gadget
|
||||
2dup glass>> eq? [ 2drop ] [ call-next-method ] if ;
|
||||
|
||||
: (draw-world) ( world -- )
|
||||
dup handle>> [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue