FairyGUI.TreeView.CreateCell C# (CSharp) Method

CreateCell() public method

public CreateCell ( FairyGUI.TreeNode node ) : void
node FairyGUI.TreeNode
return void
        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);
        }