[Gtk-sharp-list] Databindig IList to a Gtk.TreeView
Philip Van Hoof
spam at pvanhoof.be
Fri Apr 21 11:56:14 EDT 2006
On Fri, 2006-04-21 at 15:30 +0100, Michael Hutchinson wrote:
> On 4/21/06, Philip Van Hoof <spam at pvanhoof.be> wrote:
> > Please take a look:
> >
> > https://svn.cronos.be/svn/GtkSharpMvc/trunk/
> > http://pvanhoof.be/blog/index.php/2006/04/21/databinding-an-ilist-as-datasource-for-the-gtktreeview
>
> Awesome. This definately should be part of GTK# at some point.
>
> I realise it's an early proof of concept, but I can see a couple of
> limitations with your implementation
> - with the ListAdaptor kept private, it's hard to use anything other
> than a CellRendererText, or to map/set CellRenderer attributes.
> - From what I see, it's not easily possible to insert a
> TreeModelFilter and TreeModelSort between the list adaptor TreeModel
> and the TreeView. It would be nice to have filtering, sorting
> capabilities some other way. If it had grouping too, that would really
> make my day and set it part from plain ol' GTK+ :)
Hey Mike, easy dude ;-). As you said, indeed, at this moment it's just a
prove of concept.
But I'm totally open about contributions and ideas here. If you want to
change the idea, turn it upside down and stuff like that: I'll even give
you commit access to the Subversion so that you can tryout things.
I don't know at which point I'll hit the hard limits of the C-isms of
the Gtk+ API. I don't know how easy it will be to also make it sortable
in a typical .NET fashion. I think it should already be sortable, as in
essence ListAdaptor is a very typical GtkTreeModelIface. I think it
should work, I'm just afraid of testing it :-D. I fear my computer will
start throwing its keys in my eyes because I'm tying to do crazy stuff
for which its hardware isn't designed, it thinks.
> Would it be possible to implement this a completely self-contained
> TreeModel (maybe a MappingTreemodel) without a need for a
> TreeViewAdaptor? Something that just performs mappings? Maybe even
> allow delegates for custom mappings?
Well, the Banshee dude is implementing a TreeView in C# (*). Such an
implementation could do it. If you want to use the GtkTreeView (the C
GObject type), I think the only way is to wrap the IList in an adaptor
that also implements GtkTreeModelIface (the C GTypeInterface).
* http://abock.org/~aaron/managed-list-view
> Really good work anyway; I've always been uncomfortable about having
> to use a specialised model for TreeView, even with the NodeStore.
Same here. Now you can use the view component in a typical .NET fashion.
I'm planning to test writable cells. It should work if I add some code.
It will be basically doing a pi.SetValue (instance, value, null) upon
writing. It should be as possible as reading the value (which is atm
using the pi.GetValue (instance, null) reflection stuff.
If somebody is interested: go ahead dude ;-). Improve this prove of
concept. That's why I posted it.
--
Philip Van Hoof, software developer at x-tend
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
work: vanhoof at x-tend dot be
http://www.pvanhoof.be - http://www.x-tend.be
More information about the Gtk-sharp-list
mailing list