Re: Glib::RefPtr

I've taken a look at this and think it's intentional and fairly clear:
  • GTK+ and gtkmm both refer to the slot as "a slot that creates widgets". i.e. creates, for the FlowBox's consumption. Not a slot that returns a reference to a widget that already existed for some other purpose.
  • GtkFlowBox does   gtk_flow_box_forall (GTK_CONTAINER (box), FALSE, (GtkCallback) gtk_widget_destroy, NULL);

So, I think your original conclusion, that the widgets must always be rebuilt, was correct.

As for the question about copying them, I'm afraid that can't work, as far as I know; relatively few GObjects maintain all their state as properties, often keeping essential info in private structs, so unless the C class provides a copy/clone method, that can't be done. Not that I think it'd help much here anyway - you'd just be copying instead of deleting/recreating.

Perhaps you can instead build all the FlowBoxes, one for each model, then just show the one that's currently relevant. e.g. using Gtk::Stack

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