/// <summary>
 ///     Should be called by derived classes to indicate that a branch modification (add, remove, reorder) has occurred.
 /// </summary>
 /// <param name="modification">Indicates the type of modification</param>
 protected void DoBranchModification(BranchModificationEventArgs modification)
 {
     if (_onBranchModification != null)
     {
         _onBranchModification(this, modification);
     }
 }
Esempio n. 2
0
 private void OnChildBranchModification(object sender, BranchModificationEventArgs e)
 {
     if (e.Action == BranchModificationAction.DeleteItems
         ||
         e.Action == BranchModificationAction.InsertItems)
     {
         // this can also cause changes in column check box state.  Find and refresh appropriate row
         for (var i = 0; i < _childBranchArray.Length; i++)
         {
             if (_childBranchArray[i].Branch == e.Branch)
             {
                 if (_onBranchModification != null)
                 {
                     _onBranchModification(
                         this,
                         BranchModificationEventArgs.DisplayDataChanged(
                             new DisplayDataChangedData(VirtualTreeDisplayDataChanges.StateImage, this, i, -1, 1)));
                 }
             }
         }
     }
 }
Esempio n. 3
0
 private void OnBranchModification(object sender, BranchModificationEventArgs change)
 {
     //Decode the BranchModification structure to correspond to methods on the
     //tree. One branch can be in multiple trees. This event-based indirection
     //enables the branches to multicast instead of binding directly to a tree..
     ITree tree = this;
     switch (change.Action)
     {
         case BranchModificationAction.DisplayDataChanged:
             {
                 var displayChange = change as BranchModificationEventArgs.BranchModificationDisplayData;
                 tree.DisplayDataChanged(
                     new DisplayDataChangedData(
                         displayChange.Changes, displayChange.Branch, displayChange.Index, displayChange.Column, displayChange.Count));
                 break;
             }
         case BranchModificationAction.Realign:
             tree.Realign(change.Branch);
             break;
         case BranchModificationAction.InsertItems:
             tree.InsertItems(change.Branch, change.Index, change.Count);
             break;
         case BranchModificationAction.DeleteItems:
             tree.DeleteItems(change.Branch, change.Index, change.Count);
             break;
         case BranchModificationAction.MoveItem:
             tree.MoveItem(change.Branch, change.Index, change.Count);
             break;
         case BranchModificationAction.ShiftBranchLevels:
             {
                 var levelChange = change as BranchModificationEventArgs.BranchModificationLevelShift;
                 tree.ShiftBranchLevels(
                     new ShiftBranchLevelsData(
                         change.Branch, levelChange.RemoveLevels, levelChange.InsertLevels, levelChange.Depth,
                         levelChange.ReplacementBranch, levelChange.BranchTester, change.Index, change.Count, levelChange.NewCount));
                 break;
             }
         case BranchModificationAction.Redraw:
             tree.Redraw = change.Flag;
             break;
         case BranchModificationAction.DelayRedraw:
             tree.DelayRedraw = change.Flag;
             break;
         case BranchModificationAction.ListShuffle:
             tree.ListShuffle = change.Flag;
             break;
         case BranchModificationAction.DelayListShuffle:
             tree.DelayListShuffle = change.Flag;
             break;
         case BranchModificationAction.UpdateCellStyle:
             if (MultiColumnSupport)
             {
                 (this as IMultiColumnTree).UpdateCellStyle(change.Branch, change.Index, change.Count, change.Flag);
             }
             break;
         case BranchModificationAction.RemoveBranch:
             tree.RemoveBranch(change.Branch);
             break;
     }
 }
 private void OnInnerBranchModification(object sender, BranchModificationEventArgs args)
 {
     if (OnBranchModification != null)
     {
         args.Index = FindIndexForBranch(args.Branch, args.Index);
         args.Branch = this;
         OnBranchModification(this, args);
     }
 }