示例#1
0
        public void Update()
        {
            var flag = swig.TreeNodeFlags.OpenOnArrow | swig.TreeNodeFlags.OpenOnDoubleClick | swig.TreeNodeFlags.DefaultOpen;

            if (Core.SelectedNode == this.Node)
            {
                flag = flag | swig.TreeNodeFlags.Selected;
            }

            if (this.Node.Children.Count == 0)
            {
                flag = flag | swig.TreeNodeFlags.Leaf;
            }

            UpdateDDTarget(false);

            if (isExpanding)
            {
                Manager.NativeManager.SetNextTreeNodeOpen(true);
                isExpanding = false;
            }

            // Tree
            var temp = new[] { false };

            var iconString = "NodeEmpty";
            var node       = Node as Data.Node;

            if (node != null)
            {
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                {
                    iconString = "NodeSprite";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                {
                    iconString = "NodeRing";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                {
                    iconString = "NodeRibbon";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Model)
                {
                    iconString = "NodeModel";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Track)
                {
                    iconString = "NodeTrack";
                }
            }

            if (Manager.NativeManager.TreeNodeEx(Node.Name + id, temp, Images.GetIcon(iconString), flag))
            {
                if (Manager.NativeManager.IsItemClicked(0) ||
                    Manager.NativeManager.IsItemClicked(1))
                {
                    Core.SelectedNode = this.Node;
                }

                treeView.Popup();

                // D&D Source
                if (Manager.NativeManager.BeginDragDropSource())
                {
                    byte[] idBuf = BitConverter.GetBytes(UniqueID);
                    if (Manager.NativeManager.SetDragDropPayload(treeView.treePyloadName, idBuf, idBuf.Length))
                    {
                    }
                    Manager.NativeManager.Text(this.Node.Name);

                    Manager.NativeManager.EndDragDropSource();
                }

                Manager.NativeManager.NextColumn();

                var visible = Node.IsRendered;

                if (Manager.NativeManager.ImageButton(Images.GetIcon(visible ? "VisibleShow" : "VisibleHide"), 16, 16))
                {
                    int LEFT_SHIFT  = 340;
                    int RIGHT_SHIFT = 344;

                    if (Manager.NativeManager.IsKeyDown(LEFT_SHIFT) || Manager.NativeManager.IsKeyDown(RIGHT_SHIFT))
                    {
                        ChangeVisible(true, !visible);
                    }
                    else
                    {
                        ChangeVisible(false, !visible);
                    }
                }

                Manager.NativeManager.NextColumn();

                Children.Lock();

                foreach (var child in Children.Internal)
                {
                    child.Update();
                }

                Children.Unlock();

                if (Children.Count != 0)
                {
                    Children.Internal.Last().UpdateDDTarget(true);
                }

                Manager.NativeManager.TreePop();
            }
            else
            {
                //UpdateDDTarget(true);

                treeView.Popup();

                Manager.NativeManager.NextColumn();

                Manager.NativeManager.Checkbox("##Check", temp);

                Manager.NativeManager.NextColumn();
            }
        }
示例#2
0
        public void Update()
        {
            var flag = swig.TreeNodeFlags.OpenOnArrow | swig.TreeNodeFlags.OpenOnDoubleClick | swig.TreeNodeFlags.DefaultOpen;

            if (Core.SelectedNode == this.Node)
            {
                flag = flag | swig.TreeNodeFlags.Selected;
            }

            if (this.Node.Children.Count == 0)
            {
                flag = flag | swig.TreeNodeFlags.Leaf;
            }

            UpdateDDTarget(false);

            if (requiredToExpand)
            {
                Manager.NativeManager.SetNextTreeNodeOpen(true);
                requiredToExpand = false;
            }

            // Tree
            var temp = new[] { false };

            var iconString = "NodeEmpty";
            var node       = Node as Data.Node;

            if (node != null)
            {
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                {
                    iconString = "NodeSprite";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                {
                    iconString = "NodeRing";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                {
                    iconString = "NodeRibbon";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Model)
                {
                    iconString = "NodeModel";
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Track)
                {
                    iconString = "NodeTrack";
                }
            }

            // Change background color
            if (TreeNodeIndex % 2 == 1)
            {
                Manager.NativeManager.DrawLineBackground(Manager.NativeManager.GetTextLineHeight(), 0x0cffffff);
            }

            // Extend clickable space
            var name = Node.Name + "                                                                " + id;

            if (Manager.NativeManager.TreeNodeEx(name, temp, Images.GetIcon(iconString), flag))
            {
                IsExpanding = true;

                SelectNodeIfClicked();

                treeView.Popup();

                // D&D Source
                if (Manager.NativeManager.BeginDragDropSource())
                {
                    byte[] idBuf = BitConverter.GetBytes(UniqueID);
                    if (Manager.NativeManager.SetDragDropPayload(treeView.treePyloadName, idBuf, idBuf.Length))
                    {
                    }
                    Manager.NativeManager.Text(this.Node.Name);

                    Manager.NativeManager.EndDragDropSource();
                }

                Manager.NativeManager.NextColumn();

                UpdateVisibleButton();

                Manager.NativeManager.NextColumn();

                Children.Lock();

                foreach (var child in Children.Internal)
                {
                    child.Update();
                }

                Children.Unlock();

                if (Children.Count != 0)
                {
                    Children.Internal.Last().UpdateDDTarget(true);
                }

                Manager.NativeManager.TreePop();
            }
            else
            {
                IsExpanding = false;

                SelectNodeIfClicked();

                //UpdateDDTarget(true);

                treeView.Popup();

                Manager.NativeManager.NextColumn();

                UpdateVisibleButton();

                Manager.NativeManager.NextColumn();
            }
        }
示例#3
0
        public void Update()
        {
            var flag = swig.TreeNodeFlags.OpenOnArrow | swig.TreeNodeFlags.OpenOnDoubleClick | swig.TreeNodeFlags.DefaultOpen | swig.TreeNodeFlags.SpanFullWidth;

            if (Core.SelectedNode == this.Node)
            {
                flag = flag | swig.TreeNodeFlags.Selected;
            }

            if (this.Node.Children.Count == 0)
            {
                flag = flag | swig.TreeNodeFlags.Leaf;
            }

            UpdateDDTargetSeparator(false);

            if (requiredToExpand)
            {
                Manager.NativeManager.SetNextTreeNodeOpen(true);
                requiredToExpand = false;
            }

            var icon = Icons.NodeTypeEmpty;
            var node = Node as Data.Node;

            if (node != null)
            {
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Sprite)
                {
                    icon = Icons.NodeTypeSprite;
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ring)
                {
                    icon = Icons.NodeTypeRing;
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Ribbon)
                {
                    icon = Icons.NodeTypeRibbon;
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Model)
                {
                    icon = Icons.NodeTypeModel;
                }
                if (node.DrawingValues.Type.Value == Data.RendererValues.ParamaterType.Track)
                {
                    icon = Icons.NodeTypeTrack;
                }
            }

            // Change background color
            if (TreeNodeIndex % 2 == 1)
            {
                Manager.NativeManager.DrawLineBackground(Manager.NativeManager.GetTextLineHeight(), 0x0cffffff);
            }

            // Extend clickable space
            var label = icon + " " + Node.Name + id;

            IsExpanding = Manager.NativeManager.TreeNodeEx(label, flag);

            SelectNodeIfClicked();

            treeView.Popup();

            // D&D Source
            if (Manager.NativeManager.BeginDragDropSource())
            {
                byte[] idBuf = BitConverter.GetBytes(UniqueID);
                if (Manager.NativeManager.SetDragDropPayload(treeView.treePyloadName, idBuf, idBuf.Length))
                {
                }
                Manager.NativeManager.Text(this.Node.Name);

                Manager.NativeManager.EndDragDropSource();
            }

            UpdateDDTargetNode();

            Manager.NativeManager.NextColumn();

            UpdateVisibleButton();

            Manager.NativeManager.NextColumn();

            if (IsExpanding)
            {
                Children.Lock();

                foreach (var child in Children.Internal)
                {
                    child.Update();
                }

                Children.Unlock();

                if (Children.Count != 0)
                {
                    Children.Internal.Last().UpdateDDTargetSeparator(true);
                }

                // pair with TreeNodeEx
                Manager.NativeManager.TreePop();
            }
        }