fit-layout to allow for panel-box-layout to recalculate size of panels based on contents

This commit is contained in:
David Botton 2022-08-17 23:34:41 -04:00
parent 8102e4a5f7
commit a8cd449ff2
3 changed files with 33 additions and 4 deletions

View file

@ -261,6 +261,34 @@ if :HTML-ID \"myid\" then the HTML-ID for center will be: myid-center"
:html-id (format nil "~A-bottom" html-id)))
panel-box))
;;;;;;;;;;;;;;;;
;; fit-layout ;;
;;;;;;;;;;;;;;;;
(defgeneric fit-layout (clog-panel-box-layout)
(:documentation "Recalculate layout based on size of outer panel content"))
(defmethod fit-layout ((obj clog-panel-box-layout))
(let ((top-height (scroll-height (top-panel obj)))
(bottom-height (scroll-height (bottom-panel obj)))
(left-width (scroll-width (left-panel obj)))
(right-width (scroll-width (right-panel obj))))
(setf (height (top-panel obj)) top-height)
(setf (height (bottom-panel obj)) bottom-height)
(setf (width (left-panel obj)) left-width)
(setf (width (right-panel obj)) right-width)
(set-margin-side (left-panel obj) :top (unit :px top-height))
(set-margin-side (right-panel obj) :top (unit :px top-height))
(set-margin-side (left-panel obj) :bottom (unit :px bottom-height))
(set-margin-side (right-panel obj) :bottom (unit :px bottom-height))
(set-margin (center-panel obj)
(unit :px top-height)
(unit :px right-width)
(unit :px bottom-height)
(unit :px left-width))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - clog-panel-box
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -619,7 +619,8 @@ embedded in a native template application.)"
(top-panel generic-function)
(left-panel generic-function)
(right-panel generic-function)
(bottom-panel generic-function))
(bottom-panel generic-function)
(fit-layout generic-function))
(defsection @clog-style-block (:title "CLOG Style Blocks")
"CLOG-Style-Block - CLOG Style Blocks"

View file

@ -2268,14 +2268,14 @@
(defparameter *supported-templates*
(list
'(:name "CLOG Builder - Panel Templates"
'(:name "CLOG Builder - Panel Projects"
:code :group)
'(:name "New Builder Panel Project"
:code "nbp"
:type :system
:www "templates/www/"
:loc "templates/projects/clog-panel/")
'(:name "CLOG Templates - General"
'(:name "CLOG - General Projects"
:code :group)
'(:name "New CLOG Basic HTML Project"
:code "ncp"
@ -2297,7 +2297,7 @@
:type :system
:www "templates/www/"
:loc "templates/projects/clog-web-site/")
'(:name "CLOG/CLOG Builder - Extension Templates"
'(:name "CLOG/CLOG Builder - Extension Projects"
:code :group)
'(:name "New CLOG/CLOG-Builder Plugin Project"
:code "ncplug"