Re: [gtkmm] List/Treestore with external data



Hi!

Hagen Möbius wrote:

 Is there a way to make the TreeStore depend on external
data? or Has anybody already implemented a derieved Store that does?


Yes. You can make your own TreeStore by "just" implementing the TreeModel interface, just as TreeStore and ListStore themselves do.

There are some limitations, though. Your TreeModel implementation must "freeze" its internal representation of the tree while the TreeView is working on it, so it won't work if your TreeModel changes as a result of "browsing" it or if it's updated by another thread or other asynchronous external events, unless you can hold back those updates until the gtkmm thread enters the "idle loop". In reality, this often means that you need to keep a copy of the tree anyway, so you might not gain anything from making your own TreeModel implementation.

--
Christer Palm




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