public CellEventArgs(Node r, Resco.Controls.AdvancedTree.Cell c, int ri, int ci, int yoff) : base(r, ri, yoff) { this.CellIndex = ci; this.Cell = c; if (c != null) { this.CellData = c[r, ci]; } else { this.CellData = null; } }
internal NodeTemplate GetTemplate(Node r, int ix) { TemplateSet templates = this.AdvancedTree.Templates; int count = templates.Count; if ((ix >= 0) && (ix < count)) { return templates[ix]; } return NodeTemplate.Default; }
internal NodeTemplate GetTemplate(Node r) { if (this.AdvancedTree == null) { return null; } TemplateSet templates = this.AdvancedTree.Templates; int count = templates.Count; int currentTemplateIndex = r.CurrentTemplateIndex; if ((currentTemplateIndex >= 0) && (currentTemplateIndex < count)) { return templates[currentTemplateIndex]; } return NodeTemplate.Default; }
internal NodeCollection(Node parent) { this.m_parentNode = parent; }
internal Point GetNodeClick(int iNode, int iNodeOffset, int pos_x, int pos_y, out int yOffset, out int yOut, out Node node) { int num = 0; int num2 = iNodeOffset; yOffset = 0; yOut = num2; node = null; if (num2 <= pos_y) { for (int i = iNode; i < base.List.Count; i++) { Node r = (Node) base.InnerList[i]; NodeTemplate template = this.GetTemplate(r); int height = template.GetHeight(r); if (this.AdvancedTree.GridLines) { num2 += height + 1; } else { num2 += height; } if (num2 > pos_y) { bool flag = (this.AdvancedTree != null) && this.AdvancedTree.RightToLeft; yOffset = num2 - (this.AdvancedTree.GridLines ? (height + 1) : height); num = (r.Level * this.AdvancedTree.NodeIndent) + (this.AdvancedTree.ShowPlusMinus ? this.AdvancedTree.PlusMinusSize.Width : 0); if (flag) { num *= -1; } int y = template.GetCellClick(pos_x - num, pos_y - yOffset, r); node = r; return new Point(i, y); } if (r.IsExpanded) { Point point = r.Nodes.GetNodeClick(0, num2, pos_x, pos_y, out yOffset, out num2, out node); if ((point.X != -1) || (point.Y != -1)) { return point; } } yOut = num2; } } return new Point(-1, -1); }
public void Remove(Node node) { ((IList) this).Remove(node); }
public void Insert(int index, Node node) { if (node.ParentCollection != null) { throw new ApplicationException("A single Node instance cannot be contained in multiple collections."); } ((IList) this).Insert(index, node); }
internal bool CustomizeCells(Node node) { bool flag = false; if (!this.HasCustomizedCells || (this.Parent == null)) { return false; } int count = this.m_CellTemplates.Count; for (int i = 0; i < count; i++) { Cell cell = this.m_CellTemplates[i]; if (cell.CustomizeCell) { object data = cell[node, i]; CustomizeCellEventArgs e = new CustomizeCellEventArgs(cell, data, node); this.OnCustomizeCell(e); NodeSpecificCellProperties nodeSpecificProperties = cell.GetNodeSpecificProperties(node); bool flag2 = nodeSpecificProperties.Visible.HasValue ? nodeSpecificProperties.Visible.Value : cell.Visible; nodeSpecificProperties.Visible = new bool?(e.Cell.Visible); nodeSpecificProperties.CachedAutoHeight = e.Cell.GetAutoHeight(e.Node, i, nodeSpecificProperties); nodeSpecificProperties.Cea = e; if (e.Cell.Visible != flag2) { flag = true; } } } return flag; }
public bool Contains(Node value) { return ((IList) this).Contains(value); }
public LinkEventArgs(Node n, Cell c, int ri, int ci, int yoff) : base(n, c, ri, ci, yoff) { this.Target = ((LinkCell) base.Cell).GetLink(base.CellData); }
public override int GetAutoHeight(Node n, int index, NodeSpecificCellProperties preNscp) { int num = 0; if (!base.AutoHeight) { return base.Bounds.Height; } NodeSpecificCellProperties properties = (preNscp == null) ? base.GetNodeSpecificProperties(n) : preNscp; if (properties.CachedAutoHeight >= 0) { return properties.CachedAutoHeight; } string text = this.GetText(base[n, index]); if (((text == null) || (text.Length == 0)) || !properties.Visible.Value) { return 0; } int gridWidth = 0; Resco.Controls.AdvancedTree.AdvancedTree parent = base.Parent; if (parent != null) { gridWidth = parent.Width - ((n.Level * parent.NodeIndent) + parent.PlusMinusSize.Width); if (parent.ScrollbarVisible) { gridWidth -= parent.ScrollbarWidth; } } if (gridWidth != 0) { Rectangle rectangle = base.CalculateCellWidth(gridWidth); rectangle.Width -= 3; if (rectangle.Width > base.Parent.ScrollbarWidth) { WrapTextData data = Utility.WrapText(base.Graphics, text, this.m_Font, rectangle.Width); num = (data != null) ? (data.Height + 2) : 0; } } properties.CachedAutoHeight = num; return num; }
internal int GetCellClick(int pos_x, int pos_y, Node node) { int num = this.m_CellTemplates.Count - 1; while (num >= 0) { NodeSpecificCellProperties nodeSpecificProperties = this.m_CellTemplates[num].GetNodeSpecificProperties(node); if ((nodeSpecificProperties.Visible.Value && nodeSpecificProperties.CachedBounds.HasValue) && nodeSpecificProperties.CachedBounds.Value.Contains(pos_x, pos_y)) { return num; } num--; } return num; }
protected internal virtual void Draw(Graphics gr, int xOffset, int yOffset, Node node, int width, int height) { bool rightToLeft; int num; Color colorKey; if (this.Parent != null) { rightToLeft = this.Parent.RightToLeft; num = this.Parent.ScrollbarVisible ? this.Parent.ScrollbarWidth : 0; } else { rightToLeft = false; num = 0; } this.CurrentNode = node; if (height == -1) { height = this.GetHeight(node); } if (this.m_BackColor == Color.Transparent) { if (this.Parent.UseGradient) { colorKey = this.Parent.m_colorKey; } else { colorKey = this.Parent.BackColor; } } else { colorKey = this.m_BackColor; } int x = !rightToLeft ? xOffset : ((width + num) - (xOffset + this.Parent.PlusMinusSize.Width)); if (((this.Parent != null) && (!this.Parent.UseGradient || (this.Parent.GradientBackColor.FillDirection == FillDirection.Vertical))) && !this.m_useTemplateBackground) { Brush brush = Resco.Controls.AdvancedTree.AdvancedTree.GetBrush(colorKey); if (!rightToLeft) { gr.FillRectangle(brush, 0, yOffset, xOffset + this.Parent.PlusMinusSize.Width, height); } else { gr.FillRectangle(brush, x, yOffset, xOffset + this.Parent.PlusMinusSize.Width, height); } } else if (this.m_useTemplateBackground) { this.DrawBackground(gr, 0, yOffset, width, height, colorKey); } if (((this.Parent != null) && this.Parent.ShowPlusMinus) && !node.HidePlusMinus) { int num3 = this.Parent.PlusMinusSize.Width - (2 * this.Parent.PlusMinusMargin.Width); int num4 = this.Parent.PlusMinusSize.Height - (2 * this.Parent.PlusMinusMargin.Height); int num5 = num3 / 2; int num6 = num4 / 2; gr.DrawRectangle(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), (int) (x + this.Parent.PlusMinusMargin.Width), (int) (this.Parent.PlusMinusMargin.Height + yOffset), (int) (num3 - 1), (int) (num4 - 1)); int num7 = (this.Parent.PlusMinusMargin.Width + x) + num5; int num8 = (this.Parent.PlusMinusMargin.Height + yOffset) + num6; gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Black), num7 - (num5 / 2), num8, num7 + (num5 / 2), num8); if (!node.IsExpanded) { gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Black), num7, num8 - (num6 / 2), num7, num8 + (num6 / 2)); } } if ((this.Parent != null) && this.Parent.TreeNodeLines) { int num9 = this.Parent.PlusMinusSize.Width - (2 * this.Parent.PlusMinusMargin.Width); int num10 = this.Parent.PlusMinusSize.Height - (2 * this.Parent.PlusMinusMargin.Height); int num11 = num9 / 2; int num12 = num10 / 2; int num13 = (this.Parent.PlusMinusMargin.Width + x) + num11; int num14 = (this.Parent.PlusMinusMargin.Height + yOffset) + num12; bool flag2 = node.ParentCollection.IndexOf(node) == (node.ParentCollection.Count - 1); if (node.HidePlusMinus) { gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), num13, num14, x + (this.Parent.PlusMinusSize.Width * (!rightToLeft ? 1 : -1)), num14); gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), num13, yOffset, num13, flag2 ? num14 : (yOffset + this.Height)); } else { gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), x + (!rightToLeft ? (this.Parent.PlusMinusSize.Width - this.Parent.PlusMinusMargin.Width) : 0), num14, x + (!rightToLeft ? this.Parent.PlusMinusSize.Width : this.Parent.PlusMinusMargin.Width), num14); gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), num13, yOffset, num13, yOffset + this.Parent.PlusMinusMargin.Height); if (!flag2) { gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), num13, (yOffset + this.Parent.PlusMinusSize.Height) - this.Parent.PlusMinusMargin.Height, num13, yOffset + this.Height); } } int num15 = x + ((!rightToLeft ? -1 : 1) * this.Parent.PlusMinusSize.Width); for (Node node2 = node.Parent; node2 != null; node2 = node2.Parent) { if (node2.ParentCollection.IndexOf(node2) != (node2.ParentCollection.Count - 1)) { num13 = (num15 + this.Parent.PlusMinusMargin.Width) + ((this.Parent.PlusMinusSize.Width - (2 * this.Parent.PlusMinusMargin.Width)) / 2); gr.DrawLine(Resco.Controls.AdvancedTree.AdvancedTree.GetPen(Color.Gray), num13, yOffset, num13, yOffset + this.Height); } num15 += (!rightToLeft ? -1 : 1) * this.Parent.PlusMinusSize.Width; } } if (this.Parent != null) { xOffset += this.Parent.PlusMinusSize.Width; } x = !rightToLeft ? xOffset : (num - xOffset); if (!this.m_useTemplateBackground) { this.DrawBackground(gr, x, yOffset, width, height, colorKey); } int count = this.m_CellTemplates.Count; for (int i = 0; i < count; i++) { Cell cell = this.m_CellTemplates[i]; NodeSpecificCellProperties nscp = null; object data = null; if (cell.CustomizeCell && (this.Parent != null)) { nscp = cell.GetNodeSpecificProperties(node); if (nscp.Cea != null) { cell = nscp.Cea.Cell; data = nscp.Cea.Data; } } else { data = cell[node, i]; } if (cell is ButtonCell) { ((ButtonCell) cell).Pressed = node.PressedButtonIndex == i; } if ((cell != null) && cell.Visible) { cell.Draw(gr, xOffset, yOffset, width, data, nscp); } if (nscp != null) { nscp.Cea = null; } } }
internal void SetSelected(Node n) { if ((this.m_AdvancedTree.m_nodeSelected != null) && !this.m_AdvancedTree.MultiSelect) { this.m_AdvancedTree.m_nodeSelected.Selected = false; } if ((this.m_AdvancedTree.m_nodeSelected == null) || (this.m_AdvancedTree.m_nodeSelected != n)) { this.m_AdvancedTree.m_nodeSelected = n; if (n != null) { if (this.m_AdvancedTree.MultiSelect) { this.m_AdvancedTree.m_countSelected++; } else { this.m_AdvancedTree.m_countSelected = 1; } } else if (this.m_AdvancedTree.m_countSelected > 0) { this.m_AdvancedTree.m_countSelected--; } } }
public int IndexOf(Node node) { return ((IList) this).IndexOf(node); }
public int Add(Node node) { if (node.ParentCollection != null) { throw new ApplicationException("A single Node instance cannot be contained in multiple collections"); } return ((IList) this).Add(node); }
public int GetHeight(Node node) { if (node.RecalculationNeeded) { node.RecalculationNeeded = false; if (!this.AutoHeight) { node.ActualHeight = this.m_iHeight; return this.m_iHeight; } int iHeight = this.m_iHeight; for (int i = 0; i < this.CellTemplates.Count; i++) { Cell cell = this.CellTemplates[i]; if (cell.AutoHeight) { int num3 = ((cell.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom) ? cell.m_anchorSizeBottom : 0; iHeight = Math.Max(iHeight, (cell.GetAutoHeight(node, i, null) + cell.Bounds.Top) + num3); } } node.ActualHeight = iHeight; } return node.ActualHeight; }