Пример #1
0
 protected virtual TextFormatting GetFormatting(TreeListNode node, TreeListColumn column)
 {
     return(column.CellFormat);
 }
Пример #2
0
        protected virtual void PaintNode(Graphics dc, Rectangle rowRect, TreeListNode node, TreeListColumn[] visibleColumns, int visibleRowIndex)
        {
            CellPainter.DrawSelectionBackground(dc, rowRect, node);
            foreach (TreeListColumn col in visibleColumns)
            {
                if (col.CalculatedRect.Right - HScrollValue() < RowHeaderWidth())
                {
                    continue;
                }

                Rectangle cellRect = rowRect;
                cellRect.X     = col.CalculatedRect.X - HScrollValue();
                cellRect.Width = col.CalculatedRect.Width;

                if (col.VisibleIndex == 0)
                {
                    int lineindet = 10;
                    // add left margin
                    cellRect.X     += Columns.Options.LeftMargin;
                    cellRect.Width -= Columns.Options.LeftMargin;

                    // add indent size
                    int indentSize = GetIndentSize(node) + 5;
                    cellRect.X     += indentSize;
                    cellRect.Width -= indentSize;
                    if (ViewOptions.ShowLine)
                    {
                        PaintLines(dc, cellRect, node);
                    }
                    cellRect.X     += lineindet;
                    cellRect.Width -= lineindet;

                    Rectangle glyphRect = GetPlusMinusRectangle(node, col, visibleRowIndex);
                    if (glyphRect != Rectangle.Empty && ViewOptions.ShowPlusMinus)
                    {
                        CellPainter.PaintCellPlusMinus(dc, glyphRect, node);
                    }

                    if (!ViewOptions.ShowLine && !ViewOptions.ShowPlusMinus)
                    {
                        cellRect.X     -= (lineindet + 5);
                        cellRect.Width += (lineindet + 5);
                    }

                    Image icon = GetNodeBitmap(node);
                    if (icon != null)
                    {
                        // center the image vertically
                        glyphRect.Y      = cellRect.Y + (cellRect.Height / 2) - (icon.Height / 2);
                        glyphRect.X      = cellRect.X;
                        glyphRect.Width  = icon.Width;
                        glyphRect.Height = icon.Height;


                        PaintImage(dc, glyphRect, node, icon);
                        cellRect.X     += (glyphRect.Width + 2);
                        cellRect.Width -= (glyphRect.Width + 2);
                    }
                    PaintCell(dc, cellRect, node, col);
                }
                else
                {
                    PaintCell(dc, cellRect, node, col);
                }
            }
        }
Пример #3
0
 public virtual void OnNotifyAfterExpand(TreeListNode node, bool isExpanded)
 {
     raiseNotifyAfterExpand(node, isExpanded);
 }
Пример #4
0
 protected virtual void OnAfterSelect(TreeListNode node)
 {
     raiseAfterSelect(node);
 }
Пример #5
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            TreeListNode newnode = null;

            if (e.KeyCode == Keys.PageUp)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, -diff);
                if (newnode == null)
                {
                    newnode = Nodes.FirstVisibleNode();
                }
            }
            if (e.KeyCode == Keys.PageDown)
            {
                int remainder = 0;
                int diff      = MaxVisibleRows(out remainder) - 1;
                newnode = NodeCollection.GetNextNode(FocusedNode, diff);
                if (newnode == null)
                {
                    newnode = Nodes.LastVisibleNode(true);
                }
            }

            if (e.KeyCode == Keys.Down)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, 1);
            }
            if (e.KeyCode == Keys.Up)
            {
                newnode = NodeCollection.GetNextNode(FocusedNode, -1);
            }
            if (e.KeyCode == Keys.Home)
            {
                newnode = Nodes.FirstNode;
            }
            if (e.KeyCode == Keys.End)
            {
                newnode = Nodes.LastVisibleNode(true);
            }
            if (e.KeyCode == Keys.Left)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded)
                    {
                        FocusedNode.Collapse();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Parent != null)
                    {
                        FocusedNode = FocusedNode.Parent;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (e.KeyCode == Keys.Right)
            {
                if (FocusedNode != null)
                {
                    if (FocusedNode.Expanded == false && FocusedNode.HasChildren)
                    {
                        FocusedNode.Expand();
                        EnsureVisible(FocusedNode);
                        return;
                    }
                    if (FocusedNode.Expanded == true && FocusedNode.HasChildren)
                    {
                        FocusedNode = FocusedNode.Nodes.FirstNode;
                        EnsureVisible(FocusedNode);
                    }
                }
            }
            if (newnode != null)
            {
                if (MultiSelect)
                {
                    // tree behavior is
                    // keys none,		the selected node is added as the focused and selected node
                    // keys control,	only focused node is moved, the selected nodes collection is not modified
                    // keys shift,		selection from first selected node to current node is done
                    if (Control.ModifierKeys == Keys.Control)
                    {
                        FocusedNode = newnode;
                    }
                    else
                    {
                        MultiSelectAdd(newnode, Control.ModifierKeys);
                    }
                }
                else
                {
                    FocusedNode = newnode;
                }
                EnsureVisible(FocusedNode);
            }
            base.OnKeyDown(e);
        }
Пример #6
0
 public virtual void OnNotifyBeforeExpand(TreeListNode node, bool isExpanding)
 {
     raiseNotifyBeforeExpand(node, isExpanding);
 }
Пример #7
0
 public void Reset()
 {
     m_current = null;
 }
Пример #8
0
 public NodeCollection(TreeListNode owner)
 {
     m_owner = owner;
 }
Пример #9
0
 public virtual void NodetifyAfterExpand(TreeListNode nodeToExpand, bool expanding)
 {
 }
Пример #10
0
 public NodesEnumerator(TreeListNode firstNode)
 {
     m_firstNode = firstNode;
 }
Пример #11
0
 public virtual void NodetifyBeforeExpand(TreeListNode nodeToExpand, bool expanding)
 {
 }
Пример #12
0
 public override void NodetifyAfterExpand(TreeListNode nodeToExpand, bool expanded)
 {
     m_tree.OnNotifyAfterExpand(nodeToExpand, expanded);
 }
Пример #13
0
 public bool Contains(TreeListNode node)
 {
     return(m_nodesMap.ContainsKey(node));
 }
Пример #14
0
 public void Remove(TreeListNode node)
 {
     m_nodes.Remove(node);
     m_nodesMap.Remove(node);
 }
Пример #15
0
 public void Add(TreeListNode node)
 {
     m_nodes.Add(node);
     m_nodesMap.Add(node, 0);
 }