Hello, I got a bunch of questions connected with TreeView, making data viewable via TreeView and some design issues.
Firstly, I'll state a problem. I would like to have a collection of Foo objects. They have their methods, store some data. I want the collection to supply me, besides collection interface, some methods to call on stored data. I also want to expose objects stored in the collection to user, allow they to modify them, add, delete and reorder. Obvious idea is to use TreeView, but I met some serious problems. First, how to make Foo objects viewable? Deriving from Gtk::TreeModelColumnRecord leads me to nowhere, since then I have no access to data stored inside Foo, Gtk::TreeModelColumn<T> seems to be just a meta-data for a model to create View and Store. More clearly, I want to e.g. have object representing triple on plain (int, int, int), and got some methods like symmetry along a given line etc. Implemeting it inside TreeModelColumnRecord is impossible - no access to stored data. Making a class Foo that got 3 private ints leads me to no idea how to make this object viewable through view. Ideally, I look for something like as follows: I have a Store that has Foo objects. Then to a View I add columns like (x), (y), (z), corresponding to example above, and specify accessors methods inside Foo object, so that View can correctly save and show data to/from a Foo. One more problem connected with deriving from Gtk::TreeModelColumnRecord is that in my opinion it brakes OOP rule: its not Foo business to take care of being viewable, it exposes methods to modify itself and get stored data, but how it is done is just a matter of somebody writing class responsible for showing data to a user. Also storing everything in one place: data and display issues, is making code messy. I suppose that deriving my collection from ListStore or TreeStore will solve a problem of adding some methods to call on stored data. So far, after investigating materials I've found and after some talks on IRC channel the only idea I have is to keep data in two places and try to sync them, but it seems to be a pain in the neck, it also makes my memory usage twice as more... so its not a solution at all. I would appreciate any help with this problem, I am not looking for easy solutions, rather elegant. If elegant solution does not exist, then please point me the least awful way to do what I want. Looking forward to hearing from you, Regards, Adrian
_______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
