Different TreeCellDataFunc for one column

View: New views
1 Messages — Rating Filter:   Alert me  

Different TreeCellDataFunc for one column

by Steven1234 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I would like to populate a treestore with two different types of objects, which both require a different renderer function (TreeCellDataFunc). The problem lies in that it seems that the tree structure display is only possible in one column and I can only use a single renderer for one column. Hence I would like to fill the model as follows

TreeIter iter = treeStore.AppendValues(ObjectA);

treeStore.AppendValues(iter, ObjectB);

And use the following renders

private void RenderObjectA(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)

{

ObjectA objectA = (ObjectA) model.GetValue(iter, 0);

(cell as CellRendererText).Text = ObjectA.name;

}

private void RenderObjectB(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)

{

ObjectB objectB = (ObjectB) model.GetValue(iter, 0);

(cell as CellRendererText).Text = ObjectB.name;

}

Is this possible at all? If so, could anybody show me how to define the TreeViewColumns?