Re: custom treemodel?



On 5/19/06, Paul Davis <paul linuxaudiosystems com> wrote:
the one thing that is a little unfortunate about a custom treemodel
based on Gtk/Glib objects is that if you are strict about
Model/View/Controller programming to the extent that you do not allow
your Model implementation to use View-related code (e.g GTK), its not
possible to use the treemodel for your Model data stores.

for example, libardour, the "Model" for ardour, is not permitted to use
any GTK/GDK code (it used to be prohibited to even use Glib, but we've
relaxed that for now). since the View code wants to display the Model
using GTK, it would be very nice if we could just drop the Model's own
data stores into various TreeViews and have it work. But if the custom
treemodel is actually a GTK component (or gtkmm, no significant
difference for this argument), this violates the separation and it can't
be done.


Yes, this has occurred to me several times as well.  My goal of making
this generic custom model is actually to try improve exactly this
situation.  I had some functionality that produced a data store as a
STL container and wanted to display it in a treeview without actually
copying the data into a ListStore.  And I didn't want my function to
return a ListStore because I might want to turn it into a library
someday and didn't want a GTK dependency in the library.  So providing
an easy TreeModel for STL containers hopefully allows you to use the
data from your library (assuming it's in an STL container for now)
without having to do a lot of manual customizing of the treemodel.
It's not a perfect solution but it would improve the situation quite a
bit I think.
In some ways, it would be nicer if TreeModel was actually in Glib
instead of GTK+.  Then at least it would be easier for Glib-dependent
libraries to produce data in formats that are easily-displayable with
treeviews (although that format may still not be ideal if you're going
to use the data for other things besides display).

Jonner



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