FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help treeModel

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sat Oct 18, 2008 7:41 pm    Post subject: Help treeModel Reply with quote

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
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sat Oct 18, 2008 9:34 pm    Post subject: Re: Help treeModel Reply with quote

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
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Sun Oct 19, 2008 7:59 am    Post subject: Reply with quote

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...

Very Happy
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sun Oct 19, 2008 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message
eldar



Joined: 14 Jun 2008
Posts: 101
Location: Ufa, Russia

PostPosted: Sat Nov 01, 2008 1:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group