Ejemplo n.º 1
0
 /// <summary>
 /// Returns default top-level columns for tree control.
 /// </summary>
 /// <returns>Returns array list of ColumnInfo objects.</returns>
 protected override NodeColumnInfo GetDefaultColumnInfo()
 {
     // There are no columns in Tile view
     List<ColumnInfo> ci = new List<ColumnInfo>();
     NodeColumnInfo info = new NodeColumnInfo(ci, false);
     return info;
 }
Ejemplo n.º 2
0
		/// <summary>
		/// Returns column information for a given node.
		/// </summary>
		/// <param name="node">Node to return column information for</param>
		/// <returns>Returns array list of ColumnInfo objects or null if there are no columns defined.</returns>
		protected virtual NodeColumnInfo GetNodeColumnInfo(Node node)
		{
            if (!node.HasColumns)
            {
                return null;
            }

            List<ColumnInfo> ci = new List<ColumnInfo>();
            NodeColumnInfo info = new NodeColumnInfo(ci, false);
            ColumnHeaderCollection columns = node.NodesColumns;
            for (int i = 0; i < columns.Count; i++)
			{
                int columnIndex = columns.DisplayIndexMap[i];
                ColumnHeader h = columns[columnIndex];
                ColumnInfo columnInfo = new ColumnInfo(h.Bounds.Width, h.Visible, h, columnIndex);
                ci.Add(columnInfo);
                info.HasAutoSizeColumn |= columnInfo.AutoSize;
			}

            return info;
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Returns default top-level columns for tree control.
		/// </summary>
		/// <returns>Returns array list of ColumnInfo objects.</returns>
        protected virtual NodeColumnInfo GetDefaultColumnInfo()
		{
            List<ColumnInfo> ci = new List<ColumnInfo>();
            NodeColumnInfo info = new NodeColumnInfo(ci, false);
			ColumnHeaderCollection columns=m_Tree.Columns;
            //int treeWidth = m_Tree.ClientRectangle.Width;
			if(columns!=null)
			{
                for (int i = 0; i < columns.Count; i++)
				{
                    int columnIndex = columns.DisplayIndexMap[i];
                    ColumnHeader h = columns[columnIndex];
                    ColumnInfo columnInfo = new ColumnInfo(h.Bounds.Width, h.Visible, h, columnIndex);
                    ci.Add(columnInfo);
                    info.HasAutoSizeColumn |= columnInfo.AutoSize;
				}
			}

			return info;
		}
Ejemplo n.º 4
0
        private Rectangle ProcessChildNodes(NodeLayoutContextInfo layoutInfo, Node node, int nodeVerticalSpacing, NodeColumnInfo childColumns)
        {
            Rectangle childNodesBounds = new Rectangle(layoutInfo.Left, layoutInfo.Top, 0, 0);

            foreach (Node childNode in node.Nodes)
            {
                if (!childNode.Visible) continue;
                layoutInfo.ContextNode = childNode;
                layoutInfo.ChildColumns = childColumns;
                ProcessNode(layoutInfo);
                childNodesBounds.Width = Math.Max(childNodesBounds.Width,
                    Math.Max(childNode.BoundsRelative.Width, (childNode.Expanded && childNode.ChildNodesBounds.Width > 0 ? childNode.ChildNodesBounds.Right - childNodesBounds.X : 0)));
                childNodesBounds.Height += childNode.BoundsRelative.Height + (childNode.Expanded ? childNode.ChildNodesBounds.Height + childNode.ColumnHeaderHeight : 0) + nodeVerticalSpacing;
            }
            return childNodesBounds;
        }
Ejemplo n.º 5
0
        private Rectangle ProcessChildNodes(NodeLayoutContextInfo layoutInfo, Node node, int nodeVerticalSpacing, NodeColumnInfo childColumns)
        {
            Rectangle childNodesBounds = new Rectangle(layoutInfo.Left, layoutInfo.Top, 0, 0);
            bool isPreviousGroupNode = false;

            foreach (Node childNode in node.Nodes)
            {
                if (!childNode.Visible) continue;

                if (_Groupping && childNode.HasChildNodes)
                {
                    if (layoutInfo.CurrentLineHeight > 0)
                        layoutInfo.Top += layoutInfo.CurrentLineHeight + this.LayoutSettings.NodeVerticalSpacing;
                    layoutInfo.CurrentLineHeight = 0;
                    layoutInfo.Left = layoutInfo.CurrentLevelLeft;
                    isPreviousGroupNode = true;
                }
                else
                {
                    if (isPreviousGroupNode)
                    {
                        if (layoutInfo.CurrentLineHeight > 0)
                            layoutInfo.Top += layoutInfo.CurrentLineHeight + this.LayoutSettings.NodeVerticalSpacing;
                        layoutInfo.CurrentLineHeight = 0;
                        layoutInfo.Left = layoutInfo.CurrentLevelLeft;
                        isPreviousGroupNode = false;
                    }
                }

                layoutInfo.ContextNode = childNode;
                layoutInfo.ChildColumns = childColumns;
                ProcessNode(layoutInfo);

                if (!(_Groupping && childNode.HasChildNodes))
                    layoutInfo.Left += childNode.BoundsRelative.Width + this.LayoutSettings.NodeHorizontalSpacing;
                if (isPreviousGroupNode)
                {
                    childNodesBounds.Width = Math.Max(childNodesBounds.Width,
                        Math.Max(childNode.BoundsRelative.Width, (childNode.Expanded && childNode.ChildNodesBounds.Width > 0 ? childNode.ChildNodesBounds.Right - childNodesBounds.X : 0)));
                    childNodesBounds.Height += childNode.BoundsRelative.Height + (childNode.Expanded ? childNode.ChildNodesBounds.Height + childNode.ColumnHeaderHeight : 0) + nodeVerticalSpacing;
                }
                else
                {
                    childNodesBounds = Rectangle.Union(childNodesBounds, childNode.BoundsRelative);
                }
            }
            return childNodesBounds;
        }