[fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread Albrecht Schlosser
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) .

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread Evan Laforge
> 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 pr

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread imacarthur
On 8 Feb 2010, at 18:36, Albrecht Schlosser wrote: > > 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. Yup - it's been a long time since I measured it, a

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread imacarthur
On 8 Feb 2010, at 19:09, Evan Laforge wrote: > But you'd still have to cast, right? To avoid casting (in the client > code at least) wouldn't you need: > > virtual Fl_Group *Fl_Widget::as_group() const > Evan, I'm not sure I understand... Fl_Group derives from Fl_Widget, so they are "the same

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread Evan Laforge
On Mon, Feb 8, 2010 at 12:49 PM, imacarthur wrote: > > On 8 Feb 2010, at 19:09, Evan Laforge wrote: >> But you'd still have to cast, right?  To avoid casting (in the client >> code at least) wouldn't you need: >> >> virtual Fl_Group *Fl_Widget::as_group() const >> > > Evan, > > I'm not sure I unde

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-08 Thread imacarthur
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 her

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-09 Thread Kurt Van Dijck
On Mon, Feb 08, 2010 at 10:36:31AM -0800, Albrecht Schlosser wrote: > > 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 "pse

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-09 Thread Kurt Van Dijck
Sorry, I whole thread comes in now. My proposal is already made. :-) Kurt ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-09 Thread Albrecht Schlosser
imacarthur wrote: > 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 betwee

Re: [fltk.development] RFC: FLTK 1.3 Fl_Widget::is_group() and Fl_Widget::is_window()

2010-02-10 Thread Matthias Melcher
On 09.02.2010, at 09:41, Kurt Van Dijck wrote: > > I propose a slightly modified one: > virtual Fl_Group* Fl_Widget::as_group() > virtual Fl_Window* Fl_Widget::as_window() +1. Particularly, as_group, and not is_group! ___ fltk-dev mailing list fltk-d