Treemodel and treeview question.



Hello. I want to implement a custom model for my data in a treeview.

The data is in the backend, so it does not use gtkmm itself.

Is it possible to use my data, namely, my store, which does not derive from
any of the gtkmm classes, and to show it in a treeview without
inheriting my class
from Gtk::TreeModel.

I googled and I know there is a way to store pointers to data in a
ListStore, so I could use liststore
to show my backend data in the treeview. But I don't want to store
that data in the liststore. Instead,
I want to store references or pointers in the Liststore and show them
in the treeview. In order
to do this, I must implement some virtual functions, but there is
little documentation about
that.

I looked at the documentation and found cell_data_vfunc and some more
functions I think
that I should implement, but don't know how to do it very well.

Could anyone help me with some hints about how to do this exactly? I
mean, for example,
if I have a:

std::vector<MyClass> my_objects;

use a ListStore which refers to instances of that container with
MyClass * pointers stored in the ListStore. This
way I can have my data separated from the GUI.

Thanks in advance.


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