[Y-devel] shapes? (fwd)
Jerome Laheurte jerome at gandalf.fraca7.homeunix.net
Wed Feb 25 10:46:56 GMT 2004
I've messed up once again when replying :)
--
---------- Forwarded message ----------
Date: Wed, 25 Feb 2004 11:42:29 +0100 (CET)
From: Jerome Laheurte <jerome at gandalf.fraca7.homeunix.net>
Reply-To: Jerome Laheurte <fraca7 at free.fr>
To: Mark Thomas <mark at www.y-windows.org>
Subject: Re: [Y-devel] shapes?
On Tue, 24 Feb 2004, Mark Thomas wrote:
> I realised today that the patch I merged for the theme interface isn't
> quite what I want. The visitor-pattern-style call to "themeDrawWidget" is
> hard to expose to clients in a way that they can draw them themselves.
That's only because calls to virtual methods originating from the
server's code isn't dispatched to the client...
Implementing such a 'cross-process polymorphism' would allow the
client to create its own widgets in an intuitive manner (as with
standard toolkits, by simply inheriting the widget class and
overloading a few virtual method), as well as retain the Visitor
drawing style.
In fact, it's already implemented, sort of. The event mechanism may be
used to simulate this. Let's say we create a new event, called
VirtualDispatch. When a client object wishes to overload the
button's Paint() method, it subscribes to the server-side object's
VirtualDispatch event, passing 'Paint' as parameter (or maybe one
event for each virtual method?).
On the server side, the actual painting code is moved to another
method, say RealPaint().
Then, the Paint() method on the server, instead of actually painting,
sends the VirtualDispatch event if someone has subscribed to it, or
calls RealPaint() if there is no subscriber. The client object may
then call RealPaint() as it were its parent class Paint() method, and
perform any additionnal painting needed to customize the widget, as in
standard toolkits.
Although ASCII is not the right tool to draw sequence diagrams, I'll
try :)
Server Server-side Client-side
object object
| | |
| Paint | |
||------------>||VirtualDispatch |
|| ||--------------->||
|| || ||
|| || RealPaint ||
|| |||<--------------||
|| ||| ||
|| || || --
|| || || | some stuff
|| || || <-
|| || |
|| ||
|| |
|
|
Except that, of course, calls between server & client should be
asynchronous whenever possible.
That could also be used to implement custom reactions to events, of
course, which would actually need to reimplement standard widgets
completely on the client side (except for drawing if Canvas exposes
theme drawing methods).
--
Jérôme Laheurte <fraca7 at free.fr>
When in doubt, do what the President does -- guess.
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved