Intermediate children [was: Re: flow box]



On Mon, Sep 30, 2013 at 4:16 PM, Matthias Clasen <matthias clasen gmail com> wrote:
On Mon, Sep 30, 2013 at 1:53 PM, Tristan Van Berkom <tristanvb openismus com> wrote:
  o gtk_flow_box_insert() or gtk_container_add() add an intermediate
    child, breaking the logical widget hierarchy.

    For most of the history of GTK+, one can rely on the logical
    hierarchy being preserved, i.e. adding a widget to a parent will
    always pass the 'gtk_widget_get_parent (child) == parent' check.

    Honestly I would be more comfortable with a policy where only a
    specific child type can be added to the flowbox. The GtkToolBar
    and GtkMenuShell apis are clearer by limiting what types of
    children can be added, without breaking the logical widget
    hierarchy.

    In any case, I think this is worth at least a mention in
    the gtk_container_add() documentation.

This is following recent precedents - we are now automatically inserting viewports between a scrolled window and its child, and GtkListBox is automatically wrapping its children in GtkListBoxRow intermediaries.

I agree that we should add some hints about this to the the gtk_container_add docs.

This may be a bit tangential to the flow box, but especially in light of those recent precedents I think the requirement of 'gtk_widget_get_parent(child) == parent' should be relaxed... we had some discussion about this a while ago in bug 699756 [1] but I never got around to doing anything with it after that. I like Emmanuele's idea of a has_child() vfunc in that bug's discussion though.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=699756

Regards,
--
Philip


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