summaryrefslogtreecommitdiff
path: root/starling/node.scm
diff options
context:
space:
mode:
Diffstat (limited to 'starling/node.scm')
-rw-r--r--starling/node.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/starling/node.scm b/starling/node.scm
index dd5749c..cbb1027 100644
--- a/starling/node.scm
+++ b/starling/node.scm
@@ -59,6 +59,7 @@
on-attach
on-detach
attach-to
+ replace
detach
run-script
stop-scripts
@@ -349,6 +350,14 @@
(on-attach new-parent child))
new-children))
+(define-method (replace (parent-node <node>) . replacements)
+ (for-each (lambda (replacement)
+ (let ((old (child-ref parent-node (name replacement))))
+ (when old
+ (detach old))))
+ replacements)
+ (apply attach-to parent-node replacements))
+
(define-method (detach (node <node>))
(let ((p (parent node)))
(when p