Ejemplo n.º 1
0
 // ------------------
 public void SetDirtyFlag()
 {
     for (TreeViewElem elem = this; elem != null; elem = elem.parent)
     {
         elem.dirtyFlag = true;
     }
 }
Ejemplo n.º 2
0
        // -------------------
        public void AddChild(TreeViewElem elem)
        {
            if ((elem.parent != null) && (elem.parent != this))
            {
                elem.parent.RemoveChild(elem);
            }

            this.children.Add(elem);
            elem.parent = this;
        }
Ejemplo n.º 3
0
        // -------------------
        static public TreeViewElem CreateDirectoryStructure(TreeViewElem root, string fullPath,
                                                            ElemConstructor folderConstructor)
        {
            if (fullPath.IndexOf('\\') >= 0)
            {
                fullPath = fullPath.Replace('\\', '/');
            }


            int startPos = 0;
            int sepPos   = 0;

            TreeViewElem parent = root;

            for (; (startPos < fullPath.Length); startPos = (sepPos + 1))
            {
                sepPos = fullPath.IndexOf("/", startPos);
                if (sepPos == startPos)
                {
                    continue;
                }

                if (sepPos < 0)
                {
                    sepPos = fullPath.Length;
                }

                string folderName = fullPath.Substring(startPos, (sepPos - startPos));

//Debug.Log("\tCreate sub folder [" + folderName + "] of [" + path + "]");

                TreeViewElem folderElem = parent.Find(folderName);         // as FolderElem;
                if (folderElem == null)
                {
//Debug.Log("\tNOT found...");
                    folderElem = folderConstructor(root, fullPath.Substring(0, sepPos), folderName);

                    folderElem.name   = folderName;
                    folderElem.parent = parent;

                    parent.AddChild(folderElem);
                }
                else
                {
//Debug.Log("\tFOUND!");
                }


                parent = folderElem;
            }

            return(parent);
        }
Ejemplo n.º 4
0
 // ---------------------
 public void Select(TreeViewElem elem)
 {
     this.selectedElem = elem;
 }
Ejemplo n.º 5
0
 // -----------------
 public void RemoveChild(TreeViewElem elem)
 {
     this.children.Remove(elem);
 }