Add a book/treeview/custom_treemodel example
Danny has suggested on the mailing list that a custom TreeModel example should be
added in gtkmm/demos/gtk-demo. This example shall show how to use Gtk::TreeModel and
Gtk::TreeView to show data that is stored outside the TreeModel. See
https://mail.gnome.org/archives/gtkmm-list/2019-December/msg00014.html
https://mail.gnome.org/archives/gtkmm-list/2019-December/msg00017.html
I'd prefer to have it added in a new gtkmm-documentation/examples/book/custom/custom_treemodel
directory in the gtkmm tutorial. And a description in a new section in the
Custom Widgets
chapter (which should then be renamed). All existing C++ demos
in gtkmm correspond to C demos in gtk.
The attached code is made as a gtkmm demo. It must be changed to make it a stand-alone program. It also needs several other changes. A probably incomplete list:
- Split into several files.
- No uppercase letters in method names, unless there is a good reason.
- No underscores in class names, unless there is a good reason.
- Use
override
instead ofvirtual
for overridden virtual methods. - 'Type* data' instead of 'Type *data'.
- The public bare pointer
Memory* memory
in Memory_TreeModel is bad. Should it be a private std::shared_ptr<Memory>?