[mcclim-devel] how to subclass a pane in good style?

Nikodemus Siivola nikodemus at random-state.net
Wed Jul 29 18:23:14 UTC 2009

Attached file canvas-pane.lisp is a work-in-progress. clim-patch.lisp
provides MEDIUM-DRAW-PIXELS* it depends on, based on Andy Hefner's
code that he posted a while back.

I use it in my raytracer's CLIM frontend to put up the pretty pictures
as they are drawn, and to provide a selection area on already rendered

There are (currently) three major behaviours that it provides for me:


   allows me to quickly assign color to a pixel.


   allows me to refresh the screen during rendering, updating only
   those portions where pixel colors have changed.


   gives me the bounding rectangle of the selected area. (A region
   is selected at any time by clicking and dragging on the canvas.)

There may be any number of dubious things in there, but the things
that most confuse me are:

* What to subclass? I currently subclass APPLICATION-PANE. I don't
know if I should subclass something else instead.

* Unintended overriding. I seem to accidentally override the
border-building stuff from APPLICATION-PANE. It is not obvious to me
why this happens, nor do I know how to avoid this should I want to.

* Event handling: to get pointer events I define a method on
DISPATCH-EVENT that calls HANDLE-EVENT. Is this the way it is supposed
to be done?

* Event handling & coordinates: to get coordinates relative to canvas
when the pointer is outside the canvas area during the click-and-drag
selection I transform coordinates through a common ancestor. This
seems a bit awkward -- is there a better way?

Any comments would be most welcome.


 -- Nikodemus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: canvas-pane.lisp
Type: application/octet-stream
Size: 9061 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20090729/9b246b30/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clim-patch.lisp
Type: application/octet-stream
Size: 1797 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20090729/9b246b30/attachment-0001.obj>

More information about the mcclim-devel mailing list