On 02.05.2012 17:50, Bill Spitzak wrote:

> For FLTK 3 I would recommend a new draw and handle that take a
> rectangle. The purpose is so a subclass can add a "frame" around the
> contents without kludging it by adjusting the widget's boundaries. This
> also has the advantage that you can make these protected, even in the
> base class.
>
> Plain "draw()" is a public non-virtual on the base class which calls the
> virtual draw with the widget's rectangle.

Hmm, let's see if I understand this...

Say we have something like

   virtual void draw_rect() {...}

and draw() becomes

   void draw() { draw_rect(x(), y(), w(), h()); }

But then, wouldn't calling draw() always call the virtual method, and
thus inhibit usage like the following, as discussed here, e.g. in a
derived class like Fl_Scroll ?

   Fl_Group::draw(); // would call Fl_Scroll::draw_rect() !

So this would break existing code that would have to be rewritten
to call draw_rect() directly, like this:

   Fl_Group::draw_rect(x(), y(), w(), h());

Or did I miss (or misunderstand) something?

Albrecht
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to