[gtk-devel-list] Re: _foreach vs _forall

> i've continued to work on this (got distracted by some personall issues),
> and the result is this:
>  - the GtkContainer::foreach signal will vanish (afaik, there is no code in
>    existance that actually connects to this signal, and if there would be,
>    connecting to ::foreach would be questionable behaviour anways).
>  - there's a new class method GtkContainerClass.forall() that takes care to
>    iterate over a containers children, optionally including internal widgets.
>      void (* forall)               (GtkContainer    *container,
>                                     gboolean         include_internals,
>                                     GtkCallback      callback,
>                                     gpointer         callbabck_data);
>  - the old gtk_container_foreach() (and thus gtk_container_children())
>    behaviours remain, that is, they iterate over all children of a container
>    that got added via gtk_copntainer_add() or similar methods (i.e. for the
>    notebook, _foreach will iterate over the pages only).
>  - there is a new function call
>    void    gtk_container_forall               (GtkContainer *container,
>                                                GtkCallback   callback,
>                                                gpointer      callback_data);
>    that iterates over *all* children of a container, including internal ones
>    (e.g. a notebook's menu/tab labels, clist buttons, etc...). this function
>    is classified as "internal gtk usage", since its prototype may change
>    in the future, and external gtk programs shouldn't freak around with
>    internal children (GUI builders being an occasional exception).
> this solution gets rid of the problem of internal gtk code not being able
> to acces certain children of distinct containers (e.g. for state propagation
> or reparentation) and the confusion of application programmers that
> occasionally encounter internal children with gtk_container_foreach() or
> gtk_container_children().

The _foreach method was quite disturbing as we can see these 2  
behaviours in gtk.


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