private Rectangle GetEditArea(NodeLayoutInfo nodeLayoutInfo, DataEditor dataEditor) { int height = GetRowHeight(nodeLayoutInfo.Node); int xLeft = TreeWidth; int width = -1; for (int i = 0; i < Columns.Count; ++i) { if (Columns[i].Label == dataEditor.Name) { width = Columns[i].ActualWidth; break; } xLeft += Columns[i].ActualWidth; } Debug.Assert(width>=0); return new Rectangle(xLeft, nodeLayoutInfo.Y, width, height); }
/// <summary> /// Begins a data edit on the given node, if it is editable. /// Otherwise, does nothing.</summary> /// <param name="node">Tree node whose data is to be edited</param> /// <param name="editData"></param> private void BeginDataEdit(Node node, DataEditor editData) { EndDataEdit(); if (editData.ReadOnly) return; m_editData = editData; m_dataEditNode = node; foreach (NodeLayoutInfo info in NodeLayout) { if (info.Node == m_dataEditNode) { m_editData.TextBox = m_editTextBox; m_editData.Bounds = GetEditArea(info, m_editData); m_editData.BeginDataEdit(); Invalidate(); break; } } }
/// <summary> /// Constructor</summary> /// <param name="node">Node that changed</param> /// <param name="editedData">Data that was edited</param> public NodeEditEventArgs(Node node, DataEditor editedData) { Node = node; EditedData = editedData; }