>I think this would be enough support for custom objects needed for
>anything. Have the darn thing be notified of events like mouse clicks or
>withins, let it draw itself, let it have properties. Sounds like a nice
>minimal spec for an object extension API to me.
I think this can all work in an existing object type at least in
MetaCard. For example an image or graphic object receives mouse events
which can be caught in handlers and passed to the external. As for
properties MC objects have getprop and setprop handlers which you can use
to have the external return and set properties. Properties can be stored
in the external itself or in the objects custom properties. So the only
thing left is for the object to redraw itself, which can be a problem if
something is over the object(layers). 

>Of course, e.g. the drawing code would be platform-specific, but at
least
>a programmer having to program the same XCMD for several platforms would
>only have to learn the XCMD specs once, save for maybe naming
differences
>in calls like XGetPartPort() and XGetPartDC(). 
How about an object be sent a redraw message. The message would contain
the drawing canvas ( HDC in Windows, and a CGrafPtr in Mac), and rect to
draw in. The redraw message would be sent before the object is redrawed
giving the external object first crack at redrawing. If the message is
not caught or passed the object redraws itself as usual. 

The external would be responsible to:

a) drawing into the canvas using the rect passed with the redraw message.
b) not destroying or otherwise manipulating the canvas(port or hdc)
c) if object is of irregular shape(not rectangular) using the true mask
method in windows and copybits with a mask on mac to draw into canvas.

regards,
Tuviah

Reply via email to