On 25.08.2008, at 01:00, Rafal wrote:

> [EMAIL PROTECTED] wrote:
>
>>> The vast majority of widget labels & tooltips are compile time  
>>> constants
>
>> Other than your own apps, do you have any evidence whatsoever
>> to support this statement?
>
> I also disagree with saying that majority of labels are compile time
> constant, because:
>
> 1) mostly: translations
> 2) and also: dynamic labels (i.e. gui with more dynamic elements)

I find the whole idea of labels wrong. Many widgets in a UI have no  
label at all, and many widgets may have pretty complex labels with  
embedded symbols, images, varying fonts, undelining, etc. . We are  
helping ouselves with the @-notation, complicated code, exceptions to  
the rule, images that are unpredictable in alignment and so forth.

My proposal would be (and it solves the problem above as well) to stop  
continue what was internally done already and pull all label code out  
of the widget and simply allow any kind of widget as a "label-child"  
of a widget. The advantages should be obvious: create html based  
complex labels, simple one-text-liners, or image labels. Even the  
existing interface can reain the same.

There are merely two additions that need to be done: 1. FL_Label (yes,  
that struct exists in Fl_Widget.H already) needs to be upgraded to  
become a widget and 2. the parent widget must use the alignment flags  
and its own corrdinates to position the label child correctly.  
Everything else is alredy in the code.

This also solves the problem that started the discussion, because now  
the text interface converts into a "value()" call to the label widget,  
which by definition will duplicate the value anyways.

Like it?

  Matthias


Example

 > w = new Fl_Value(10, 10, 200, 200, "Hello");

would internally call this:

 > w = new Fl_Value(10, 10, 200, 200);
 > w->label(new Fl_Label("Hello"));

The label position and size is calculated and render time, just as it  
is done now. However the additional abilities are great. Imagine this:

 > w = new Fl_Button(10, 10, 200, 200);
 > w->label(new Fl_Html_Widget("You <i>must</i> click me");

or even, finally, the icon in front of some text:

 > w = new Fl_Button(10, 10, 200, 200);
 > w->label(new Fl_Group());
 > new Fl_Image("myIcon.gif");
 > new Fl_Label("click here!");
 > w->label()->end();

As an additional bonus, we would lose the "labelsize" and "labelfont"  
vs. "textsize" and "textfont" interface (and only keep it for source  
code compatibility).

----
http://robowerk.com/


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

Reply via email to