diff options
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | FL/Fl_Widget.H | 11 | ||||
| -rw-r--r-- | documentation/src/drawing.dox | 11 |
3 files changed, 14 insertions, 9 deletions
@@ -1,5 +1,6 @@ CHANGES IN FLTK 1.3.0 + - All draw() methods of widgets are now protected (STR #2142). - The new configure option --enable-x11 (lowercase 'x') enables cygwin builds under Windows (with --enable-cygwin) to use X11 instead of GDI drawing (STR #2147) and is ignored otherwise. diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 46e457833..8d6e57005 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -177,8 +177,17 @@ public: Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. - + Override this function to draw your own widgets. + + If you ever need to call another widget's draw method <I>from within your + own draw method</I>, e.g. for an embedded scrollbar, you must downcast the + embedded widget's pointer to Fl_Widget* and call the virtual draw() method. + + \code + Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar + s->draw(); // calls Fl_Scrollbar::draw() + \endcode */ virtual void draw() = 0; diff --git a/documentation/src/drawing.dox b/documentation/src/drawing.dox index ea47d8fe2..76f24584e 100644 --- a/documentation/src/drawing.dox +++ b/documentation/src/drawing.dox @@ -13,17 +13,12 @@ Calling these functions at other places will result in undefined behavior! To write code here, you must subclass one of the existing Fl_Widget classes and implement your own version of draw(). -\li The most common place is inside the virtual method - <A href="subclassing.html#draw"><tt>Fl_Widget::draw()</tt></A>. - To write code here, you must subclass one of the existing Fl_Widget - classes and implement your own version of draw(). - \li You can also write <A href="common.html#boxtypes">boxtypes</A> and <A href="common.html#labeltypes">labeltypes</A>. These are small procedures that can be called by existing - <A HREF="subclassing.html#draw"><tt>Fl_Widget::draw()</tt></A> - methods. These "types" are identified by an 8-bit index that is stored - in the widget's box(), labeltype(), and possibly other properties. + Fl_Widget::draw() methods. These "types" are identified by an 8-bit + index that is stored in the widget's box(), labeltype(), and possibly + other properties. \li You can call Fl_Window::make_current() to do incremental update of a widget. Use Fl_Widget::window() to find the window. |
