public GridPositionData(PropertyGridView gridView) { selectedItemTree = gridView.GetGridEntryHierarchy(gridView.selectedGridEntry); expandedState = gridView.SaveHierarchyState(gridView.topLevelGridEntries); itemRow = gridView.selectedRow; itemCount = gridView.totalProps; }
public CategoryGridEntry(PropertyGrid ownerGrid, GridEntry peParent, string name, GridEntry[] childGridEntries) : base(ownerGrid, peParent) { this.name = name; #if DEBUG for (int n = 0; n < childGridEntries.Length; n++) { Debug.Assert(childGridEntries[n] != null, "Null item in category subproperty list"); } #endif if (categoryStates == null) { categoryStates = new Hashtable(); } lock (categoryStates) { if (!categoryStates.ContainsKey(name)) { categoryStates.Add(name, true); } } IsExpandable = true; for (int i = 0; i < childGridEntries.Length; i++) { childGridEntries[i].ParentGridEntry = this; } ChildCollection = new GridEntryCollection(this, childGridEntries); lock (categoryStates) { InternalExpanded = (bool)categoryStates[name]; } SetFlag(GridEntry.FLAG_LABEL_BOLD, true); }
internal void UpdateSelection() { if (!GetFlag(PropertiesChanged)) { return; } if (viewTabs == null) { return; } string tabName = viewTabs[selectedViewTab].TabName + propertySortValue.ToString(); if (viewTabProps != null && viewTabProps.ContainsKey(tabName)) { peMain = (GridEntry)viewTabProps[tabName]; if (peMain != null) { peMain.Refresh(); } } else { if (currentObjects != null && currentObjects.Length > 0) { peMain = (GridEntry)GridEntry.Create(gridView, currentObjects, new PropertyGridServiceProvider(this), designerHost, this.SelectedTab, propertySortValue); } else { peMain = null; } if (peMain == null) { currentPropEntries = new GridEntryCollection(null, new GridEntry[0]); gridView.ClearProps(); return; } if (BrowsableAttributes != null) { peMain.BrowsableAttributes = BrowsableAttributes; } if (viewTabProps == null) { viewTabProps = new Hashtable(); } viewTabProps[tabName] = peMain; } // get entries. currentPropEntries = peMain.Children; peDefault = peMain.DefaultChild; gridView.Invalidate(); }
private GridEntry FindEquivalentGridEntry(GridEntryCollection ipeHier) { if ((ipeHier == null) || (ipeHier.Count == 0)) { return null; } GridEntryCollection allGridEntries = this.GetAllGridEntries(); if ((allGridEntries == null) || (allGridEntries.Count == 0)) { return null; } GridEntry gridEntry = null; int index = 0; int count = allGridEntries.Count; for (int i = 0; i < ipeHier.Count; i++) { if (ipeHier[i] == null) { continue; } if (gridEntry != null) { int num1 = allGridEntries.Count; if (!gridEntry.InternalExpanded) { this.SetExpand(gridEntry, true); allGridEntries = this.GetAllGridEntries(); } count = gridEntry.VisibleChildCount; } int num4 = index; gridEntry = null; while ((index < allGridEntries.Count) && ((index - num4) <= count)) { if (ipeHier.GetEntry(i).NonParentEquals(allGridEntries[index])) { gridEntry = allGridEntries.GetEntry(index); index++; break; } index++; } if (gridEntry == null) { return gridEntry; } } return gridEntry; }
public void ClearProps() { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:ClearProps"); if (!HasEntries) { return; } CommonEditorHide(); topLevelGridEntries = null; ClearGridEntryEvents(allGridEntries, 0, -1); allGridEntries = null; selectedRow = -1; //selectedGridEntry = null; // we don't wanna clear this because then we can't save where we were on a Refresh() tipInfo = -1; }
/// <include file='doc\GridEntry.uex' path='docs/doc[@for="GridEntry.DisposeChildren"]/*' /> /// <devdoc> /// Disposes the array of children /// </devdoc> public virtual void DisposeChildren() { if (childCollection != null) { childCollection.Dispose(); childCollection = null; } }
internal ArrayList SaveHierarchyState(GridEntryCollection entries) { return SaveHierarchyState(entries, null); }
private int GetGridEntriesFromOutline(GridEntryCollection rgipe, int cCur, int cTarget, GridEntry[] rgipeTarget) { if ((rgipe != null) && (rgipe.Count != 0)) { cCur--; for (int i = 0; i < rgipe.Count; i++) { cCur++; if (cCur >= (cTarget + rgipeTarget.Length)) { return cCur; } GridEntry entry = rgipe.GetEntry(i); if (cCur >= cTarget) { rgipeTarget[cCur - cTarget] = entry; } if (entry.InternalExpanded) { GridEntryCollection children = entry.Children; if ((children != null) && (children.Count > 0)) { cCur = this.GetGridEntriesFromOutline(children, cCur + 1, cTarget, rgipeTarget); } } } } return cCur; }
private int CountPropsFromOutline(GridEntryCollection rgipes) { if (rgipes == null) { return 0; } int count = rgipes.Count; for (int i = 0; i < rgipes.Count; i++) { if (((GridEntry) rgipes[i]).InternalExpanded) { count += this.CountPropsFromOutline(((GridEntry) rgipes[i]).Children); } } return count; }
protected virtual void RecalculateProps() { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:RecalculateProps"); int props = CountPropsFromOutline(topLevelGridEntries); if (totalProps != props) { totalProps = props; ClearGridEntryEvents(allGridEntries, 0, -1); allGridEntries = null; } }
private void Refresh(bool fullRefresh, int rowStart, int rowEnd) { this.SetFlag(1, true); GridEntry gridEntry = null; if (!base.IsDisposed) { bool fPageIn = true; if (rowStart == -1) { rowStart = 0; } if (fullRefresh || this.ownerGrid.HavePropEntriesChanged()) { if ((this.HasEntries && !this.GetInPropertySet()) && !this.Commit()) { this.OnEscape(this); } int totalProps = this.totalProps; object obj2 = ((this.topLevelGridEntries == null) || (this.topLevelGridEntries.Count == 0)) ? null : ((GridEntry) this.topLevelGridEntries[0]).GetValueOwner(); if (fullRefresh) { this.ownerGrid.RefreshProperties(true); } if ((totalProps > 0) && !this.GetFlag(0x200)) { this.positionData = this.CaptureGridPositionData(); this.CommonEditorHide(true); } this.UpdateHelpAttributes(this.selectedGridEntry, null); this.selectedGridEntry = null; this.SetFlag(2, true); this.topLevelGridEntries = this.ownerGrid.GetPropEntries(); this.ClearGridEntryEvents(this.allGridEntries, 0, -1); this.allGridEntries = null; this.RecalculateProps(); int num2 = this.totalProps; if (num2 > 0) { if (num2 < totalProps) { this.SetScrollbarLength(); this.SetScrollOffset(0); } this.SetConstants(); if (this.positionData != null) { gridEntry = this.positionData.Restore(this); object obj3 = ((this.topLevelGridEntries == null) || (this.topLevelGridEntries.Count == 0)) ? null : ((GridEntry) this.topLevelGridEntries[0]).GetValueOwner(); fPageIn = ((gridEntry == null) || (totalProps != num2)) || (obj3 != obj2); } if (gridEntry == null) { gridEntry = this.ownerGrid.GetDefaultGridEntry(); this.SetFlag(0x200, (gridEntry == null) && (this.totalProps > 0)); } this.InvalidateRows(rowStart, rowEnd); if (gridEntry == null) { this.selectedRow = 0; this.selectedGridEntry = this.GetGridEntryFromRow(this.selectedRow); } } else { if (totalProps == 0) { return; } this.SetConstants(); } this.positionData = null; this.lastClickedEntry = null; } if (!this.HasEntries) { this.CommonEditorHide(this.selectedRow != -1); this.ownerGrid.SetStatusBox(null, null); this.SetScrollOffset(0); this.selectedRow = -1; base.Invalidate(); } else { this.ownerGrid.ClearValueCaches(); this.InvalidateRows(rowStart, rowEnd); if (gridEntry != null) { this.SelectGridEntry(gridEntry, fPageIn); } } } }
internal bool CommitValue(GridEntry ipeCur, object value) { int childCount = ipeCur.ChildCount; bool hookMouseDown = this.Edit.HookMouseDown; object oldValue = null; try { oldValue = ipeCur.PropertyValue; } catch { } try { this.SetFlag(0x10, true); if ((ipeCur != null) && ipeCur.Enumerable) { this.CloseDropDown(); } try { this.Edit.DisableMouseHook = true; ipeCur.PropertyValue = value; } finally { this.Edit.DisableMouseHook = false; this.Edit.HookMouseDown = hookMouseDown; } } catch (Exception exception) { this.SetCommitError(1); this.ShowInvalidMessage(ipeCur.PropertyLabel, value, exception); return false; } finally { this.SetFlag(0x10, false); } this.SetCommitError(0); string propertyTextValue = ipeCur.GetPropertyTextValue(); if (!string.Equals(propertyTextValue, this.Edit.Text)) { this.Edit.Text = propertyTextValue; this.Edit.SelectionStart = 0; this.Edit.SelectionLength = 0; } this.originalTextValue = propertyTextValue; this.UpdateResetCommand(ipeCur); if (ipeCur.ChildCount != childCount) { this.ClearGridEntryEvents(this.allGridEntries, 0, -1); this.allGridEntries = null; this.SelectGridEntry(ipeCur, true); } if (ipeCur.Disposed) { bool flag2 = (this.edit != null) && this.edit.Focused; this.SelectGridEntry(ipeCur, true); ipeCur = this.selectedGridEntry; if (flag2 && (this.edit != null)) { this.edit.Focus(); } } this.ownerGrid.OnPropertyValueSet(ipeCur, oldValue); return true; }
protected virtual void RecalculateProps() { int num = this.CountPropsFromOutline(this.topLevelGridEntries); if (this.totalProps != num) { this.totalProps = num; this.ClearGridEntryEvents(this.allGridEntries, 0, -1); this.allGridEntries = null; } }
public void ClearProps() { if (this.HasEntries) { this.CommonEditorHide(); this.topLevelGridEntries = null; this.ClearGridEntryEvents(this.allGridEntries, 0, -1); this.allGridEntries = null; this.selectedRow = -1; this.tipInfo = -1; } }
private void ClearGridEntryEvents(GridEntryCollection ipeArray, int startIndex, int count) { if (ipeArray != null) { if (count == -1) { count = ipeArray.Count - startIndex; } for (int i = startIndex; i < (startIndex + count); i++) { if (ipeArray[i] != null) { GridEntry entry = ipeArray.GetEntry(i); entry.RemoveOnValueClick(this.ehValueClick); entry.RemoveOnLabelClick(this.ehLabelClick); entry.RemoveOnOutlineClick(this.ehOutlineClick); entry.RemoveOnOutlineDoubleClick(this.ehOutlineClick); entry.RemoveOnValueDoubleClick(this.ehValueDblClick); entry.RemoveOnLabelDoubleClick(this.ehLabelDblClick); entry.RemoveOnRecreateChildren(this.ehRecreateChildren); } } } }
private GridEntryCollection GetAllGridEntries(bool fUpdateCache) { if (visibleRows == -1 || totalProps == -1 || !HasEntries) { return null; } if (allGridEntries != null && !fUpdateCache) { return allGridEntries; } GridEntry[] rgipes = new GridEntry[totalProps]; try { GetGridEntriesFromOutline(topLevelGridEntries, 0, 0, rgipes); } catch (Exception ex) { Debug.Fail(ex.ToString()); } allGridEntries = new GridEntryCollection(null, rgipes); AddGridEntryEvents(allGridEntries, 0, -1); return allGridEntries; }
protected override void Dispose(bool disposing) { if (disposing) { if (this.scrollBar != null) { this.scrollBar.Dispose(); } if (this.listBox != null) { this.listBox.Dispose(); } if (this.dropDownHolder != null) { this.dropDownHolder.Dispose(); } this.scrollBar = null; this.listBox = null; this.dropDownHolder = null; this.ownerGrid = null; this.topLevelGridEntries = null; this.allGridEntries = null; this.serviceProvider = null; this.topHelpService = null; if ((this.helpService != null) && (this.helpService is IDisposable)) { ((IDisposable) this.helpService).Dispose(); } this.helpService = null; if (this.edit != null) { this.edit.Dispose(); this.edit = null; } if (this.fontBold != null) { this.fontBold.Dispose(); this.fontBold = null; } if (this.btnDropDown != null) { this.btnDropDown.Dispose(); this.btnDropDown = null; } if (this.btnDialog != null) { this.btnDialog.Dispose(); this.btnDialog = null; } if (this.toolTip != null) { this.toolTip.Dispose(); this.toolTip = null; } } base.Dispose(disposing); }
private /*protected virtual*/ int GetGridEntriesFromOutline(GridEntryCollection rgipe, int cCur, int cTarget, GridEntry[] rgipeTarget) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:GetGridEntriesFromOutline"); if (rgipe == null || rgipe.Count == 0) return cCur; cCur--; // want to account for each entry as we find it. for (int cLocal = 0; cLocal < rgipe.Count; cLocal++) { cCur++; if (cCur >= cTarget + rgipeTarget.Length) break; GridEntry ipeCur = rgipe.GetEntry(cLocal); //Debug.Assert(ipeCur != null, "Null IPE at position " + cLocal.ToString()); if (cCur >= cTarget) rgipeTarget[cCur - cTarget] = ipeCur; if (ipeCur.InternalExpanded) { GridEntryCollection subGridEntry = ipeCur.Children; //Debug.Assert(subGridEntry != null && subGridEntry.Length > 0 && subGridEntry[0] != null, "Expanded property " + ipeCur.PropertyLabel + " has no children!"); if (subGridEntry != null && subGridEntry.Count > 0) { cCur = GetGridEntriesFromOutline(subGridEntry, cCur+1,cTarget,rgipeTarget); } } } return cCur; }
internal bool CommitValue(GridEntry ipeCur, object value) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:CommitValue(" + (value==null ? "null" :value.ToString()) + ")"); int propCount = ipeCur.ChildCount; bool capture = Edit.HookMouseDown; object originalValue = null; try { originalValue = ipeCur.PropertyValue; } catch { // if the getter is failing, we still want to let // the set happen. } try { try { SetFlag(FlagInPropertySet, true); //if this propentry is enumerable, then once a value is selected from the editor, //we'll want to close the drop down (like true/false). Otherwise, if we're //working with Anchor for ex., then we should be able to select different values //from the editor, without having it close every time. if (ipeCur != null && ipeCur.Enumerable) { CloseDropDown(); } try { Edit.DisableMouseHook = true; ipeCur.PropertyValue = value; } finally { Edit.DisableMouseHook = false; Edit.HookMouseDown = capture; } } catch (Exception ex) { SetCommitError(ERROR_THROWN); ShowInvalidMessage(ipeCur.PropertyLabel, value, ex); return false; } } finally { SetFlag(FlagInPropertySet, false); } SetCommitError(ERROR_NONE); string text = ipeCur.GetPropertyTextValue(); if (!String.Equals(text, Edit.Text)) { Edit.Text = text; Edit.SelectionStart = 0; Edit.SelectionLength = 0; } originalTextValue = text; // Update our reset command. // UpdateResetCommand(ipeCur); if (ipeCur.ChildCount != propCount) { ClearGridEntryEvents(allGridEntries, 0, -1); allGridEntries = null; SelectGridEntry(ipeCur, true); } // in case this guy got disposed... if (ipeCur.Disposed) { bool editfocused = (edit != null && edit.Focused); // reselect the row to find the replacement. // SelectGridEntry(ipeCur, true); ipeCur = selectedGridEntry; if (editfocused && edit != null) { edit.Focus(); } } this.ownerGrid.OnPropertyValueSet(ipeCur, originalValue); return true; }
private void Refresh(bool fullRefresh, int rowStart, int rowEnd) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:Refresh"); Debug.WriteLineIf(GridViewDebugPaint.TraceVerbose, "Refresh called for rows " + rowStart.ToString(CultureInfo.InvariantCulture) + " through " + rowEnd.ToString(CultureInfo.InvariantCulture)); SetFlag(FlagNeedsRefresh, true); GridEntry gridEntry = null; // VSWhidbey 361345 -- there are cases here where the grid could get be disposed. // so just bail. if (this.IsDisposed) { return; } bool pageInGridEntry = true; if (rowStart == -1) { rowStart = 0; } if (fullRefresh || this.ownerGrid.HavePropEntriesChanged()) { if (HasEntries && !GetInPropertySet() && !Commit()) { OnEscape(this); } int oldLength = totalProps; object oldObject = topLevelGridEntries == null || topLevelGridEntries.Count == 0 ? null : ((GridEntry)topLevelGridEntries[0]).GetValueOwner(); // walk up to the main IPE and refresh it. if (fullRefresh) { this.ownerGrid.RefreshProperties(true); } if (oldLength > 0 && !GetFlag(FlagNoDefault)) { positionData = CaptureGridPositionData(); CommonEditorHide(true); } UpdateHelpAttributes(selectedGridEntry, null); selectedGridEntry = null; SetFlag(FlagIsNewSelection, true); topLevelGridEntries = this.ownerGrid.GetPropEntries(); ClearGridEntryEvents(allGridEntries, 0, -1); allGridEntries = null; RecalculateProps(); int newLength = totalProps; if (newLength > 0) { if (newLength < oldLength) { SetScrollbarLength(); SetScrollOffset(0); } SetConstants(); if (positionData != null) { gridEntry = positionData.Restore(this); // Upon restoring the grid entry position, we don't // want to page it in // object newObject = topLevelGridEntries == null || topLevelGridEntries.Count == 0 ? null : ((GridEntry)topLevelGridEntries[0]).GetValueOwner(); pageInGridEntry = (gridEntry == null) || oldLength != newLength || newObject != oldObject; } if (gridEntry == null) { gridEntry = this.ownerGrid.GetDefaultGridEntry(); SetFlag(FlagNoDefault, gridEntry == null && totalProps > 0); } InvalidateRows(rowStart, rowEnd); if (gridEntry == null) { selectedRow = 0; selectedGridEntry = GetGridEntryFromRow(selectedRow); } } else if (oldLength == 0) { return; } else { SetConstants(); } // Release the old positionData which contains reference to previous selected objects. positionData = null; lastClickedEntry = null; } if (!HasEntries) { CommonEditorHide(selectedRow != -1); this.ownerGrid.SetStatusBox(null, null); SetScrollOffset(0); selectedRow = -1; Invalidate(); return; } // in case we added or removed properties ownerGrid.ClearValueCaches(); InvalidateRows(rowStart, rowEnd); if (gridEntry != null) { SelectGridEntry(gridEntry, pageInGridEntry); } }
private void AddGridEntryEvents(GridEntryCollection ipeArray, int startIndex, int count) { if (ipeArray == null) { return; } if (count == -1) { count = ipeArray.Count - startIndex; } for (int i= startIndex; i < (startIndex + count); i++) { if (ipeArray[i] != null) { GridEntry ge = ipeArray.GetEntry(i); ge.AddOnValueClick(ehValueClick); ge.AddOnLabelClick(ehLabelClick); ge.AddOnOutlineClick(ehOutlineClick); ge.AddOnOutlineDoubleClick(ehOutlineClick); ge.AddOnValueDoubleClick(ehValueDblClick); ge.AddOnLabelDoubleClick(ehLabelDblClick); ge.AddOnRecreateChildren(ehRecreateChildren); } } }
private ArrayList SaveHierarchyState(GridEntryCollection entries, ArrayList expandedItems) { if (entries == null) { return new ArrayList(); } if (expandedItems == null) { expandedItems = new ArrayList(); } for (int i = 0; i < entries.Count; i++) { if (((GridEntry)entries[i]).InternalExpanded) { GridEntry entry = entries.GetEntry(i); expandedItems.Add(GetGridEntryHierarchy(entry.Children.GetEntry(0))); SaveHierarchyState(entry.Children, expandedItems); } } return expandedItems; }
private GridEntryCollection GetAllGridEntries(bool fUpdateCache) { if (((this.visibleRows == -1) || (this.totalProps == -1)) || !this.HasEntries) { return null; } if ((this.allGridEntries == null) || fUpdateCache) { GridEntry[] rgipeTarget = new GridEntry[this.totalProps]; try { this.GetGridEntriesFromOutline(this.topLevelGridEntries, 0, 0, rgipeTarget); } catch (Exception) { } this.allGridEntries = new GridEntryCollection(null, rgipeTarget); this.AddGridEntryEvents(this.allGridEntries, 0, -1); } return this.allGridEntries; }
protected virtual bool CreateChildren(bool diffOldChildren) { if (!this.GetFlagSet(0x20000)) { if (this.childCollection != null) { this.childCollection.Clear(); } else { this.childCollection = new GridEntryCollection(this, new GridEntry[0]); } return false; } if ((!diffOldChildren && (this.childCollection != null)) && (this.childCollection.Count > 0)) { return true; } GridEntry[] entryArray = this.GetPropEntries(this, this.PropertyValue, this.PropertyType); bool flag = (entryArray != null) && (entryArray.Length > 0); if ((diffOldChildren && (this.childCollection != null)) && (this.childCollection.Count > 0)) { bool flag2 = true; if (entryArray.Length == this.childCollection.Count) { for (int i = 0; i < entryArray.Length; i++) { if (!entryArray[i].NonParentEquals(this.childCollection[i])) { flag2 = false; break; } } } else { flag2 = false; } if (flag2) { return true; } } if (!flag) { this.SetFlag(0x80000, true); if (this.childCollection != null) { this.childCollection.Clear(); } else { this.childCollection = new GridEntryCollection(this, new GridEntry[0]); } if (this.InternalExpanded) { this.InternalExpanded = false; } return flag; } if (this.childCollection != null) { this.childCollection.Clear(); this.childCollection.AddRange(entryArray); return flag; } this.childCollection = new GridEntryCollection(this, entryArray); return flag; }
private void ClearGridEntryEvents(GridEntryCollection ipeArray, int startIndex, int count) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:ClearGridEntryEvents"); if (ipeArray == null) { return; } if (count == -1) { count = ipeArray.Count - startIndex; } for (int i = startIndex ; i < (startIndex + count); i++) { if (ipeArray[i] != null) { GridEntry ge = ipeArray.GetEntry(i); ge.RemoveOnValueClick(ehValueClick); ge.RemoveOnLabelClick(ehLabelClick); ge.RemoveOnOutlineClick(ehOutlineClick); ge.RemoveOnOutlineDoubleClick(ehOutlineClick); ge.RemoveOnValueDoubleClick(ehValueDblClick); ge.RemoveOnLabelDoubleClick(ehLabelDblClick); ge.RemoveOnRecreateChildren(ehRecreateChildren); } } }
public virtual void DisposeChildren() { if (this.childCollection != null) { this.childCollection.Dispose(); this.childCollection = null; } }
/// <include file='doc\GridEntry.uex' path='docs/doc[@for="GridEntry.CreateChildren1"]/*' /> /// <devdoc> /// Populates the children of this grid entry /// </devdoc> protected virtual bool CreateChildren(bool diffOldChildren) { Debug.Assert(!Disposed, "Why are we creating children after we are disposed?"); if (!GetFlagSet(FL_EXPANDABLE)) { if (this.childCollection != null) { this.childCollection.Clear(); } else { this.childCollection = new GridEntryCollection(this, new GridEntry[0]); } return false; } if (!diffOldChildren && childCollection != null && childCollection.Count > 0) { return true; } GridEntry [] childProps = GetPropEntries(this, this.PropertyValue, this.PropertyType); bool fExpandable = (childProps != null && childProps.Length > 0); if (diffOldChildren && childCollection != null && childCollection.Count > 0) { bool same = true; if (childProps.Length == childCollection.Count) { for (int i = 0; i < childProps.Length; i++) { if (!childProps[i].NonParentEquals(childCollection[i])) { same = false; break; } } } else { same = false; } if (same) { return true; } } if (!fExpandable) { SetFlag(FL_EXPANDABLE_FAILED,true); if (this.childCollection != null) { this.childCollection.Clear(); } else { this.childCollection = new GridEntryCollection(this, new GridEntry[0]); } if (this.InternalExpanded) { this.InternalExpanded = false; } } else { if (this.childCollection != null) { this.childCollection.Clear(); this.childCollection.AddRange(childProps); } else { this.childCollection = new GridEntryCollection(this, childProps); } } return fExpandable; }
private /*protected virtual*/ int CountPropsFromOutline(GridEntryCollection rgipes) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:CountPropsFromOutLine"); if (rgipes == null) return 0; int cProps = rgipes.Count; for (int i = 0; i < rgipes.Count; i++) { if (((GridEntry)rgipes[i]).InternalExpanded) cProps += CountPropsFromOutline(((GridEntry)rgipes[i]).Children); } return cProps; }
/// <include file='doc\PropertyGrid.uex' path='docs/doc[@for="PropertyGrid.Dispose"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> protected override void Dispose(bool disposing) { if (disposing) { // Unhook IDesignerEventService.ActiveDesignerChanged event // if (GetFlag(GotDesignerEventService)) { Debug.Assert(designerEventService != null, "GetFlag(GotDesignerEventService) inconsistent with designerEventService == null"); if (designerEventService != null) { designerEventService.ActiveDesignerChanged -= new ActiveDesignerEventHandler(this.OnActiveDesignerChanged); } designerEventService = null; SetFlag(GotDesignerEventService, false); } this.ActiveDesigner = null; if (viewTabs != null) { for (int i = 0; i < viewTabs.Length; i++) { viewTabs[i].Dispose(); } viewTabs = null; } if (imageList != null) { for (int i = 0; i < imageList.Length; i++) { if(imageList[i] != null) { imageList[i].Dispose(); } } imageList = null; } if (bmpAlpha != null) { bmpAlpha.Dispose(); bmpAlpha = null; } if (bmpCategory != null) { bmpCategory.Dispose(); bmpCategory = null; } if (bmpPropPage != null) { bmpPropPage.Dispose(); bmpPropPage = null; } if (lineBrush != null) { lineBrush.Dispose(); lineBrush = null; } if (peMain != null) { peMain.Dispose(); peMain = null; } if (currentObjects != null) { currentObjects = null; SinkPropertyNotifyEvents(); } ClearCachedProps(); currentPropEntries = null; } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:Dispose"); if (scrollBar != null) scrollBar.Dispose(); if (listBox != null) listBox.Dispose(); if (dropDownHolder != null) dropDownHolder.Dispose(); scrollBar = null; listBox = null; dropDownHolder = null; ownerGrid = null; topLevelGridEntries = null; allGridEntries = null; serviceProvider = null; topHelpService = null; if (helpService != null && helpService is IDisposable) ((IDisposable)helpService).Dispose(); helpService = null; if (edit != null) { edit.Dispose(); edit = null; } if (fontBold != null) { fontBold.Dispose(); fontBold = null; } if (btnDropDown != null) { btnDropDown.Dispose(); btnDropDown = null; } if (btnDialog != null) { btnDialog.Dispose(); btnDialog = null; } if (toolTip != null) { toolTip.Dispose(); toolTip = null; } } base.Dispose(disposing); }
private /*protected virtual*/ GridEntry FindEquivalentGridEntry(GridEntryCollection ipeHier) { if (ipeHier == null || ipeHier.Count == 0) return null; GridEntryCollection rgipes = GetAllGridEntries(); if (rgipes == null || rgipes.Count == 0) { return null; } GridEntry targetEntry = null; int row = 0; int count = rgipes.Count; for (int i = 0; i < ipeHier.Count; i++) { if (ipeHier[i] == null) { continue; } // if we've got one above, and it's expandable, // expand it if (targetEntry != null) { // how many do we have? int items = rgipes.Count; // expand and get the new count if (!targetEntry.InternalExpanded) { SetExpand(targetEntry, true); rgipes = GetAllGridEntries(); } count = targetEntry.VisibleChildCount; } int start = row; targetEntry = null; // now, we will only go as many as were expanded... for (; row < rgipes.Count && ((row - start) <= count); row++) { if (ipeHier.GetEntry(i).NonParentEquals(rgipes[row])) { targetEntry = rgipes.GetEntry(row); row++; break; } } // didn't find it... if (targetEntry == null) { break; } } return targetEntry; }
public GridPositionData(PropertyGridView gridView) { _selectedItemTree = GetGridEntryHierarchy(gridView._selectedGridEntry); _expandedState = gridView.SaveHierarchyState(gridView.TopLevelGridEntries); _itemRow = gridView._selectedRow; }