Re: GtkOrientable and GtkBox

From: "Davyd Madeley", Date: 04/06/2009 10:59, Wrote:

>> I haven't tried this, but unless I am mistaken this should reverse the
>> order of children in a box. Seems easy enough to do and avoids the need
>> to introduce yet another special case in the GtkBox code. Perhaps if
>> this solution is not obvious enough, this should be turned into a
>> utility function gtk_box_reverse_children_order() ?
> For the GtkBox case, this assumes that you're not going to be making any
> calls to pack_start() or pack_end() in the future. Otherwise you end up
> with the button ordering that is not independent of your orientation.

I think gtk_box_reverse_children_order() might be a good helper to have, I've personally thus far been moderately afraid to delve into the inner structure like that. Though I think now after seeing that snippet, it does look pretty straight forward. Still, I would count it as non-obvious, though, on the grounds that if there is the question of people not understanding pack_start() and pack_end() properly, then there's definitely people who don't understand how these packing methods interact with the list of widgets in the box.

But I think GTK+ needs more model-view separation, not less. If an application puts stuff into a box, it's kinda handy if it comes back out in a predictable fashion. Having to remember and compensate for the Especially if it wants to rearrange the boxes contents, without having to iterate through the box looking for the item it wants to move. (Imagine, for example, if it were possible that a style change could cause the boxes contents to be reversed part way through that gtk_box_reverse_children_order() call... I'm pretty certain that can't happen, but I think it's an apt analogy.)


   Hit it out of the park with a new bat. Click now!
Click Here For More Information

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