On 06/07/11 08:30, Paul R wrote:
> I think am kind of getting this.. the idea is derive a class from fl widget,
> so then my own class which say calls an fl_box into being
> can then use the box as it's 'drawing canvas' by calling the inherited
> draw function from the widget class.
>
> Whenever i wanted to draw the rectangle i could just call
> myClass.draw(x,y,w,h) ??
When FLTK wants to draw a widget, it calls the draw() method
of each FLTK widget.
If you derive a class from one of the FLTK widgets
and don't define a draw() method of your own, the widget's
draw() method will be called. If you DO define a draw() method,
yours will be called instead of the class you derive from.
So it's up to you to handle drawing the entire widget's area
(the entire x()/y()/w()/h() area assigned to the widget).
If you just draw a 20,20,20,20 rectangle when the widget
is actually 0,0,200,200, then you may see unexpected junk
in the area of your widget that you don't draw.. so be
mindful of that.
In some cases this is desirable if you intentionally
want your widget to be mostly "see through", and you
know the window will fill in the background.
But if you derive a class from a window, you really
must draw the entire window area, or you'll get screen
garbage.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk