Exemplo n.º 1
0
        /// <summary>
        /// Create and configure TreeControl</summary>
        /// <param name="treeControl">New TreeControl</param>
        /// <param name="treeControlAdapter">Adapter for TreeControl</param>
        protected override void Configure(out TreeControl treeControl, out TreeControlAdapter treeControlAdapter)
        {
            base.Configure(out treeControl, out treeControlAdapter);

            m_control      = new UserControl();
            m_control.Dock = DockStyle.Fill;
            m_control.SuspendLayout();
            m_control.Name = "Tree View".Localize();
            m_control.Text = "Tree View".Localize();


            // create tag panel
            m_TagPanel                   = new TagLabelListControl();
            m_TagPanel.Dock              = DockStyle.Top;
            m_TagPanel.OnTagListUpdated += UpdateFiltering;
            m_control.Controls.Add(m_TagPanel);

            m_TagInput = new StringTagSearchInputUI(m_TagPanel);
            m_control.Controls.Add(m_TagInput);

            m_control.Controls.Add(TreeControl);
            m_control.Layout += controls_Layout;
            m_control.ResumeLayout();

            TreeControl.PreviewKeyDown       += TreeControl_PreviewKeyDown;
            TreeControl.NodeExpandedChanging += TreeControl_NodeExpandedChanging;
            TreeControl.NodeExpandedChanged  += TreeControl_NodeExpandedChanged;
            TreeControl.ItemRendererChanged  += (sender, e) => UpdateTreeItemRenderer();
        }
Exemplo n.º 2
0
        private void Bind(ITypeDescriptorContext context, ISelectionContext selectionContext, object value, Func <object, ItemInfo, bool> getItemInfo)
        {
            splitContainer1.SuspendLayout();

            m_treeControl               = new TreeControl(TreeControl.Style.SimpleTree);
            m_treeControl.Dock          = DockStyle.Fill;
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControl.ImageList     = ResourceUtil.GetImageList16();
            m_treeControl.Location      = new Point(comboBox1.Location.X, comboBox1.Location.Y + 2 * FontHeight);
            m_treeControl.Width         = upButton.Location.X - m_treeControl.Location.X - Margin.Right - Margin.Left;
            m_treeControl.Anchor        = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            m_treeControl.Height        = splitContainer1.Panel1.Height - m_treeControl.Location.Y - (Margin.Bottom + Margin.Top);
            splitContainer1.Panel1.Controls.Add(m_treeControl);

            m_propertyGrid = new PropertyGrid();
            m_defaultContext.SelectionContext = selectionContext;
            m_propertyGrid.Bind(m_defaultContext);
            m_propertyGrid.Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(m_propertyGrid);

            splitContainer1.ResumeLayout();

            m_rootValue                            = value;
            m_collectionTreeView                   = new TreeView(context, value);
            m_collectionTreeView.GetItemInfo       = getItemInfo;
            m_treeControlAdapter                   = new TreeControlAdapter(m_treeControl);
            m_collectionTreeView.SelectionChanged += collectionTreeView_SelectionChanged;
            m_treeControl.ShowRoot                 = false;
            m_treeControlAdapter.TreeView          = m_collectionTreeView;
            m_context = context;
            UpdateAvailaibleTypes(new Path <object>(context.Instance));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize a new instance of the NodeCollection class.
        /// </summary>
        public NodeCollection(TreeControl tl)
        {
            CommonConstruct();

            // But it does have a back reference to the containing control
            Cache.TreeControl = tl;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draw an appropriate image for a node.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="n">Reference to Node instance.</param>
        /// <param name="g">Reference to Graphics instance to draw into.</param>
        /// <param name="x">Left X position for drawing indicator.</param>
        /// <param name="y">Middle Y position for drawing indicator.</param>
        public virtual void DrawIndicator(TreeControl tc, Node n, Graphics g, int x, int y)
        {
            Image image = tc.GetIndicatorImage(n.Indicator);

            g.DrawImage(image, x, y - (tc.IndicatorSize.Height / 2));
            image.Dispose();
        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            Console.WriteLine(Environment.CurrentDirectory);
            base.Initialize();
            tree = new  Gwen.Control.TreeControl(panel);

            tree.SetSize(panel.Width, panel.Height);
            tree.ShouldDrawBackground = false;

            var type       = typeof(Pipeline);
            var subclasses = type.Assembly.GetTypes().Where(t => t.IsSubclassOf(type));

            foreach (var subclass in subclasses)
            {
                subclass.GetCustomAttributes(false);
            }
            MeshPipeline.SetMeshContext <ushort, BasicVertexFormat> ();
            RecursiveBuildTree(root, tree);
            foreach (FileInfo file in FilterFiles(root, SupportedFileFormatsAttribute.importers.Keys))
            {
                if (!file.Name.StartsWith(".") && SupportedFileFormatsAttribute.importers.ContainsKey(file.Extension))
                {
                    tree.AddNode(() => SupportedFileFormatsAttribute.importers [file.Extension].Import(file.FullName));
                }
            }

            tree.Show();
            tree.Selected += OnSelected;
        }
Exemplo n.º 6
0
        public ObjectAnimView(string path, Timelines.ObjectAnimTimelineDocument doc)
        {
            InitializeComponent();
            if (path != null)
            {
                Text = System.IO.Path.GetFileName(path);
            }
            else
            {
                Text = "New Object Animation".Localize();
            }
            paletteTree      = new TreeControl();
            paletteTree.Dock = DockStyle.Fill;
            subSplitter.Panel1.Controls.Add(paletteTree);

            timeline      = new Sce.Atf.Controls.Timelines.Direct2D.D2dTimelineControl(doc);
            timeline.Dock = DockStyle.Fill;
            subSplitter.Panel2.Controls.Add(timeline);
            new D2dSelectionManipulator(timeline);
            new D2dMoveManipulator(timeline);
            new D2dScaleManipulator(timeline);
            splitManipulator = new D2dSplitManipulator(timeline);
            D2dSnapManipulator     snapManipulator     = new D2dSnapManipulator(timeline);
            D2dScrubberManipulator scrubberManipulator = new D2dScrubberManipulator(timeline);

            //// Allow the snap manipulator to snap objects to the scrubber.
            snapManipulator.Scrubber = scrubberManipulator;

            Urho3D      = new UrhoBackend.UrControl("Data/Scripts/ObjectAnimEditor.as");
            Urho3D.Dock = DockStyle.Fill;
            Urho3D.SubscribeCallback(this);
            topSplitter.Panel1.Controls.Add(Urho3D);
        }
Exemplo n.º 7
0
 private void ribbon_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (e.AddedItems[0] == tab_users)
     {
         if (iAddDeleteUser == null)
         {
             UsersControl userControl = new UsersControl();
             iAddDeleteUser = userControl;
             grid_content.Children.Clear();
             grid_content.Children.Add(userControl);
         }
         else
         {
             grid_content.Children.Clear();
             grid_content.Children.Add((UsersControl)iAddDeleteUser);
         }
     }
     if (e.AddedItems[0] == tab_organization)
     {
         if (iTree == null)
         {
             TreeControl treeControl = new TreeControl();
             iTree = treeControl;
             grid_content.Children.Clear();
             grid_content.Children.Add(treeControl);
         }
         else
         {
             grid_content.Children.Clear();
             grid_content.Children.Add((TreeControl)iTree);
         }
     }
 }
Exemplo n.º 8
0
        public FileSystemPanel()
        {
            InitializeComponent();
            Text = "File Browser".Localize();

            imageList = new ImageList();
            //imageList.Images.Add(Resources.Asset32);

            tree                      = new TreeControl();
            tree.ImageList            = imageList;
            tree.Dock                 = DockStyle.Fill;
            tree.NodeExpandedChanged += tree_NodeExpandedChanged;
            tree.SelectionChanged    += tree_SelectionChanged;
            splitter.Panel1.Controls.Add(tree);

            //Fill(rootPath, tree.Root);
            tree.ShowRoot = false;

            viewList      = new ListView();
            viewList.Dock = DockStyle.Fill;
            viewList.Columns.Add(new ColumnHeader {
                Text = "Filename", Name = "Name"
            });
            viewList.Columns.Add(new ColumnHeader {
                Text = "Last Modified", Name = "LastModified"
            });
            viewList.Columns.Add(new ColumnHeader {
                Text = "Size", Name = "Size"
            });
            viewList.TileSize = new System.Drawing.Size(256, 128);
            viewList.View     = View.Details;
            splitter.Panel2.Controls.Add(viewList);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Should boxes be drawn for the node collection.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="nc">Reference to NodeCollection instance.</param>
        /// <returns>true if lines are to be drawn; otherwise false.</returns>
        public virtual bool ShowBoxes(TreeControl tc, NodeCollection nc)
        {
            // Must have some width in order to draw boxes
            if (tc.ColumnWidth == 0)
            {
                return(false);
            }

            switch (tc.BoxVisibility)
            {
            case LineBoxVisibility.Nowhere:
                return(false);

            case LineBoxVisibility.OnlyAtRoot:
                return(IsRootCollection(tc, nc));

            case LineBoxVisibility.OnlyBelowRoot:
                return(!IsRootCollection(tc, nc));

            case LineBoxVisibility.Everywhere:
                return(true);

            default:
                // Should never happen!
                Debug.Assert(false);
                return(true);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Configures the editor</summary>
 /// <param name="treeControl">Control to display data</param>
 /// <param name="treeControlAdapter">Adapter to drive control. Its ITreeView should
 /// implement IInstancingContext and/or IHierarchicalInsertionContext.</param>
 /// <remarks>Default is to create a TreeControl and TreeControlAdapter,
 /// using the global image lists.</remarks>
 protected virtual void Configure(
     out TreeControl treeControl,
     out TreeControlAdapter treeControlAdapter)
 {
     treeControl        = CreateControl();
     treeControlAdapter = CreateAdapter(treeControl);
 }
Exemplo n.º 11
0
        /// <summary>
        /// Called when the underlying tree control raises the DragOver event</summary>
        /// <param name="e">Event args from the tree control's DragOver event</param>
        protected virtual void OnDragOver(DragEventArgs e)
        {
            bool canInsert = false;

            if (TreeControl.DragBetween)
            {
                TreeControl.Node parent, before;
                Point            clientPoint = TreeControl.PointToClient(new Point(e.X, e.Y));
                if (TreeControl.GetInsertionNodes(clientPoint, out parent, out before))
                {
                    canInsert = ApplicationUtil.CanInsertBetween(
                        m_treeControlAdapter.TreeView,
                        parent != null ? parent.Tag : null,
                        before != null ? before.Tag : null,
                        e.Data);
                }
            }
            else
            {
                canInsert = ApplicationUtil.CanInsert(
                    m_treeControlAdapter.TreeView,
                    m_treeControlAdapter.LastHit,
                    e.Data);
            }



            e.Effect = canInsert ? DragDropEffects.Move : DragDropEffects.None;

            // A refresh is required to display the drag-between cue.
            if (TreeControl.ShowDragBetweenCue)
            {
                TreeControl.Invalidate();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Calculate and return the extra space needed for drawing a NodeCollection instance.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="nc">Reference to NodeCollection instance.</param>
        /// <param name="g">Reference to Graphics instance to draw into.</param>
        /// <returns>Extra space needed for each edge of the collection area.</returns>
        public virtual Edges MeasureEdges(TreeControl tc, NodeCollection nc, Graphics g)
        {
            // Defualt left column width
            int leftWidth = tc.ColumnWidth;

            // If the root collection...
            if (IsRootCollection(tc, nc))
            {
                // ...does not have any lines or boxes then no point in
                // having the column spacing taking up room, so remove it
                if (!ShowLines(tc, nc) && !ShowBoxes(tc, nc))
                {
                    leftWidth = 0;
                }

                // Do we need extra space for indicators
                if (tc.Indicators != Indicators.None)
                {
                    leftWidth += tc.IndicatorSize.Width;
                }
            }
            else
            {
                // Do we need extra space for indicators
                if (tc.Indicators == Indicators.AtGroup)
                {
                    leftWidth += tc.IndicatorSize.Width;
                }
            }

            return(new Edges(leftWidth, 0, 0, 0));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Calculate and return the extra space needed for drawing a NodeCollection instance.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="nc">Reference to NodeCollection instance.</param>
        /// <param name="g">Reference to Graphics instance to draw into.</param>
        /// <returns>Extra space needed for each edge of the collection area.</returns>
        public override Edges MeasureEdges(TreeControl tc, NodeCollection nc, Graphics g)
        {
            // At the real root we have no edges
            if (IsRealRootCollection(tc, nc))
            {
                return(Edges.Empty);
            }
            else
            {
                // Get the size of edges from base class processing
                Edges retEdges = base.MeasureEdges(tc, nc, g);

                if (nc.VisibleCount > 0)
                {
                    // At the root level below a group
                    if (IsRootCollection(tc, nc))
                    {
                        // Add on the group extra
                        retEdges.Left   += tc.GroupIndentLeft;
                        retEdges.Top    += tc.GroupIndentTop;
                        retEdges.Bottom += tc.GroupIndentBottom;

                        // Do we need to account for the image box column?
                        if (tc.GroupImageBox && tc.GroupImageBoxColumn)
                        {
                            // Add on the width of the image box
                            retEdges.Left += tc.GroupImageBoxWidth;
                        }
                    }
                }

                return(retEdges);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="treeControl">Control to display data</param>
        /// <param name="treeControlAdapter">Adapter to drive control. Its ITreeView should
        /// implement IInstancingContext and/or IHierarchicalInsertionContext.</param>
        /// <remarks>Default is to create a TreeControl and TreeControlAdapter,
        /// using the global image lists.</remarks>
        protected override void Configure(
            out TreeControl treeControl,
            out TreeControlAdapter treeControlAdapter)
        {
            treeControl                = new TreeControl();
            treeControl.ImageList      = ResourceUtil.GetImageList16();
            treeControl.StateImageList = ResourceUtil.GetImageList16();

            treeControlAdapter = new TreeControlAdapter(treeControl);

            treeControl.PreviewKeyDown       += treeControl_PreviewKeyDown;
            treeControl.NodeExpandedChanging += treeControl_NodeExpandedChanging;
            treeControl.NodeExpandedChanged  += treeControl_NodeExpandedChanged;


            m_searchInput          = new StringSearchInputUI();
            m_searchInput.Updated += UpdateFiltering;

            m_control      = new UserControl();
            m_control.Dock = DockStyle.Fill;
            m_control.SuspendLayout();
            m_control.Name = "Tree View".Localize();
            m_control.Text = "Tree View".Localize();
            m_control.Controls.Add(m_searchInput);
            m_control.Controls.Add(TreeControl);
            m_control.Layout += controls_Layout;
            m_control.ResumeLayout();
        }
Exemplo n.º 15
0
        void m_GridView_GridRowClick(int rowIndex, string colName, DataRow Row, object CellValue)
        {
            if (Row != null)
            {
                string        F_RoleID = Row["F_ID"].ToString();
                DataTable     dt       = SystemManager.Instance.Services.Role_Right_RelationService.GetList("F_RoleID=" + F_RoleID).Tables[0];
                List <string> l        = new List <string>();
                foreach (DataRow row in dt.Rows)
                {
                    l.Add(row[1].ToString());
                }

                TreeControl.SetSelectNodes(l);


                dt = SystemManager.Instance.Services.Role_WorkflowService.GetList("F_RoleID=" + F_RoleID).Tables[0];
                List <string> l1 = new List <string>();
                foreach (DataRow row in dt.Rows)
                {
                    l1.Add(row[1].ToString());
                }

                TreeControl1.SetSelectNodes(l1);
            }
        }
Exemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        if (!damagedTreeFound)
        {
            allTrees = FindObjectsOfType <TreeControl>();
            foreach (TreeControl t in allTrees)
            {
                if (t.IsPlanted && t.CurrentHealth < t.maxHealth)
                {
                    tree             = t;
                    damagedTreeFound = true;
                    StartHealTut();
                    break;
                }
            }
        }

        if (!healFinished && damagedTreeFound)
        {
            if (tree.CurrentHealth == tree.maxHealth)
            {
                healFinished = true;
                FinishHealTut();
            }
        }

        if (!poacherFound)
        {
            GameObject p = GameObject.FindGameObjectWithTag("Poacher");
            if (p != null)
            {
                firstPoacher = p.GetComponent <PoacherAI>();
                poacherFound = true;
            }
        }

        if (!revealStarted && poacherFound)
        {
            if (firstPoacher.IsHiding)
            {
                StartRevealTut();
                revealStarted = true;
            }
        }

        if (!revealFinished && revealStarted)
        {
            if (!firstPoacher.IsHiding)
            {
                FinishRevealTut();
                revealFinished = true;
            }
        }

        if (revealFinished && healFinished)
        {
            DisableAllPlayerTut();
            this.enabled = false;
        }
    }
 private void CreateMapList()
 {
     mMapList = new TreeControl(mAdminWindow);
     mMapList.SetPosition(4f, 316);
     mMapList.Height      = 188;
     mMapList.Width       = mAdminWindow.Width - 8;
     mMapList.MaximumSize = new Point(4096, 999999);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initialize a new instance of the NodeCache class.
 /// </summary>
 public NodeCache()
 {
     // Default internal state
     _parentNode  = null;
     _TreeControl = null;
     _size        = Size.Empty;
     _bounds      = Rectangle.Empty;
 }
Exemplo n.º 19
0
        /// <summary>
        /// Performs custom actions after filtering finished</summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args</param>
        protected void UpdateFiltering(object sender, EventArgs e)
        {
            var filteredTreeView = TreeView as FilteredTreeView;

            if (filteredTreeView == null || TreeControl == null || filteredTreeView.Root == null)
            {
                return;
            }

            // Layout need to be updated when tag input height is changed
            int yoffset = m_TagInput.Height;

            yoffset += m_TagPanel.Visible ? m_TagPanel.Height /*+ TreeControl.Margin.Top*/ : 0;
            if (m_LastTagInputHeight != yoffset)
            {
                UpdateLayout();
            }

            UpdateTreeItemRenderer();

            try
            {
                m_updating = true;
                bool search = FilterPatterns.Count != 0;
                if (search)
                {
                    if (!m_searching)
                    {// Search started: remember expansion
                        m_searching = true;
                        filteredTreeView.SaveExpansion(TreeControl.Root);
                    }

                    filteredTreeView.ClearCache();
                    filteredTreeView.IsFiltering = true;

                    // collapse then expand all, to show all the matched nodes
                    Collapse();
                    TreeControl.ExpandAll();
                    TreeControl.Invalidate();
                }
                else
                {
                    filteredTreeView.IsFiltering = false;
                    if (m_searching)
                    {// Search stopped: restore expansion
                        m_searching = false;
                        Collapse();
                        TreeControl.Root.Expanded = true;
                        filteredTreeView.RestoreExpansion(TreeControl.Root, TreeControlAdapter);
                        TreeControl.Invalidate();
                    }
                }
            }
            finally
            {
                m_updating = false;
            }
        }
Exemplo n.º 20
0
 public void SetupTreeArrow(Transform tree)
 {
     treeArrow = Instantiate(arrowPrefab, tree.position + new Vector3(0, 2.7f, 0), Quaternion.identity);
     Destroy(treeArrow, 15f);
     if (tutTree == null)
     {
         tutTree = tree.GetComponent <TreeControl>();
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// Notification that the size of the control has changed.
 /// </summary>
 /// <param name="tc">Reference to owning TreeControl.</param>
 public override void SizeChanged(TreeControl tc)
 {
     // Are we requested to allocate spare space?
     if (tc.GroupAutoAllocate)
     {
         // Then changing the size of the control will alter how much space is
         // reallocate and so need to recalculate all the nodes.
         tc.InvalidateNodeDrawing();
     }
 }
Exemplo n.º 22
0
        protected override void Configure(out TreeControl treeControl, out TreeControlAdapter treeControlAdapter)
        {
            base.Configure(out treeControl, out treeControlAdapter);

            treeControl.ShowRoot      = false; // hide root node, because it's the project
            treeControl.Text          = Localizer.Localize("Dota 2 directory not set");
            treeControl.Dock          = DockStyle.Fill;
            treeControl.AllowDrop     = true;
            treeControl.SelectionMode = SelectionMode.One;
        }
Exemplo n.º 23
0
        private void BuildSceneTree(SceneNode sceneNode)
        {
            TreeControl.BeginUpdate();
            TreeControl.Nodes.Add(sceneNode.Name);
            TreeNode n = TreeControl.Nodes[0];

            n.Tag = (object)sceneNode;
            sceneTreeHelper(sceneNode, ref n);
            TreeControl.EndUpdate();
        }
Exemplo n.º 24
0
        protected override void Configure(out TreeControl treeControl, out TreeControlAdapter treeControlAdapter)
        {
            base.Configure(out treeControl, out treeControlAdapter);

            treeControl.ShowRoot      = false; // hide root node, because it's the project
            treeControl.Text          = Localizer.Localize("No Addon Loaded, Can't display Units");
            treeControl.Dock          = DockStyle.Fill;
            treeControl.AllowDrop     = true;
            treeControl.SelectionMode = SelectionMode.One;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Configures the editor</summary>
        /// <param name="treeControl">Tree control to display data</param>
        /// <param name="treeControlAdapter">Tree control adapter to drive control</param>
        protected override void Configure(
            out TreeControl treeControl,
            out TreeControlAdapter treeControlAdapter)
        {
            treeControl               = new TreeControl(TreeControl.Style.CategorizedPalette);
            treeControl.ImageList     = ResourceUtil.GetImageList16();
            treeControl.AllowDrop     = true;
            treeControl.SelectionMode = SelectionMode.MultiExtended;

            treeControlAdapter = new TreeControlAdapter(treeControl);
        }
Exemplo n.º 26
0
    public void AddGrownTree(TreeControl tree)
    {
        //create and add to list
        GrownTree gt = new GrownTree(tree);

        GrownTrees.Add(gt);

        //deploy new bird and reset timer
        DeployBird(gt);
        timer = 0f;
    }
Exemplo n.º 27
0
        internal void SetTreeControl(TreeControl tl)
        {
            // Cache back reference
            Cache.TreeControl = tl;

            // Recurse to tell each of the child nodes as well
            foreach (Node node in this)
            {
                node.SetTreeControl(tl);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Create and configure TreeControl</summary>
        /// <param name="treeControl">New TreeControl</param>
        /// <param name="treeControlAdapter">Adapter for TreeControl</param>
        protected override void Configure(out TreeControl treeControl, out TreeControlAdapter treeControlAdapter)
        {
            base.Configure(out treeControl, out treeControlAdapter);

            treeControl.ShowRoot = false; // UI node can't really be edited, so hide it
            treeControl.Text     = ("Add packages to the UI." + Environment.NewLine +
                                    "Add forms, shaders, textures, and fonts to packages." + Environment.NewLine +
                                    "Add sprites or text items to forms or sprites." + Environment.NewLine +
                                    "Drag shaders, textures, and fonts onto the reference slots of sprites and text items.").Localize();
            treeControl.AllowDrop     = true;
            treeControl.SelectionMode = SelectionMode.MultiExtended;
        }
Exemplo n.º 29
0
        /// <summary>
        /// Notification that all child nodes are being removed.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="nc">Reference to NodeCollection instance.</param>
        public virtual void NodeCollectionClearing(TreeControl tc, NodeCollection nc)
        {
            // Ensure all children of the node are deselected as they
            // are no longer showing and so cannot be in the selected state
            foreach (Node n in nc)
            {
                tc.DeselectNode(n, true);
            }

            // Ask control to move the focus to new calculated position
            tc.NodeContentCleared(false);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Process a left mouse down on the Node instance.
        /// </summary>
        /// <param name="tc">Reference to owning TreeControl.</param>
        /// <param name="nc">Reference to NodeCollection instance.</param>
        /// <param name="n">Reference to Node within collection.</param>
        /// <param name="button">Button that is pressed down.</param>
        /// <param name="pt">Point being pressed down.</param>
        /// <returns>true if the point was processed; otherwise false.</returns>
        public virtual bool MouseDown(TreeControl tc, NodeCollection nc, Node n, MouseButtons button, Point pt)
        {
            // Left mouse is used to toggel expand/collapse boxes
            if (button == MouseButtons.Left)
            {
                // Can only toggle if this collection has the node of interest
                if (n != null)
                {
                    // Can only toggle if the node has children
                    if (n.Nodes.VisibleCount > 0)
                    {
                        // Can only toggle if there is box to toggle
                        if (ShowBoxes(tc, nc))
                        {
                            // Find the box rectangle
                            Rectangle rectBox = GetExpandCollapseBox(tc, nc, n);

                            // Make a little bigger so user does not have to be precise
                            rectBox.Inflate(2, 2);

                            // If the click is on the box
                            if (rectBox.Contains(pt))
                            {
                                // Toggle the expanded state
                                if (n.Expanded)
                                {
                                    // Collapse the node if allowed
                                    if (n.VC.CanCollapseNode(tc, n, false, true))
                                    {
                                        n.Collapse();
                                    }
                                }
                                else
                                {
                                    // Expand the node if allowed
                                    if (n.VC.CanExpandNode(tc, n, false, true))
                                    {
                                        n.Expand();
                                    }
                                }

                                // Message handled
                                return(true);
                            }
                        }
                    }
                }
            }

            // Not processed
            return(false);
        }
Exemplo n.º 31
0
        public String Note; // additional text to display in status bar

        public UnitTest(ZGE.Components.ZComponent parent) : base(parent)
        {
            Dock = Pos.Fill;
            SetSize(1024, 768);
            m_List = new Control.CollapsibleList(this);

            LeftDock.TabControl.AddPage("Unit tests", m_List);
            LeftDock.Width = 150;

            m_TextOutput = new Control.ListBox(BottomDock);
            m_Button = BottomDock.TabControl.AddPage("Output", m_TextOutput);
            BottomDock.Height = 200;

            m_DebugCheck = new Control.LabeledCheckBox(m_List);
            m_DebugCheck.Text = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_StatusBar = new Control.StatusBar(this);
            m_StatusBar.Dock = Pos.Bottom;
            m_StatusBar.AddControl(m_DebugCheck, true);

            //m_Center = new Center(this);
            //m_Center.Dock = Pos.Fill;
            GUnit test;

            {
                CollapsibleCategory cat = m_List.Add("Non-Interactive");
                {
                    test = new Label(this);
                    RegisterUnitTest("Label", cat, test);
                    test = new RichLabel(this);
                    RegisterUnitTest("RichLabel", cat, test);
                    test = new GroupBox(this);
                    RegisterUnitTest("GroupBox", cat, test);
                    test = new ProgressBar(this);
                    RegisterUnitTest("ProgressBar", cat, test);
                    test = new ImagePanel(this);
                    RegisterUnitTest("ImagePanel", cat, test);
                    test = new StatusBar(this);
                    RegisterUnitTest("StatusBar", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Standard");
                {
                    test = new Button(this);
                    RegisterUnitTest("Button", cat, test);
                    test = new TextBox(this);
                    RegisterUnitTest("TextBox", cat, test);
                    test = new CheckBox(this);
                    RegisterUnitTest("CheckBox", cat, test);
                    test = new RadioButton(this);
                    RegisterUnitTest("RadioButton", cat, test);
                    test = new ComboBox(this);
                    RegisterUnitTest("ComboBox", cat, test);
                    test = new ListBox(this);
                    RegisterUnitTest("ListBox", cat, test);
                    test = new NumericUpDown(this);
                    RegisterUnitTest("NumericUpDown", cat, test);
                    test = new Slider(this);
                    RegisterUnitTest("Slider", cat, test);
                    test = new MenuStrip(this);
                    RegisterUnitTest("MenuStrip", cat, test);
                    test = new CrossSplitter(this);
                    RegisterUnitTest("CrossSplitter", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Containers");
                {
                    test = new Window(this);
                    RegisterUnitTest("Window", cat, test);
                    test = new TreeControl(this);
                    RegisterUnitTest("TreeControl", cat, test);
                    test = new Properties(this);
                    RegisterUnitTest("Properties", cat, test);
                    test = new TabControl(this);
                    RegisterUnitTest("TabControl", cat, test);
                    test = new ScrollControl(this);
                    RegisterUnitTest("ScrollControl", cat, test);
                    test = new Docking(this);
                    RegisterUnitTest("Docking", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Non-standard");
                {
                    test = new CollapsibleList(this);
                    RegisterUnitTest("CollapsibleList", cat, test);
                    test = new ColorPickers(this);
                    RegisterUnitTest("Color pickers", cat, test);
                }
            }

            m_StatusBar.SendToBack();
            PrintText("Unit Test started!");
        }
		private void _tokenTreeView_AfterSelect(TreeControl tc, NodeEventArgs e)
		{
			Node node = e.Node;
			if(node != null && node.Tag != null)
			{
				_description.Value = ((AuthorityTokenTableEntry) node.Tag).Description;
			}
			else
			{
				_description.Value = "";
			}
		}