(in-package :clim-user) (defclass stack-layout-pane (clim:sheet-multiple-child-mixin clim:basic-pane) ()) (defmethod compose-space ((pane stack-layout-pane) &key width height) (reduce (lambda (x y) (space-requirement-combine #'max x y)) (mapcar #'compose-space (sheet-children pane)) :initial-value (make-space-requirement :width 0 :min-width 0 :max-width 0 :height 0 :min-height 0 :max-height 0))) (defmethod allocate-space ((pane stack-layout-pane) width height) (dolist (child (sheet-children pane)) (move-and-resize-sheet child 0 0 width height) (allocate-space child width height))) (defmethod initialize-instance :after ((pane stack-layout-pane) &rest args &key contents &allow-other-keys) (dolist (k contents) (sheet-adopt-child pane k))) (define-application-frame zoo () () (:panes (foo (make-pane 'push-button :label "Foo")) (bar (make-pane 'push-button :label "Bar")) (baz (make-pane 'push-button :label "Baz")) (io :interactor)) (:layouts (default (vertically () (make-pane 'stack-layout-pane :contents (list foo bar baz)) io)))) (defun zoo () (run-frame-top-level (make-application-frame 'zoo))) (define-zoo-command (com-foo :name "foo") () (let ((s (find-pane-named *application-frame* 'foo))) (dolist (k (sheet-children (sheet-parent s))) (setf (sheet-enabled-p k)(eq k s))))) (define-zoo-command (com-bar :name "bar") () (let ((s (find-pane-named *application-frame* 'bar))) (dolist (k (sheet-children (sheet-parent s))) (setf (sheet-enabled-p k)(eq k s))))) (define-zoo-command (com-baz :name "baz") () (let ((s (find-pane-named *application-frame* 'baz))) (dolist (k (sheet-children (sheet-parent s))) (setf (sheet-enabled-p k)(eq k s)))))