I’m using a Gkt::DropDown widget to switch between pages in a Stack, because I have too many items for a StackSwitcher to be appropriate. My current solution is very ugly, but I think a shared Gtk::SelectionModel would let me do things in a much cleaner, more flexible way. I want to create a “StackView” which uses a ListItemFactory to create all the widgets that it switches between. The StackView and the DropDown could then share the same underlying list model, but use their own ListItemFactories to produce appropriate views of the items. When the DropDown changes the selected item in the SelectionModel, the StackView can change which page is showing.
In order to have an accurate size request, the StackView will need to create and bind widgets for all items in the list model immediately (rather than when the widgets become visible, like a conventional ListView). This means that it won’t be necessary to un-bind widgets.
I would like to implement the StackView in a way which is compatible with existing ListItemFactory implementations, but I’ve noticed the factory type doesn’t provide public methods for requesting & binding new widgets. My backup plan is to create my own widget factory type, with a simpler interface that binds widgets on construction. Is there any official way to create custom ListView-like widgets in C++?