[mcclim-devel] compose-space question

Duncan Rose duncan at robotcat.demon.co.uk
Thu May 19 22:28:36 UTC 2005


On Thursday, May 19, 2005, at 10:57  pm, Robert P. Goldman wrote:

>
> I have been finding that my application-panes look to be off in width
> by the width of their scroll-bars.  When I look at the COMPOSE-SPACE
> definitions (these are a little overwhelming for a novice like me) it
> looks like the effective method for compose-space for an
> application-pane is this one:
>
> (defmethod compose-space ((pane clim-stream-pane) &key width height)
>   (let ((w (bounding-rectangle-width (stream-output-history pane)))
>         (h (bounding-rectangle-height (stream-output-history pane))))
>     (make-space-requirement :width  w :min-width  w :max-width +fill+
>                             :height h :min-height h :max-height
>                             +fill+)))
>
> This one doesn't have the potential for adding the width of
> scrollbars.  Does this look like the right fix?
>
>
> (defmethod compose-space :around ((pane clim-stream-pane) &key width 
> height)
>   (let ((inner-width (call-next-method)))
>     (with-slots (scroll-bars) pane
>       (cond ((null scroll-bars) inner-width)
> 	    ((eq scroll-bars :vertical)
> 	     (space-requirement+ inner-width
> 				 (compose-space (slot-value (pane-scroller pane) 'vscrollbar))))
> 	    ((eq scroll-bars :horizontal)
> 	     (space-requirement+ inner-width
> 				 (compose-space (slot-value (pane-scroller pane) 'hscrollbar))))
> 	    (t (space-requirement+
> 		inner-width
> 		(space-requirement+
> 		 (compose-space (slot-value (pane-scroller pane) 'vscrollbar))
> 		 (compose-space (slot-value (pane-scroller pane) 'hscrollbar)))))))))

I don't think stream panes should know anything about scroll bars; 
these belong to
the scroller pane rather than the stream pane I think (i.e. the stream 
pane
doesn't want to ask for more space to account for scroll bars, rather 
the scroller
pane should add space for bars to the space requirement of the stream 
pane on its
behalf).

That said I tend to find my ideas of what's what are often incorrect ;-)

-Duncan


> _______________________________________________
> mcclim-devel mailing list
> mcclim-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
>




More information about the mcclim-devel mailing list