Exemplo n.º 1
0
 internal void ResetCachedBounds(NodeTemplate nt)
 {
     foreach (Node node in base.List)
     {
         node.ResetCachedBounds(nt);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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();
            }
        }
Exemplo n.º 8
0
        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));
        }
Exemplo n.º 9
0
        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));
        }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
 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);
     }
 }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
 public void Remove(NodeTemplate value)
 {
     base.List.Remove(value);
 }
Exemplo n.º 15
0
 internal void ResetCachedBounds(NodeTemplate nt)
 {
     foreach (Node node in base.List)
     {
         node.ResetCachedBounds(nt);
     }
 }
Exemplo n.º 16
0
 internal static void DisposeDefaultNodeTemplate()
 {
     s_Default = null;
 }
Exemplo n.º 17
0
 public void Insert(int index, NodeTemplate value)
 {
     base.List.Insert(index, value);
 }
Exemplo n.º 18
0
 public bool Contains(NodeTemplate value)
 {
     return(base.List.Contains(value));
 }
Exemplo n.º 19
0
 public TreeRefreshEventArgs(NodeTemplate nt) : this(nt, true)
 {
 }
Exemplo n.º 20
0
 public int IndexOf(NodeTemplate value)
 {
     return base.List.IndexOf(value);
 }
Exemplo n.º 21
0
 public void Insert(int index, NodeTemplate value)
 {
     base.List.Insert(index, value);
 }
Exemplo n.º 22
0
 public void Remove(NodeTemplate value)
 {
     base.List.Remove(value);
 }
Exemplo n.º 23
0
 public int Add(NodeTemplate value)
 {
     return base.List.Add(value);
 }
Exemplo n.º 24
0
 public bool Contains(NodeTemplate value)
 {
     return base.List.Contains(value);
 }
Exemplo n.º 25
0
 public int Add(NodeTemplate value)
 {
     return(base.List.Add(value));
 }
Exemplo n.º 26
0
 public TreeRefreshEventArgs(NodeTemplate nt)
     : this(nt, true)
 {
 }
Exemplo n.º 27
0
 public int IndexOf(NodeTemplate value)
 {
     return(base.List.IndexOf(value));
 }
Exemplo n.º 28
0
 private TreeRefreshEventArgs(NodeTemplate nt, bool bResetBounds)
     : base(TreeEventArgsType.Refresh, null)
 {
     this.Template = nt;
     this.ResetBounds = bResetBounds;
 }
Exemplo n.º 29
0
 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;
 }
Exemplo n.º 30
0
 public CellCollection(NodeTemplate rt)
 {
     this.m_Owner = rt;
 }
Exemplo n.º 31
0
 internal static void DisposeDefaultNodeTemplate()
 {
     s_Default = null;
 }
Exemplo n.º 32
0
 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);
     }
 }
Exemplo n.º 33
0
 private TreeRefreshEventArgs(NodeTemplate nt, bool bResetBounds) : base(TreeEventArgsType.Refresh, null)
 {
     this.Template    = nt;
     this.ResetBounds = bResetBounds;
 }
Exemplo n.º 34
0
 public CellCollection(NodeTemplate rt)
 {
     this.m_Owner = rt;
 }