> > I had to change print_widget again because it failed under Windows
> > on sub-sub-windows, and believe the problem you handle here is now
> > correctly handled. I'll put that in the new branch after checking it.
>
> Yes, I knew that. I wanted to post it later, but now you beat me to
> it. I wouldn't spend too much time with sub-[sub-...]windows, maybe
> we shouldn't support that at all, because:
>
> (1) For every sub-window you have to accumulate the x/y-offsets, but
> that's probably what you found out already.
>
> (2) Your trick to find the subwindows only works, if the windows are
> shown(), because otherwise they won't be in the list of windows.
In our case (printing), aren't we interested only in shown()
windows?

> The
> only way to find subwindows would probably be to traverse the widget
> tree and find them, but that's not as easy as it might look. Either
> we need to add another virtual method (draw_subwindows or something
> like that), or you must find out if a child widget is an Fl_Group,
> and that's IMHO not possible w/o dynamic_cast (forbidden) or another
> (virtual) method that I wanted to introduce anyway for some time now:
>
>    virtual int Fl_Widget::is_group()
>
> but that's another story...
It's because traversing the widget tree is impossible that I had
to find this other trick. So this is_group() method would be quite
useful. Alternatively, setting a type FL_GROUP = FL_WINDOW-1
in the Fl_Group constructor might suffice, may be.
Fl_Widget::is_group() would become this->type() >= FL_GROUP


>
> And, while we're at it: you don't need to write your own (child_of)
> function to find out if a window is a child of another widget.
> It's already there:
>
> int Fl_Widget::inside (const Fl_Widget *w)
> int Fl_Widget::contains (const Fl_Widget *w)
Thanks, I'll use these.

>
> Albrecht

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

Reply via email to