It would be nice to be able to control the size of the widget labels, 
menu labels etc from a single place using eg some enumeration table. The 
standard  enumeration types (indicated ie by a negative size value) 
would not work properly because sizes are often used with operators + - 
= == != ....  to calculate label position etc.
For that reason I would propose to introduce a simple class with 
overloaded conversion operator like:

class Fl_Size{
   int x;
public:
   operator int (){ return x>0? x : fl_size_table[-x];}
   Fl_Size(int a):x(a){};
   Fl_Size(const Fl_Size &a):x(a.x){}
   Fl_Size(){};
};

and we can change the widget size methods like

Fl_Size Fl_Widget::size() const;
void Fl_Widget::size(Fl_Size s);


The nice thing is that the conversion/assignment exist in both 
directions thanks to the (int) constructor, so you can use ordinary 
numbers or this pseudo-enumeration interchangeably, all operators work 
properly and it is really easy to implement.

One thing more: if we want to change "int" sizes to "float" type, it 
would be also good time to do that.

R.
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to