internal void ResetCachedBounds(NodeTemplate nt) { foreach (Node node in base.List) { node.ResetCachedBounds(nt); } }
internal int GetHeight(int i, TemplateSet ts, bool subNodes) { if ((i < 0) || (i >= base.List.Count)) { return(0); } Node node = (Node)base.InnerList[i]; NodeTemplate template = ts[node.CurrentTemplateIndex]; if (template == null) { return(0); } int height = template.GetHeight(node); if (subNodes && node.IsExpanded) { height += node.Nodes.CalculateNodesHeight(); } if (this.AdvancedTree.GridLines) { return(height + 1); } return(height); }
internal void OnNodeChanged(object sender, NodeEventArgsType e, object oParam) { object obj2 = oParam; Node r = (Node)sender; NodeTemplate template = this.GetTemplate(r); switch (e) { case NodeEventArgsType.Selection: if (!((bool)oParam)) { this.SetSelected(null); return; } this.SetSelected(r); return; case NodeEventArgsType.TemplateIndex: { int offset = 0; NodeTemplate template2 = this.GetTemplate(r, (int)oParam); offset -= template2.GetHeight(r); r.ResetCachedBounds(null); offset += template.GetHeight(r); this.OnChanged(base.List.IndexOf(r), new TreeResizeEventArgs(offset)); return; } case NodeEventArgsType.BeforeExpand: this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.BeforeExpand, oParam)); return; case NodeEventArgsType.AfterExpand: this.OnChanged(this, new TreeRefreshEventArgs(true)); this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.AfterExpand, oParam)); return; case NodeEventArgsType.BeforeCollapse: this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.BeforeCollapse, oParam)); return; case NodeEventArgsType.AfterCollapse: this.OnChanged(this, new TreeRefreshEventArgs(true)); this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.AfterCollapse, oParam)); return; } if ((template != null) && template.AutoHeight) { int actualHeight = r.ActualHeight; r.ResetCachedBounds(null); int height = template.GetHeight(r); if (height != actualHeight) { this.OnChanged(base.List.IndexOf(r), new TreeResizeEventArgs(height - actualHeight)); return; } } this.OnChanged(base.List.IndexOf(sender), new TreeChangedEventArgs(TreeEventArgsType.NodeChange, obj2)); }
internal int Draw(Graphics gr, TemplateSet ts, int width, int ymax, int ymin, int iNode, int iNodeOffset, ref bool resetScrollbar) { int yOffset = iNodeOffset; int count = base.List.Count; this.LastDrawnNodeOffset = yOffset; this.LastDrawnNode = iNode; while (this.LastDrawnNode < count) { Node node = null; if ((this.LastDrawnNode >= 0) && (this.LastDrawnNode < base.InnerList.Count)) { node = base.InnerList[this.LastDrawnNode] as Node; } if (node != null) { NodeTemplate template = node.GetTemplate(ts); int height = 0; int num4 = -1; int xOffset = node.Level * this.m_AdvancedTree.NodeIndent; if (template.CustomizeCells(node)) { num4 = template.GetHeight(node); node.ResetCachedBounds(null); } height = template.GetHeight(node); if ((num4 >= 0) && (height != num4)) { resetScrollbar = true; } if ((yOffset + height) >= ymin) { template.Draw(gr, xOffset, yOffset, node, width, -1); } this.LastDrawnNodeOffset = yOffset; yOffset += height; if (this.AdvancedTree.GridLines) { if (yOffset >= 0) { gr.DrawLine(this.m_AdvancedTree.m_penBorder, 0, yOffset, this.AdvancedTree.Width, yOffset); } yOffset++; } if (node.IsExpanded) { yOffset = node.Nodes.Draw(gr, ts, width, ymax, ymin, 0, yOffset, ref resetScrollbar); } if (yOffset > ymax) { return(yOffset); } } this.LastDrawnNode++; } this.LastDrawnNodeOffset = yOffset; return(yOffset); }
protected override void OnInsertComplete(int index, object value) { NodeTemplate template = (NodeTemplate)value; template.Parent = this.Parent; template.Width = (this.Parent == null) ? 0 : this.Parent.Width; template.Changed += new TreeChangedEventHandler(this.OnChanged); this.OnChanged(this, new TreeRefreshEventArgs(true)); }
protected override void OnRemoveComplete(int index, object value) { if (value.GetType() != typeof(NodeTemplate)) { throw new ArgumentException("value must be of type NodeTemplate."); } NodeTemplate template = (NodeTemplate)value; template.Parent = null; template.Changed -= new TreeChangedEventHandler(this.OnChanged); this.OnChanged(this, new TreeRefreshEventArgs(true)); }
protected override void OnInsert(int index, object value) { NodeTemplate owner = ((Cell)value).Owner; if ((owner != null) && (owner != this.m_Owner)) { throw new ArgumentException("Cell is already part of other NodeTemplate"); } if (this.m_Owner.Parent != null) { this.m_Owner.Parent.SuspendRedraw(); } }
protected override void OnSetComplete(int index, object oldValue, object newValue) { NodeTemplate template = (NodeTemplate)newValue; template.Parent = this.Parent; template.Width = (this.Parent == null) ? 0 : this.Parent.Width; template.Changed += new TreeChangedEventHandler(this.OnChanged); NodeTemplate template2 = (NodeTemplate)oldValue; template2.Parent = null; template2.Changed -= new TreeChangedEventHandler(this.OnChanged); this.OnChanged(this, new TreeRefreshEventArgs(null)); }
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 NodeTemplate this[string name] { get { for (int i = 0; i < base.List.Count; i++) { NodeTemplate template = (NodeTemplate)base.InnerList[i]; if (template.Name == name) { return(template); } } return(null); } }
internal void ResetCachedBounds(NodeTemplate nt) { if ((nt == null) || (nt == this.Template)) { foreach (Resco.Controls.AdvancedTree.NodeSpecificCellProperties properties in this.m_nodeSpecificCellProperties.Values) { properties.ResetCachedBounds(); } this.m_recalculationNeeded = true; } if (this.Nodes != null) { this.Nodes.ResetCachedBounds(nt); } }
public virtual NodeTemplate Clone() { NodeTemplate template = new NodeTemplate(); foreach (Cell cell in this.m_CellTemplates) { template.CellTemplates.Add(cell.Clone()); } template.BackColor = this.BackColor; template.ForeColor = this.ForeColor; template.GradientBackColor = new GradientColor(this.GradientBackColor.StartColor, this.GradientBackColor.EndColor, this.GradientBackColor.FillDirection); template.UseGradient = this.UseGradient; template.UseTemplateBackground = this.UseTemplateBackground; template.Height = this.Height; template.Name = this.Name; return(template); }
internal int CalculateNodesHeight() { int num = 0; foreach (Node node in base.List) { NodeTemplate template = this.GetTemplate(node); if (this.AdvancedTree.GridLines) { num += template.GetHeight(node) + 1; } else { num += template.GetHeight(node); } if (node.IsExpanded) { num += node.Nodes.CalculateNodesHeight(); } } return(num); }
public void Remove(NodeTemplate value) { base.List.Remove(value); }
internal static void DisposeDefaultNodeTemplate() { s_Default = null; }
public void Insert(int index, NodeTemplate value) { base.List.Insert(index, value); }
public bool Contains(NodeTemplate value) { return(base.List.Contains(value)); }
public TreeRefreshEventArgs(NodeTemplate nt) : this(nt, true) { }
public int IndexOf(NodeTemplate value) { return base.List.IndexOf(value); }
public int Add(NodeTemplate value) { return base.List.Add(value); }
public bool Contains(NodeTemplate value) { return base.List.Contains(value); }
public int Add(NodeTemplate value) { return(base.List.Add(value)); }
public int IndexOf(NodeTemplate value) { return(base.List.IndexOf(value)); }
private TreeRefreshEventArgs(NodeTemplate nt, bool bResetBounds) : base(TreeEventArgsType.Refresh, null) { this.Template = nt; this.ResetBounds = bResetBounds; }
public virtual NodeTemplate Clone() { NodeTemplate template = new NodeTemplate(); foreach (Cell cell in this.m_CellTemplates) { template.CellTemplates.Add(cell.Clone()); } template.BackColor = this.BackColor; template.ForeColor = this.ForeColor; template.GradientBackColor = new GradientColor(this.GradientBackColor.StartColor, this.GradientBackColor.EndColor, this.GradientBackColor.FillDirection); template.UseGradient = this.UseGradient; template.UseTemplateBackground = this.UseTemplateBackground; template.Height = this.Height; template.Name = this.Name; return template; }
public CellCollection(NodeTemplate rt) { this.m_Owner = rt; }