[Gtk-sharp-list] Leaving the Gtk# project
Christian Hoff
christian_hoff at gmx.net
Thu Oct 1 01:54:03 EDT 2009
Daniel Morgan wrote:
> "the IList/DataView tree model won't make it into Gtk# as
> a clean implementation can only be done by using extension methods"
>
> Why would this not be clean?
>
> Is it because you do not want to depend on System.Data?
>
> Try using descriptors from System.ComponentModel like ASP.NET does for its controls.
>
That's what the new TreeModel is doing already; you pointed me to the
ComponentModel interfaces in a mail your wrote to the list about a year ago.
There are basically four ways to implement such an "IListStore" in Gtk#:
1. Extend ListStore to implement IList. The disadvantage here is that
this is only useful if the list is created inside your program. When
getting an IList back from the .net framework methods, this approach
would be useless.
2. Add a ctor and something like an "IList" property to TreeView,
ComboBox, ... and keep the model internal. This would be more
use-friendly than exposing the model, but it would mean adding new
members to each tree-model based widget. Custom or 3rd party widgets
would not be able to use this capability.
3. Same as 2., but no ctor and "IList GetItems"/"SetItems (IList)"
extension methods instead of the IList prop. The extension methods could
reside in Gtk.Dotnet. This means that we can seperate the code better,
but extension methods are a .net 3.5 feature and we do not plan to make
Gtk.DotNet depend on .net 3.5.
4. Expose the new TreeModel and add it to Gtk.Dotnet. Unfortunately, the
user would have to know GInterface implementation: new TreeView (new
TreeModelAdapter (new IListStore (my_list)));
Not really user friendly, but I'm starting to like this idea more and
more. If we document this explicitly, this should not be a hurdle that
is too difficult to take. Would also be useful for 3rd party widgets.
By now I planned to implement approach 3 in a 3rd party project, but now
I consider integrating it into Gtk# via approach 4 or 2.
Another issue(besides the difficulties diescribed above) is that Mike
doesn't think that the community is too interested in such a capability.
But every time I see a ListStore being populated with data from a
DataView, I'm starting to think otherwise. So if you need such a
feature, please reply ;-) .
Christian
More information about the Gtk-sharp-list
mailing list