public BranchModificationDisplayData(BranchModificationAction action, ref DisplayDataChangedData changeData) { Action = action; Changes = changeData.Changes; Branch = changeData.Branch; Index = changeData.StartRow; Column = changeData.Column; Count = changeData.Count; Flag = false; }
/// <summary> /// The displayed data for the branch has changed, and /// any views on this tree need to be notified. /// </summary> /// <param name="changeData">The DisplayDataChangedData structure</param> /// <returns>An events args object for IBranch.OnBranchModification</returns> public static BranchModificationEventArgs DisplayDataChanged(DisplayDataChangedData changeData) { return new BranchModificationDisplayData(BranchModificationAction.DisplayDataChanged, ref changeData); }
/// <summary> /// The displayed data for the branch has changed, and /// any views on this tree need to be notified. /// </summary> /// <param name="changeData">The DisplayDataChangedData structure</param> /// <returns>An events args object for IBranch.OnBranchModification</returns> public static BranchModificationEventArgs DisplayDataChanged(DisplayDataChangedData changeData) { return(new BranchModificationDisplayData(BranchModificationAction.DisplayDataChanged, ref changeData)); }
void ITree.DisplayDataChanged(DisplayDataChangedData changeData) { (myParent as ITree).DisplayDataChanged(changeData); }
/// <summary> /// The displayed data for the branch has changed, and /// any views on this tree need to be notified. /// </summary> /// <param name="changeData">The DisplayDataChangedData structure</param> protected void DisplayDataChanged(DisplayDataChangedData changeData) { var branch = changeData.Branch; var column = changeData.Column; var changes = changeData.Changes; if (column >= ColumnCount) { return; } var fireNormalEvent = OnDisplayDataChanged != null; var fireSingleColumnEvent = column == 0 && GetStateFlag(TreeStateFlags.FireSingleColumnOnDisplayDataChanged); if (!(fireNormalEvent || fireSingleColumnEvent)) { return; } ITree singleTree = null; SingleColumnView singleView = null; if (fireSingleColumnEvent) { singleTree = SingleColumnTree; singleView = singleTree as SingleColumnView; } var tn = LocateTrackedNode(branch); Debug.Assert(tn != null); //Expect LocateTrackedNode to throw otherwise var coordinate = new VirtualTreeCoordinate(); int prevAbsIndex; int prevAbsIndexSingleColumn; int reportCount; int reportCountSingleColumn; int count; int startRow; int singleColumnSubItemAdjust; //UNDONE: Does firing the event after we get the next node adversely affect the //performance of the node tracking algorithm. while (tn != null) { prevAbsIndex = prevAbsIndexSingleColumn = -2; // Set to -2 so that first diff check is never 1 reportCount = reportCountSingleColumn = 0; if (changeData.StartRow == -1) { startRow = 0; count = tn.ImmedCount; } else { startRow = changeData.StartRow; count = changeData.Count; } while (count > 0) { coordinate = FindAbsoluteIndex(tn, startRow, out singleColumnSubItemAdjust); if (coordinate.IsValid) { if (fireNormalEvent) { if (((coordinate.Row - prevAbsIndex) == 1) || (reportCount == 0)) { ++reportCount; //Wait to fire the event until we find something discontiguous } else { OnDisplayDataChanged( this, new DisplayDataChangedEventArgs( this, changes, prevAbsIndex - reportCount + 1, coordinate.Column + column, reportCount)); reportCount = 1; } prevAbsIndex = coordinate.Row; } if (fireSingleColumnEvent && coordinate.Column == 0) { if (((coordinate.Row - singleColumnSubItemAdjust - prevAbsIndexSingleColumn) == 1) || (reportCountSingleColumn == 0)) { ++reportCountSingleColumn; //Wait to fire the event until we find something discontiguous } else { singleView.myOnDisplayDataChanged( singleTree, new DisplayDataChangedEventArgs( singleTree, changes, prevAbsIndexSingleColumn - reportCountSingleColumn + 1, 0, reportCountSingleColumn)); reportCountSingleColumn = 1; } prevAbsIndexSingleColumn = coordinate.Row - singleColumnSubItemAdjust; } ++startRow; --count; } else { break; } } if (reportCount != 0) { OnDisplayDataChanged( this, new DisplayDataChangedEventArgs( this, changes, prevAbsIndex - reportCount + 1, coordinate.Column + column, reportCount)); } if (reportCountSingleColumn != 0) { singleView.myOnDisplayDataChanged( singleTree, new DisplayDataChangedEventArgs( singleTree, changes, prevAbsIndexSingleColumn - reportCountSingleColumn + 1, 0, reportCountSingleColumn)); } tn = tn.NextNode; } }
void ITree.DisplayDataChanged(DisplayDataChangedData changeData) { DisplayDataChanged(changeData); }