protected virtual TextFormatting GetFormatting(TreeListNode node, TreeListColumn column) { return(column.CellFormat); }
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); } } }
public virtual void OnNotifyAfterExpand(TreeListNode node, bool isExpanded) { raiseNotifyAfterExpand(node, isExpanded); }
protected virtual void OnAfterSelect(TreeListNode node) { raiseAfterSelect(node); }
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); }
public virtual void OnNotifyBeforeExpand(TreeListNode node, bool isExpanding) { raiseNotifyBeforeExpand(node, isExpanding); }
public void Reset() { m_current = null; }
public NodeCollection(TreeListNode owner) { m_owner = owner; }
public virtual void NodetifyAfterExpand(TreeListNode nodeToExpand, bool expanding) { }
public NodesEnumerator(TreeListNode firstNode) { m_firstNode = firstNode; }
public virtual void NodetifyBeforeExpand(TreeListNode nodeToExpand, bool expanding) { }
public override void NodetifyAfterExpand(TreeListNode nodeToExpand, bool expanded) { m_tree.OnNotifyAfterExpand(nodeToExpand, expanded); }
public bool Contains(TreeListNode node) { return(m_nodesMap.ContainsKey(node)); }
public void Remove(TreeListNode node) { m_nodes.Remove(node); m_nodesMap.Remove(node); }
public void Add(TreeListNode node) { m_nodes.Add(node); m_nodesMap.Add(node, 0); }