示例#1
0
 public void Call(FairyGUI.TreeNode param0)
 {
     func.BeginPCall();
     func.PushObject(param0);
     func.PCall();
     func.EndPCall();
 }
示例#2
0
 public FairyGUI.GComponent Call(FairyGUI.TreeNode param0)
 {
     func.BeginPCall();
     func.PushObject(param0);
     func.PCall();
     FairyGUI.GComponent ret = (FairyGUI.GComponent)func.CheckObject(typeof(FairyGUI.GComponent));
     func.EndPCall();
     return(ret);
 }
示例#3
0
 public void CallWithSelf(FairyGUI.TreeNode param0, bool param1)
 {
     func.BeginPCall();
     func.Push(self);
     func.PushObject(param0);
     func.Push(param1);
     func.PCall();
     func.EndPCall();
 }
示例#4
0
 static public int get_numChildren(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.numChildren);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#5
0
 static public int GetNextSibling(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         var ret = self.GetNextSibling();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#6
0
 static public int set_data(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         System.Object     v;
         checkType(l, 2, out v);
         self.data = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#7
0
 static public int set_expanded(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.expanded = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public TreeView(GList list)
        {
            this.list = list;
            list.onClickItem.Add(__clickItem);
            list.RemoveChildrenToPool();

            root = new TreeNode(true);
            root.SetTree(this);
            root.cell = list;
            root.expanded = true;

            indent = 30;

            onClickNode = new EventListener(this, "onClickNode");
        }
示例#9
0
 static public int AddChild(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         FairyGUI.TreeNode a1;
         checkType(l, 2, out a1);
         var ret = self.AddChild(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#10
0
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.TreeNode o;
         System.Boolean    a1;
         checkType(l, 2, out a1);
         o = new FairyGUI.TreeNode(a1);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#11
0
 static int GetSelectedNode(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         FairyGUI.TreeView obj = (FairyGUI.TreeView)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeView));
         FairyGUI.TreeNode o   = obj.GetSelectedNode();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#12
0
 static public int RemoveChildAt(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         System.Int32      a1;
         checkType(l, 2, out a1);
         var ret = self.RemoveChildAt(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#13
0
 static int CollapseAll(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.TreeView obj  = (FairyGUI.TreeView)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeView));
         FairyGUI.TreeNode arg0 = (FairyGUI.TreeNode)ToLua.CheckObject(L, 2, typeof(FairyGUI.TreeNode));
         obj.CollapseAll(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#14
0
 static int GetChildAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.TreeNode obj = (FairyGUI.TreeNode)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeNode));
         int arg0            = (int)LuaDLL.luaL_checknumber(L, 2);
         FairyGUI.TreeNode o = obj.GetChildAt(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#15
0
 static int GetNodeIndex(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.TreeView obj  = (FairyGUI.TreeView)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeView));
         FairyGUI.TreeNode arg0 = (FairyGUI.TreeNode)ToLua.CheckObject(L, 2, typeof(FairyGUI.TreeNode));
         int o = obj.GetNodeIndex(arg0);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#16
0
 static int RemoveChild(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.TreeNode obj  = (FairyGUI.TreeNode)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeNode));
         FairyGUI.TreeNode arg0 = (FairyGUI.TreeNode)ToLua.CheckObject(L, 2, typeof(FairyGUI.TreeNode));
         FairyGUI.TreeNode o    = obj.RemoveChild(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#17
0
 static int SwapChildrenAt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.TreeNode obj = (FairyGUI.TreeNode)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeNode));
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         int arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.SwapChildrenAt(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#18
0
 static public int SwapChildrenAt(IntPtr l)
 {
     try {
         FairyGUI.TreeNode self = (FairyGUI.TreeNode)checkSelf(l);
         System.Int32      a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.SwapChildrenAt(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#19
0
 static int AddSelection(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.TreeView obj  = (FairyGUI.TreeView)ToLua.CheckObject(L, 1, typeof(FairyGUI.TreeView));
         FairyGUI.TreeNode arg0 = (FairyGUI.TreeNode)ToLua.CheckObject(L, 2, typeof(FairyGUI.TreeNode));
         bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.AddSelection(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#20
0
    static int set_expanded(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode obj = (FairyGUI.TreeNode)o;
            bool arg0             = LuaDLL.luaL_checkboolean(L, 2);
            obj.expanded = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index expanded on a nil value" : e.Message));
        }
    }
示例#21
0
    static int get_isFolder(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode obj = (FairyGUI.TreeNode)o;
            bool ret = obj.isFolder;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index isFolder on a nil value" : e.Message));
        }
    }
示例#22
0
    static int get_cell(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode   obj = (FairyGUI.TreeNode)o;
            FairyGUI.GComponent ret = obj.cell;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index cell on a nil value" : e.Message));
        }
    }
示例#23
0
    static int set_data(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode obj  = (FairyGUI.TreeNode)o;
            object            arg0 = ToLua.ToVarObject(L, 2);
            obj.data = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index data on a nil value" : e.Message));
        }
    }
示例#24
0
    static int get_numChildren(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode obj = (FairyGUI.TreeNode)o;
            int ret = obj.numChildren;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index numChildren on a nil value" : e.Message));
        }
    }
示例#25
0
    static int get_root(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeView obj = (FairyGUI.TreeView)o;
            FairyGUI.TreeNode ret = obj.root;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index root on a nil value" : e.Message));
        }
    }
示例#26
0
    static int get_text(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            FairyGUI.TreeNode obj = (FairyGUI.TreeNode)o;
            string            ret = obj.text;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index text on a nil value" : e.Message));
        }
    }
示例#27
0
    static int _CreateFairyGUI_TreeNode(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                bool arg0             = LuaDLL.luaL_checkboolean(L, 1);
                FairyGUI.TreeNode obj = new FairyGUI.TreeNode(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: FairyGUI.TreeNode.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#28
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        public void UpdateNode(TreeNode node)
        {
            if (node.cell == null)
                return;

            if (treeNodeRender != null)
                treeNodeRender(node);
        }
示例#29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="folderNode"></param>
 public void ExpandAll(TreeNode folderNode)
 {
     folderNode.expanded = true;
     int cnt = folderNode.numChildren;
     for (int i = 0; i < cnt; i++)
     {
         TreeNode node = folderNode.GetChildAt(i);
         if (node.isFolder)
             ExpandAll(node);
     }
 }
示例#30
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        void CreateCell(TreeNode node)
        {
            if (treeNodeCreateCell != null)
                node.cell = treeNodeCreateCell(node);
            else
                node.cell = list.itemPool.GetObject(list.defaultItem) as GComponent;
            if (node.cell == null)
                throw new Exception("Unable to create tree cell");
            node.cell.data = node;

            GObject indentObj = node.cell.GetChild("indent");
            if (indentObj != null)
                indentObj.width = (node.level - 1) * indent;

            GButton expandButton = (GButton)node.cell.GetChild("expandButton");
            if (expandButton != null)
            {
                if (node.isFolder)
                {
                    expandButton.visible = true;
                    expandButton.onClick.Add(__clickExpandButton);
                    expandButton.data = node;
                    expandButton.selected = node.expanded;
                }
                else
                    expandButton.visible = false;
            }

            if (treeNodeRender != null)
                treeNodeRender(node);
        }
示例#31
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        int GetInsertIndexForNode(TreeNode node)
        {
            TreeNode prevNode = node.GetPrevSibling();
            if (prevNode == null)
                prevNode = node.parent;
            int insertIndex = list.GetChildIndex(prevNode.cell) + 1;
            int myLevel = node.level;
            int cnt = list.numChildren;
            for (int i = insertIndex; i < cnt; i++)
            {
                TreeNode testNode = (TreeNode)list.GetChildAt(i).data;
                if (testNode.level <= myLevel)
                    break;

                insertIndex++;
            }

            return insertIndex;
        }
示例#32
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        internal void AfterCollapsed(TreeNode node)
        {
            if (node != root && treeNodeWillExpand != null)
                treeNodeWillExpand(node, false);

            if (node.cell == null)
                return;

            if (node != root)
            {
                if (treeNodeRender != null)
                    treeNodeRender(node);

                GButton expandButton = (GButton)node.cell.GetChild("expandButton");
                if (expandButton != null)
                    expandButton.selected = false;
            }

            if (node.cell.parent != null)
                HideFolderNode(node);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="child"></param>
        /// <param name="index"></param>
        public void SetChildIndex(TreeNode child, int index)
        {
            int oldIndex = _children.IndexOf(child);
            if (oldIndex == -1)
                throw new Exception("Not a child of this container");

            int cnt = _children.Count;
            if (index < 0)
                index = 0;
            else if (index > cnt)
                index = cnt;

            if (oldIndex == index)
                return;

            _children.RemoveAt(oldIndex);
            _children.Insert(index, child);
            if (this.cell != null && this.cell.parent != null && _expanded)
                tree.AfterMoved(child);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="child1"></param>
 /// <param name="child2"></param>
 public void SwapChildren(TreeNode child1, TreeNode child2)
 {
     int index1 = _children.IndexOf(child1);
     int index2 = _children.IndexOf(child2);
     if (index1 == -1 || index2 == -1)
         throw new Exception("Not a child of this container");
     SwapChildrenAt(index1, index2);
 }
示例#35
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="folderNode"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        int CheckChildren(TreeNode folderNode, int index)
        {
            int cnt = folderNode.numChildren;
            for (int i = 0; i < cnt; i++)
            {
                index++;
                TreeNode node = folderNode.GetChildAt(i);
                if (node.cell == null)
                    CreateCell(node);

                if (node.cell.parent == null)
                    list.AddChildAt(node.cell, index);

                if (node.isFolder && node.expanded)
                    index = CheckChildren(node, index);
            }

            return index;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public TreeNode RemoveChild(TreeNode child)
 {
     int childIndex = _children.IndexOf(child);
     if (childIndex != -1)
     {
         RemoveChildAt(childIndex);
     }
     return child;
 }
示例#37
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 /// <param name="scrollItToView"></param>
 public void AddSelection(TreeNode node, bool scrollItToView = false)
 {
     TreeNode parentNode = node.parent;
     while (parentNode != null && parentNode != root)
     {
         parentNode.expanded = true;
         parentNode = parentNode.parent;
     }
     list.AddSelection(list.GetChildIndex(node.cell), scrollItToView);
 }
示例#38
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        internal void AfterMoved(TreeNode node)
        {
            if (!node.isFolder)
                list.RemoveChild(node.cell);
            else
                HideFolderNode(node);

            int index = GetInsertIndexForNode(node);
            list.AddChildAt(node.cell, index);

            if (node.isFolder && node.expanded)
                CheckChildren(node, index);
        }
示例#39
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="folderNode"></param>
 void HideFolderNode(TreeNode folderNode)
 {
     int cnt = folderNode.numChildren;
     for (int i = 0; i < cnt; i++)
     {
         TreeNode node = folderNode.GetChildAt(i);
         if (node.cell != null)
         {
             if(node.cell.parent != null)
                 list.RemoveChild(node.cell);
             list.itemPool.ReturnObject(node.cell);
             node.cell.data = null;
             node.cell = null;
         }
         if (node.isFolder && node.expanded)
             HideFolderNode(node);
     }
 }
示例#40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public int GetNodeIndex(TreeNode node)
 {
     return list.GetChildIndex(node.cell);
 }
示例#41
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        void RemoveNode(TreeNode node)
        {
            if (node.cell != null)
            {
                if (node.cell.parent != null)
                    list.RemoveChild(node.cell);
                list.itemPool.ReturnObject(node.cell);
                node.cell.data = null;
                node.cell = null;
            }

            if (node.isFolder)
            {
                int cnt = node.numChildren;
                for (int i = 0; i < cnt; i++)
                {
                    TreeNode node2 = node.GetChildAt(i);
                    RemoveNode(node2);
                }
            }
        }
示例#42
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        internal void AfterExpanded(TreeNode node)
        {
            if (node != root && treeNodeWillExpand != null)
                treeNodeWillExpand(node, true);

            if (node.cell == null)
                return;

            if (node != root)
            {
                if (treeNodeRender != null)
                    treeNodeRender(node);

                GButton expandButton = (GButton)node.cell.GetChild("expandButton");
                if (expandButton != null)
                    expandButton.selected = true;
            }

            if (node.cell.parent != null)
                CheckChildren(node, list.GetChildIndex(node.cell));
        }
示例#43
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="node"></param>
        internal void AfterInserted(TreeNode node)
        {
            CreateCell(node);

            int index = GetInsertIndexForNode(node);
            list.AddChildAt(node.cell, index);
            if (treeNodeRender != null)
                treeNodeRender(node);

            if (node.isFolder && node.expanded)
                CheckChildren(node, index);
        }
示例#44
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="folderNode"></param>
 public void CollapseAll(TreeNode folderNode)
 {
     if (folderNode != root)
         folderNode.expanded = false;
     int cnt = folderNode.numChildren;
     for (int i = 0; i < cnt; i++)
     {
         TreeNode node = folderNode.GetChildAt(i);
         if (node.isFolder)
             CollapseAll(node);
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public TreeNode AddChild(TreeNode child)
 {
     AddChildAt(child, _children.Count);
     return child;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="child"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public TreeNode AddChildAt(TreeNode child, int index)
        {
            if (child == null)
                throw new Exception("child is null");

            int numChildren = _children.Count;

            if (index >= 0 && index <= numChildren)
            {
                if (child.parent == this)
                {
                    SetChildIndex(child, index);
                }
                else
                {
                    if (child.parent != null)
                        child.parent.RemoveChild(child);

                    int cnt = _children.Count;
                    if (index == cnt)
                        _children.Add(child);
                    else
                        _children.Insert(index, child);

                    child.parent = this;
                    child.level = this.level + 1;
                    child.SetTree(this.tree);
                    if (this.cell != null && this.cell.parent != null && _expanded)
                        tree.AfterInserted(child);
                }

                return child;
            }
            else
            {
                throw new Exception("Invalid child index");
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="child"></param>
 /// <returns></returns>
 public int GetChildIndex(TreeNode child)
 {
     return _children.IndexOf(child);
 }
示例#48
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 public void RemoveSelection(TreeNode node)
 {
     list.RemoveSelection(list.GetChildIndex(node.cell));
 }
示例#49
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="node"></param>
 internal void AfterRemoved(TreeNode node)
 {
     RemoveNode(node);
 }