Hi, developers, I propose to add these two virtual methods to Fl_Widget:
[1] virtual int Fl_Widget::is_group() [2] virtual int Fl_Widget::is_window() Rationale: I'd like to eventually get rid of the "pseudo RTTI" usage of Fl_Widget::type(), as in: [3] if (widget->type() >= FL_WINDOW) ... // However, since type() [3] is a fast inline method and the new proposed methods are virtual, there might be a small performance penalty if we would replace this all over in the FLTK core. Therefore I wouldn't suggest to do this in a first step. The implementation is trivial, and methods with these names (and functions) are already in FLTK 2. However, the implementation in FLTK 2 uses type() and some bit values in type() for GROUP and WINDOW. The drawback of this approach is trouble as seen in http://www.fltk.org/str.php?L1915 Thus, I propose to add these two virtual methods and use them where appropriate. They would also be useful for user code and the new (work in progress) Fl_Printer support. Fl_Widget::is_group() would be useful for traversing a widget tree (to avoid dynamic_cast). Opinions, better proposals, votes please ... Thanks Albrecht _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
