Re: TreeModel and TreeView



В Пнд, 29/01/2007 в 03:44 -0800, Trigve Siver пишет:
> Thanks for reply, Paul
>  
> ... I think that only soultion is with custom TreeModel but if it can
> be done with some default TreeModel implementation please could you
> point to some source ...I would be grateful.
> 
>  

There was some offer to implement custom TreeModel and add it to GTKMM
library (Jonathon Jongsma <jonathon jongsma gmail com>).

This link supposed to have some source codes (I haven't looked into):

http://download.gna.org/colorscheme/etc/customtreemodel-0.0.1.tar.gz

Murray C. was going to bring it on when all checks done, but I don't
know if someone was trying to use it at all.

I have my own implementation of CustomTreeModel based on
gtkmm/examples. 

Tough I should say that gtkmm example code couldn't be used directly in
any real application, because of missing some importand behavior and
virtual function implementations.

I would recommend you to use separate thread to open DB connection and
load data, and just notify model that it's content changed. I've used
Glib::Dispatcher.

The main problem of ListStore - it is very slow at adding lot of
multicoulm rows, so, that's the reason I have to build my own model.

Also, I've used custom cellrenderer to optimize drawing only for my own
needs.

The way you may use gtkmm/example:

- use it as helper;

- think of your iterator handling implementation, there you should have
datarow IDX in sole concordance with Gtk::TreePath (it is very simple
for ListStore and a bit complicated for TreeStore);

- look at doc files and reimplement all virtual functions of
Gtk::TreeModel class where you see: "Override and implement this in a
derived TreeModel class";

- if you need sorting you should derive and reimplement from
TreeModelSortable as well.

Regards,
-andrew





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