On 8 Feb 2010, at 21:39, Evan Laforge wrote:
>>
>> I'm not sure I understand... Fl_Group derives from Fl_Widget, so they
>> are "the same" as far as this is concerned... The method itself
>> returns int (in Albrecht's implementation) but that's in effect a
>> boolean... There must be something here that I am missing; where do
>> we need to cast?
>
> Well, unless I'm misunderstanding, this whole thing is about evil
> upcasts, right?  You have a widget and you want to cast it to a group
> and do group things to it.  So currently it's:
>
> if (w.type() == xyz) { g = (Fl_Group) w ...
>
> If I understand the proposal, that would make
>
> if (w.is_group()) { g = (Fl_Group) w ...
>
> So why not put the cast in the method:
>
> if (Fl_Group *g = w.as_group()) { ...

Oh, right. Hmm, that wasn't what I thought Albrecht was suggesting at  
all; I had thought this was more a budget RTTI replacement (but more  
controlled than the current type() bitfield mechanism) - a way, when  
searching the widget hierarchy, to distinguish quickly between  
Fl_Group and Fl_Window widgets, and to distinguish those container  
widgets from other non-container widgets...

I am probably wrong, though.


_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to