Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

allocate-space and resize-sheet #1315

Open
admich opened this issue Sep 14, 2022 · 0 comments
Open

allocate-space and resize-sheet #1315

admich opened this issue Sep 14, 2022 · 0 comments

Comments

@admich
Copy link
Collaborator

admich commented Sep 14, 2022

It's not clear if (alocate-space pane ...) must resize its own pane or the children. In MCCLIM allocate-space methods sometimes do one thing, sometimes the other often both.
Also the notes in Documentation/Notes are contradictory, in Documentation/Notes/layout-protocol.org it is written that allocate-space does not change the geometry of its "own" pane, but in Documentation/Notes/sheet-geometry.org is given the following pseudocode:

(defmethod allocate-space ((pane dummy-composite-pane) width height)
   (resize-sheet pane width height)
   (let ((child (sheet-child pane))
        (tansf (sheet-device-transformation pane)))
        (move-sheet child 0 0)
        (allocate-space child width height)))

I don't know what is better but I think that it is good if all methods do the same thing, and I see three possibilities:

  1. the method resize its own pane (like the code in Documentation/Notes/sheet-geometry.org)
(defmethod allocate-space (pane width height)
   (resize-sheet pane width height)
   (loop for child in (sheet-children pane) do
      (move-sheet child .....)
      (allocate-space child ........))
  1. the method doesn't resize its own pane (like written in Documentation/Notes/layout-protocol.org )
(defmethod allocate-space (pane width height)
   (loop for child in (sheet-children pane) do
      (move-and-resize-sheet child .....)
      (allocate-space child ........))
  1. A variant of 2) in which allocate-space is called at the end of resize-sheet in this way a pane it is automatically reallocated when its size change. I don't know if this is in conformance with the specification but it is what Franz CLIM does.
(defmethod allocate-space (pane width height)
   (loop for child in (sheet-children pane) do
      (move-and-resize-sheet child .....))
;; with one of the following (ofcourse you can also use :after methods)
(defmethod resize-sheet (pane width height)
   ....
   ....
  (allocate-space pane width height))

;; or 
(defmethod note-sheet-region-changed (pane width height)
   ....
   ....
  (allocate-space pane width height))

;; or also
(defmethod (setf sheet-region) (region pane)
   ....
   ....
  (allocate-space pane ....))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant