
// // Copyright (c) 2008, Brian Frank and Andy Frank // Licensed under the Academic Free License version 3.0 // // History: // 20 Jul 08 Brian Frank Creation // ** ** Tree displays a hierarchy of tree nodes which can be ** expanded and collapsed. ** class Tree : Widget { ** ** Callback when node is double clicked or Return/Enter key is ** pressed. The 'data' field contains the TreeModel node object. ** |Event| onAction ** ** Backing data model of tree. ** TreeModel model ** ** Update the entire tree's contents from the model. ** Void updateAll() { send(updateAllId, null) } internal static const Str updateAllId := "updateAll" } ************************************************************************** ** TreeModel ************************************************************************** ** ** TreeModel models the data of a tree widget. ** mixin TreeModel { ** ** Get root nodes. ** abstract Obj[] roots() ** ** Get the text to display for specified node. ** Default is 'node.toStr'. ** virtual Str text(Obj node) { return node.toStr } ** ** Get the image to display for specified node or null. ** virtual Image image(Obj node) { return null } ** ** Get the children of the specified node. If no ** children return null or the empty list. ** Default returns null. ** virtual Obj[] children(Obj node) { return null } }