Domingo Alvarez Duarte wrote:
> Also I propose add this function to Fl_Widget:
>
> /** Returns a pointer to the root parent widget.
> Usually this is a Fl_Window.
> \retval NULL if the widget has no root parent
> */
> Fl_Group* root_parent() const;
>
> Fl_Group* Fl_Widget::root_parent() const {
> Fl_Group *result = parent();
> while(result) {
> if(!result->parent()) return result;
> result = result->parent();
> }
> return NULL;
> }
>
>
>
Or maybe:

   /** Returns a pointer to the root parent widget.
       Usually this is a Fl_Window.
       \retval NULL if the widget has no root parent
    */
   Fl_Group* parent_root() const;

Fl_Group* Fl_Widget::parent_root() const {
     Fl_Group *myparent = parent();
     while(myparent) {
         //if the parent parent is null
         //we consider it the root
         if(!myparent->parent()) return myparent;
         myparent = myparent->parent();
     }
     return NULL;
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to