On 09.02.2009, at 00:12, Greg Ercolano wrote:
> I haven't thought about this much, but I assume there's some simple
> way to do this. I don't know of a C++ way to redirect eg.
> Fl_Button::draw()
> to point to a different bit of code without deriving a class. Or can
> one somehow overload Fl_Button::draw()?
Unfortunatley, function pointer are the only way that I know to
override functions in base classes, so that the derived classes may
use the new functionality as well. It looks clumsy, but it is a very
fast approach nevertheless. Wrapping the dirty code into a neat API
would make things bearable.
To make a slightly larger loop: I have been using NewtonScript for a
few experiments. Yes, that would be the ole scripting language from
the Apple Newton MessagePad. There is a compiler/interpreter available
now called Newt0. It works great, but it is missing a lot of the
standard libraries.
The above task would be as simple as:
Fl_Widget.draw = func () {
...
}
So how about we integrate Newt0 as a scripting language into FLTK? :-P
Nah, OK, I guess I am kidding. As much as I would like a standardized
scripting interface, and as nice as Newt0 is, it is not mature and
misses huge parts of its standard library.
Matthias
----
http://robowerk.com/
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk