Re: [gtk-list] Re: change box orientation in runtime?



Emmanuel DELOGET wrote:

> From: Paul Barton-Davis <pbd@op.net>
> > >So I think this can't be done. (GTK doesn't support the concept of the
> same
> > >widget as child of multiple parents, which is a pity too).
>
>     Ooops. Maybe I've just missed the point, but what is the interesting
>     thing in having multiple parents for a widget ?
>

The interesting thing is that your code could be reduced to:

alias_widget=gtk_widget_alias(widget);
gtk_container_add(GTK_CONTAINER(newparent),alias_widget);

and that you could use the same widget in many places without having to
create/duplicate it many times. This is a feature that GTK doesn't have and
probably will never have. Although it is not a fundamental feature, sometimes
one misses it.
It's like having simbolic links in the directory structure. You can reference
the same file from many points without noticeable increase of disk space.
In the same manner, having "simbolic links" or "pointers" to other widgets
could be useful sometimes (and it would use less memory when one has the same
complex widget in many different parents).
(Now that I think of it, we will end with the same problems that appear with
simbolic links, that is, dangling (is it said so?) simbolic links and circular
references, maybe avoided by not letting to have an alias to an alias...).

How about a:
GtkWidget *gtk_widget_clone(GtkWidget *widget); ?

This could behave "like" copy contructors on C++. As we have gtk_*_new and
gtk_widget_destroy, gtk_widget_clone could clone the widget and call the clone
function of every child of it recursively.

I think it could be quite easy to implement, although i don't know if it could
be very useful. (perhaps when you have to include the same widget in many
different parents, you just could clone it and add the clones to the
parents...)

>
>     By the way :
>         gtk_widegt_ref(widget);
>         gtk_container_remove(GTK_CONTAINER(parent), widget);
>         gtk_container_add(GTK_CONTAINER(newparent), widget);
>         gtk_widget_unref(widget);
>
>     really help in reparenting :)
>
>     Emmanuel
>
> >
> > gtk_widget_unparent () is your friend.
> >
> > --p
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]