コード例 #1
0
        public TreePathEventArgs(TreePath path)
        {
            if (path == null)
                throw new ArgumentNullException();

            _path = path;
        }
コード例 #2
0
ファイル: TreeModel.cs プロジェクト: KillerGoldFisch/GCharp
 public Node FindNode(TreePath path)
 {
     if (path.IsEmpty())
         return _root;
     else
         return FindNode(_root, path, 0);
 }
コード例 #3
0
ファイル: TreeModel.cs プロジェクト: KillerGoldFisch/GCharp
 public System.Collections.IEnumerable GetChildren(TreePath treePath)
 {
     Node node = FindNode(treePath);
     if (node != null)
         foreach (Node n in node.Nodes)
             yield return n;
     else
         yield break;
 }
コード例 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parent">Path to a parent node</param>
        /// <param name="indices">Indices of children in parent nodes collection</param>
        /// <param name="children">Child nodes</param>
        public TreeModelEventArgs(TreePath parent, int[] indices, object[] children)
            : base(parent)
        {
            if (children == null)
                throw new ArgumentNullException();

            if (indices != null && indices.Length != children.Length)
                throw new ArgumentException("indices and children arrays must have the same length");

            _indices = indices;
            _children = children;
        }
コード例 #5
0
 public TreePathEventArgs()
 {
     _path = new TreePath();
 }
コード例 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent">Path to a parent node</param>
 /// <param name="children">Child nodes</param>
 public TreeModelEventArgs(TreePath parent, object[] children)
     : this(parent, null, children)
 {
 }
コード例 #7
0
ファイル: TreeModel.cs プロジェクト: KillerGoldFisch/GCharp
 public bool IsLeaf(TreePath treePath)
 {
     Node node = FindNode(treePath);
     if (node != null)
         return node.IsLeaf;
     else
         throw new ArgumentException("treePath");
 }
コード例 #8
0
ファイル: TreeModel.cs プロジェクト: KillerGoldFisch/GCharp
 private Node FindNode(Node root, TreePath path, int level)
 {
     foreach (Node node in root.Nodes)
         if (node == path.FullPath[level])
         {
             if (level == path.FullPath.Length - 1)
                 return node;
             else
                 return FindNode(node, path, level + 1);
         }
     return null;
 }