|Century Embedded Technologies Nano-X SDK and Developer's Guide|
|Prev||Chapter 13. Extending and Adding Widgets||Next|
You may want your widget to be a subclass of Fl_Window. This can be useful if your widget wants to occupy an entire window, and can also be used to take advantage of system-provided clipping, or to work with a library that expects a system window ID to indicate where to draw.
Subclassing Fl_Window is almost exactly like subclassing Fl_Widget, and in fact you can easily switch a subclass back and forth. Watch out for the following differences:
Fl_Window is a subclass of Fl_Group so make sure your constructor calls end() (unless you actually want children added to your window).
When handling events and drawing, the upper-left corner is at 0,0, not x(),y() as in other Fl_Widget's. For instance, to draw a box around the widget, call draw_box(0, 0, w(), h()), rather than draw_box(x(), y(), w(), h()).
You may also want to subclass Fl_Window in order to get access to different visuals or to change other attributes of the windows. See "Appendix F - Operating System Issues" for more information.