> I believe the correct solution would be to proceed as done
> by Fl_Value_Input that embeds, as a member, an Fl_Input object
> called input. This way, the Fl_Value_Input::draw() function can call
> Fl_Input::draw() as follows:
>    Fl_Widget *w = &input;
>    w->draw();
> Function Fl_Value_Input::handle() can also call Fl_Input::handle().
>
> The key point is that Fl_Value_Input is not a subclass of Fl_Input,
> but uses an Fl_Input object as one of its members.

You are right, technically it could be done this way.
One would have to derive from Fl_Widget too, I think.

But it defeats the advantages of inheritance.

- You would have to add wrapper classes for all methods you need
  for the embedded widget
- You would have to use several "kludges" as can be seen in
  Fl_Value_Input.cxx

So asking more generally:
Would it be bad to have proteced access to the draw() method?
Would there be any disadvantages?


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

Reply via email to