Re: AbstractTreeModel, AbstractListModel



On Mon, Jul 16, 2001 at 04:59:08PM -0400, Jonathan Blandford wrote:
> It's not a trivial amount of work, but it's not impossible to implement
> a GtkTreeModel interface in a fairly small amount of code (especially if
> you have a good data store like you already do.)  GtkTreeStore is
> particularly long as it supports things like sorting and Drag and Drop
> reordering, both of which are somewhat dubious for an xml view.  There
> is a stupid evil wrapper class in testtreecolumns to represent columns
> as rows[*], that was written in ~350 lines of code.

	Ok, I had more of a look since I mailed.  It seems that the
drag/drop interface code could be mostly reused verbatim.  Am I right on
this?  The only thing is on a drop move, treestore does recursive_copy()
to move the child nodes.  In an XML store, that isn't required, as the
children will travel with.  I do want reordering, as I'm not 'viewing
XML', rather I'm viewing and editing a path that is represented in XML.
	I don't need (and don't want) the sortable interface.  So, if I
copied the code verbatim, then removed the sortable code and updated all
the tree_model_init functions to handle my XML tree, it should work?
	Basically, I'm trying to judge the trade off between the time
required for hacking this and the space waste and conceptual ugliness of
using gtktreestore and mirroring the XML.

> [*] do not look at this code, it might fry your brain. 

	I fried my brain a long time ago.  I'm not worried :-)

Joel

-- 

Life's Little Instruction Book #3

	"Watch a sunrise at least once a year."

			http://www.jlbec.org/
			jlbec evilplan org




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