On 16.02.2010, at 21:48, Edzard Egberts wrote: > Basics: > The code is ment to change labelfont/ labelsize and textfont/textsize of > FLTK windows, this means four different values to be changeable. It's a > problem, that basic class Fl_Widget only provides methods to change > labels, not the equivalent methods to change texts. The problem was > solved by dynamic casts for finding out, whether there are text methods, > but for FLTK 1.3 I would recommend to add virtual methods textsize() and > textfont() to Fl_Widget. > > When displaying the code it might be interesting to know, that I'm using > tab width of 3. > > Methods: > By inheritance it is easy to use the code for adding the functionality > to existing applications.
IMHO, the widget should not contain text attributes at all, neither for the label nor for any textual type value. Instead it should have two pointers (which may both be null). One points to whatever the label is supposed to be. The label should be a widget type, inheriting the coordinates from its parent. That way, a label can be HTML or an image, or whatever we like. All text attributes should be handled in a class. The reason is simple. For a single application, one rarely needs more than four different fonts: small, normal, large, and monospaced. So why repeat the font size and style all over memory? Just point at a style. FLTK 2 does that and I think it is the right way to go. Matthias _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

