internal void GroupRemoved(TabGroupBase tgb) { // Only modify leaf count when not suspended if (_suspendLeafCount == 0) { // Decrease count of leafs entries for each leaf that exists // which in the hierarchy that is being removed if (tgb.IsLeaf) { _numLeafs--; // Was last leaf removed? if (_numLeafs == 0) { // If at least one leaf then set the value manually so that when the // new one is created and set as active it does not try to process the // old value that has already been destroyed. if (_atLeastOneLeaf) { // Need to get rid of active leaf value _activeLeaf = null; } } } else { TabGroupSequence tgs = tgb as TabGroupSequence; // Recurse into processing each child item for(int i=0; i<tgs.Count; i++) GroupRemoved(tgs[i]); } // Dispose of the group resources tgb.Dispose(); // Mark layout as dirty if (_autoCalculateDirty) _dirty = true; } }