CAPI: Restoring divider position
Hi All,
I have a layout with a divider and I want
to save and restore the position of the divider. The following solution works
but seems to be a bit verbose or cumbersome.
Does anybody know a simpler solution?
Remark: If I don’t save the position
when iconifying, the divider is in the wrong position after de-iconifying.
(defvar *initial-width* 100)
(define-interface test ()
()
(:panes
(t1 text-input-pane
:external-min-width *initial-width* :external-max-width *initial-width*)
(t2 text-input-pane))
(:layouts
(l1 row-layout '(t1 :divider
t2)))
(:default-initargs
:iconify-callback (lambda
(self i)
(let ((pane (slot-value self 't1)))
(if i
(with-geometry pane
(setf
*initial-width* %width%))
(progn
;; force divider into position
(set-geometric-hint pane :external-min-width *initial-width*)
(set-geometric-hint pane :external-max-width *initial-width*)))))
:activate-callback (let
((first-activation t))
(lambda (self a)
(when (and a (not first-activation))
(release-divider self))
(when first-activation
(setf first-activation nil))))
:best-width 600))
(defun release-divider (window)
“Release the divider so the
user can move it.”
(let ((pane (slot-value window
't1)))
(set-geometric-hint pane
:external-min-width 10)
(set-geometric-hint pane
:external-max-width nil)))
(defun make-test ()
(let* ((window (make-instance
'test))
(pane (slot-value window 't1)))
(display window)
(release-divider
window)))
Any hint or help appreciated.
Andreas