View previous topic :: View next topic |
Author |
Message |
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Sat Oct 18, 2008 7:41 pm Post subject: Help treeModel |
|
|
I have a TreeStore that implements TreeModelIF and mixes in TreeModelT.
When is the gtk struct of TreeModelT created?
Do I need to explicitly do that?
(some of the my trees work, some don't...)
thanks,
Ant |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Sat Oct 18, 2008 9:34 pm Post subject: Re: Help treeModel |
|
|
Ant wrote: | I have a TreeStore that implements TreeModelIF and mixes in TreeModelT.
When is the gtk struct of TreeModelT created?
Do I need to explicitly do that?
(some of the my trees work, some don't...)
thanks,
Ant |
ok, I added
this.gtkTreeModel = cast(GtkTreeModel*)gtkTreeStore;
on the TreeStore constructor
public this (GtkTreeStore* gtkTreeStore)
and seems to do the trick.
I'll check if my local GtkD is sane to commit. later.
EDIT: there is not ctor on the Gtk lookup for TreeStore.
I'll let you guys review this change and commit it.
Ant
PS it's funny, I'm on a remote X session over ssh to my machine and leds works better here?!...
here is ubuntu 8.04 and my machine is 8.10 probably different gtk libs... |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Sun Oct 19, 2008 7:59 am Post subject: |
|
|
It's true gtkTreemodelStruct in gtk.TreeModelT is never set, but it's also never used. all access to the struct in gtk.TreeModelT go's trough getTreeModelTStruct()/getStruct witch return the struct of the class that implements the TreeModel interface. I think casting the Struct of the class that implements the interface to the type of the interface is the correct behavior.
On the C side GtkTreeModel is a dummy typedef to allow casting a struct that implements the TreeModel interface to a GtkTreeModel.
Quote: | PS it's funny, I'm on a remote X session over ssh to my machine and leds works better here?!...
here is ubuntu 8.04 and my machine is 8.10 probably different gtk libs... |
|
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Sun Oct 19, 2008 8:56 am Post subject: |
|
|
Mike Wey wrote: | It's true gtkTreemodelStruct in gtk.TreeModelT is never set, but it's also never used. |
getIter(TreeIter, TreePath) is mixed in from the TreeModelT into TreeStore and uses the struct from TreeModelT.
But seems to be the only method that uses the local struct gtkTreeModel.
Can it be an error? all other methods use getTreeModelTStruct() that get the struct from the context where is was mixed in - in this case the TreeStore.
maybe the solution is to make getIter() to use the getTreeModelTStruct
testing ... yes it does fix it.
I cheked the GtkLookup. the TreeModelT.getIter(TreeIter, TreePath) is defined there using the local struct, seems to be a simple fix.
fixed at rev 633
Ant |
|
Back to top |
|
|
eldar
Joined: 14 Jun 2008 Posts: 101 Location: Ufa, Russia
|
Posted: Sat Nov 01, 2008 1:58 pm Post subject: |
|
|
I will soon prepare and upload demo for Custom TreeModel. Because demo which comes with gtkD uses C-style structures and pointers and is list model. I modified it for using with classes and also extended it to be Tree Capable. |
|
Back to top |
|
|
|