This example shows how to use the Ext.tree.Panel class with a GeoExt.data.store.LayersTree and shows two methods how to include legends for every treenode.
Ext.tree.Panel
GeoExt.data.store.LayersTree
Have a look at tree-legend-simple.js to see how this is done.