On 12.07.2011, at 14:50, Matthias Melcher wrote:
>
> On 11.07.2011, at 16:37, Edzard Egberts wrote:
>
>>> The wrapper happens to 99% in header files in a separate directory.
>>> There are only very minimal additions in FLTK3 to make the wrapper
>>> work, which is, every class has one additional pointer to the
>>> wrapper, and every virtual function has a few lines of extra code
>>> that starts with:
>>>
>>> if (wrapper) { (...) }
>>
>> I continue not to like this, to much "every" and it feels to me, it's
>> not the way "virtual" is ment for. Wrapper should be a layer,
>> overwriting virtual.
>
> I mean "virtual" functions. This is pretty much limited to
> fltk3::Widget::show, ::hide, ::draw, ::handle, and the destructor. I
> purposely did not intermix the F1 and F3 class hierarchy, because that would
> mean that we have F1 code inside of F3. However, now that you mention it,
> there could be a *very* elegant way of having an WrapperToFLTK3 class layer
> that would not show up *at all* in the FLTK 3 world!
>
> I will give this a shot tonight. That would limit the overhead in FLTK3 to
> one single pointer per widget and one "if" in do_callback().
OK, I implemented this for Fl_Widget and it will work for all other classes:
there is no need for a single back reference to the FLTK 1 wrapper from within
the FLTK 3 code! The only thing left in FLTK 3 is a single pointer to the
wrapper, and one "if" clause in fltk3::Widget::do_callback() .
I am very excited because this even removes the need for a "friend" line. Now
the FLTK 3 source files are completely clean!
- Matthias
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk