1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/propgrid/propgridpagestate.cpp
3 // Purpose: wxPropertyGridPageState class
4 // Author: Jaakko Salli
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
23 #include "wx/object.h"
25 #include "wx/string.h"
28 #include "wx/window.h"
31 #include "wx/dcmemory.h"
35 #include "wx/stopwatch.h"
38 // This define is necessary to prevent macro clearing
39 #define __wxPG_SOURCE_FILE__
41 #include "wx/propgrid/propgridpagestate.h"
42 #include "wx/propgrid/propgrid.h"
43 #include "wx/propgrid/editors.h"
45 #define wxPG_DEFAULT_SPLITTERX 110
48 // -----------------------------------------------------------------------
49 // wxPropertyGridIterator
50 // -----------------------------------------------------------------------
52 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, wxPGProperty
* property
, int dir
)
54 wxASSERT( dir
== 1 || dir
== -1 );
57 m_baseParent
= state
->DoGetRoot();
58 if ( !property
&& m_baseParent
->GetChildCount() )
59 property
= m_baseParent
->Item(0);
61 m_property
= property
;
63 wxPG_ITERATOR_CREATE_MASKS(flags
, m_itemExMask
, m_parentExMask
)
65 // Need to skip first?
66 if ( property
&& (property
->GetFlags() & m_itemExMask
) )
75 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, int startPos
, int dir
)
77 wxPGProperty
* property
= NULL
;
79 if ( startPos
== wxTOP
)
84 else if ( startPos
== wxBOTTOM
)
86 property
= state
->GetLastItem(flags
);
92 wxFAIL_MSG("Only supported starting positions are wxTOP and wxBOTTOM");
95 Init( state
, flags
, property
, dir
);
98 void wxPropertyGridIteratorBase::Assign( const wxPropertyGridIteratorBase
& it
)
100 m_property
= it
.m_property
;
101 m_state
= it
.m_state
;
102 m_baseParent
= it
.m_baseParent
;
103 m_itemExMask
= it
.m_itemExMask
;
104 m_parentExMask
= it
.m_parentExMask
;
107 void wxPropertyGridIteratorBase::Prev()
109 wxPGProperty
* property
= m_property
;
110 wxASSERT( property
);
112 wxPGProperty
* parent
= property
->GetParent();
114 unsigned int index
= property
->GetIndexInParent();
121 property
= parent
->Item(index
);
123 // Go to last children?
124 if ( property
->GetChildCount() &&
125 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) )
128 property
= property
->Last();
134 if ( parent
== m_baseParent
)
145 m_property
= property
;
147 // If property does not match our criteria, skip it
148 if ( property
->GetFlags() & m_itemExMask
)
152 void wxPropertyGridIteratorBase::Next( bool iterateChildren
)
154 wxPGProperty
* property
= m_property
;
155 wxASSERT( property
);
157 if ( property
->GetChildCount() &&
158 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) &&
162 property
= property
->Item(0);
166 wxPGProperty
* parent
= property
->GetParent();
168 unsigned int index
= property
->GetIndexInParent() + 1;
170 if ( index
< parent
->GetChildCount() )
173 property
= parent
->Item(index
);
177 // Next sibling of parent
178 if ( parent
== m_baseParent
)
191 m_property
= property
;
193 // If property does not match our criteria, skip it
194 if ( property
->GetFlags() & m_itemExMask
)
198 // -----------------------------------------------------------------------
199 // wxPropertyGridPageState
200 // -----------------------------------------------------------------------
202 wxPropertyGridPageState::wxPropertyGridPageState()
205 m_regularArray
.SetParentState(this);
206 m_properties
= &m_regularArray
;
208 m_currentCategory
= NULL
;
211 m_lastCaptionBottomnest
= 1;
215 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
216 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
217 m_fSplitterX
= wxPG_DEFAULT_SPLITTERX
;
219 // By default, we only have the 'value' column editable
220 m_editableColumns
.push_back(1);
223 // -----------------------------------------------------------------------
225 wxPropertyGridPageState::~wxPropertyGridPageState()
230 // -----------------------------------------------------------------------
232 void wxPropertyGridPageState::InitNonCatMode()
236 m_abcArray
= new wxPGRootProperty(wxS("<Root_NonCat>"));
237 m_abcArray
->SetParentState(this);
238 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
241 // Must be called when state::m_properties still points to regularArray.
242 wxPGProperty
* oldProperties
= m_properties
;
244 // Must use temp value in state::m_properties for item iteration loop
245 // to run as expected.
246 m_properties
= &m_regularArray
;
248 if ( m_properties
->GetChildCount() )
251 // Prepare m_abcArray
252 wxPropertyGridIterator
it( this, wxPG_ITERATE_PROPERTIES
);
254 for ( ; !it
.AtEnd(); it
.Next() )
256 wxPGProperty
* p
= it
.GetProperty();
257 wxPGProperty
* parent
= p
->GetParent();
258 if ( parent
->IsCategory() || parent
->IsRoot() )
260 m_abcArray
->DoAddChild(p
);
261 p
->m_parent
= &m_regularArray
;
266 m_properties
= oldProperties
;
269 // -----------------------------------------------------------------------
271 void wxPropertyGridPageState::DoClear()
273 if ( m_pPropGrid
&& m_pPropGrid
->GetState() == this )
275 m_pPropGrid
->ClearSelection(false);
282 m_regularArray
.Empty();
288 m_currentCategory
= NULL
;
289 m_lastCaptionBottomnest
= 1;
296 // -----------------------------------------------------------------------
298 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
300 wxPropertyGrid
* propGrid
= GetGrid();
302 VirtualHeightChanged();
304 // Recalculate caption text extents.
307 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
309 wxPGProperty
* p
=m_regularArray
.Item(i
);
311 if ( p
->IsCategory() )
312 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
316 // -----------------------------------------------------------------------
318 void wxPropertyGridPageState::SetVirtualWidth( int width
)
320 wxASSERT( width
>= 0 );
321 wxPropertyGrid
* pg
= GetGrid();
322 int gw
= pg
->GetClientSize().x
;
329 // -----------------------------------------------------------------------
331 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
333 wxPropertyGrid
* pg
= GetGrid();
335 if ( pg
->HasVirtualWidth() )
337 if ( m_width
< newWidth
)
338 SetVirtualWidth( newWidth
);
340 CheckColumnWidths(widthChange
);
344 SetVirtualWidth( newWidth
);
346 // This should be done before splitter auto centering
347 // NOTE: Splitter auto-centering is done in this function.
350 CheckColumnWidths(widthChange
);
352 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
353 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
355 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
357 // If too long, don't set splitter
358 if ( timeSinceCreation
< 250 )
360 if ( m_properties
->GetChildCount() )
362 SetSplitterLeft( false );
366 DoSetSplitterPosition( newWidth
/ 2 );
367 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
374 // -----------------------------------------------------------------------
375 // wxPropertyGridPageState item iteration methods
376 // -----------------------------------------------------------------------
378 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
380 if ( !m_properties
->GetChildCount() )
383 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
385 // First, get last child of last parent
386 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
387 while ( pwc
->GetChildCount() &&
388 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
389 pwc
= (wxPGProperty
*) pwc
->Last();
391 // Then, if it doesn't fit our criteria, back up until we find something that does
392 if ( pwc
->GetFlags() & itemExMask
)
394 wxPropertyGridIterator
it( this, flags
, pwc
);
395 for ( ; !it
.AtEnd(); it
.Prev() )
397 pwc
= (wxPGProperty
*) it
.GetProperty();
403 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
405 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
406 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
409 parent
= grandparent
;
410 grandparent
= (wxPGProperty
*)parent
->GetParent();
411 if ( parent
->IsCategory() && grandparent
)
412 return (wxPropertyCategory
*)parent
;
413 } while ( grandparent
);
418 // -----------------------------------------------------------------------
419 // wxPropertyGridPageState GetPropertyXXX methods
420 // -----------------------------------------------------------------------
422 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
423 wxPGProperty
* parent
) const
428 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
430 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
432 wxPGProperty
* p
= parent
->Item(i
);
433 if ( p
->m_label
== label
)
435 // Check children recursively.
436 if ( p
->GetChildCount() )
438 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
447 // -----------------------------------------------------------------------
449 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
451 wxPGHashMapS2P::const_iterator it
;
452 it
= m_dictName
.find(name
);
453 if ( it
!= m_dictName
.end() )
454 return (wxPGProperty
*) it
->second
;
458 // -----------------------------------------------------------------------
460 void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty
* p
,
461 const wxString
& newName
)
463 wxCHECK_RET( p
, wxT("invalid property id") );
465 wxPGProperty
* parent
= p
->GetParent();
467 if ( parent
->IsCategory() || parent
->IsRoot() )
469 if ( p
->GetBaseName().length() )
470 m_dictName
.erase( p
->GetBaseName() );
471 if ( newName
.length() )
472 m_dictName
[newName
] = (void*) p
;
475 p
->DoSetName(newName
);
478 // -----------------------------------------------------------------------
479 // wxPropertyGridPageState global operations
480 // -----------------------------------------------------------------------
482 // -----------------------------------------------------------------------
483 // Item iteration macros
484 // NB: Nowadays only needed for alphabetic/categoric mode switching.
485 // -----------------------------------------------------------------------
487 //#define II_INVALID_I 0x00FFFFFF
489 #define ITEM_ITERATION_VARIABLES \
490 wxPGProperty* parent; \
494 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
495 parent = m_properties; \
499 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
500 parent = startparent; \
501 i = (unsigned int)startindex; \
502 if ( parent == NULL ) \
504 parent = state->m_properties; \
509 #define ITEM_ITERATION_LOOP_BEGIN \
512 iMax = parent->GetChildCount(); \
515 wxPGProperty* p = parent->Item(i);
517 #define ITEM_ITERATION_LOOP_END \
518 if ( p->GetChildCount() ) \
521 parent = (wxPGProperty*)p; \
522 iMax = parent->GetChildCount(); \
527 i = parent->m_arrIndex + 1; \
528 parent = parent->m_parent; \
530 while ( parent != NULL );
532 bool wxPropertyGridPageState::EnableCategories( bool enable
)
535 // NB: We can't use wxPropertyGridIterator in this
536 // function, since it depends on m_arrIndexes,
537 // which, among other things, is being fixed here.
539 ITEM_ITERATION_VARIABLES
547 if ( !IsInNonCatMode() )
550 m_properties
= &m_regularArray
;
552 // fix parents, indexes, and depths
553 ITEM_ITERATION_INIT_FROM_THE_TOP
555 ITEM_ITERATION_LOOP_BEGIN
559 p
->m_parent
= parent
;
561 // If parent was category, and this is not,
562 // then the depth stays the same.
563 if ( parent
->IsCategory() &&
565 p
->m_depth
= parent
->m_depth
;
567 p
->m_depth
= parent
->m_depth
+ 1;
569 ITEM_ITERATION_LOOP_END
575 // Disable categories
578 if ( IsInNonCatMode() )
581 // Create array, if necessary.
585 m_properties
= m_abcArray
;
587 // fix parents, indexes, and depths
588 ITEM_ITERATION_INIT_FROM_THE_TOP
590 ITEM_ITERATION_LOOP_BEGIN
594 p
->m_parent
= parent
;
596 p
->m_depth
= parent
->m_depth
+ 1;
598 ITEM_ITERATION_LOOP_END
601 VirtualHeightChanged();
603 if ( m_pPropGrid
->GetState() == this )
604 m_pPropGrid
->RecalculateVirtualSize();
609 // -----------------------------------------------------------------------
611 static int wxPG_SortFunc_ByFunction(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
613 wxPGProperty
*p1
= *pp1
;
614 wxPGProperty
*p2
= *pp2
;
615 wxPropertyGrid
* pg
= p1
->GetGrid();
616 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
617 return sortFunction(pg
, p1
, p2
);
620 static int wxPG_SortFunc_ByLabel(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
622 wxPGProperty
*p1
= *pp1
;
623 wxPGProperty
*p2
= *pp2
;
624 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() );
629 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
634 static bool wxPG_SortFunc_ByFunction(wxPGProperty
*p1
, wxPGProperty
*p2
)
636 wxPropertyGrid
* pg
= p1
->GetGrid();
637 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
638 return sortFunction(pg
, p1
, p2
) < 0;
641 static bool wxPG_SortFunc_ByLabel(wxPGProperty
*p1
, wxPGProperty
*p2
)
643 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() ) < 0;
647 void wxPropertyGridPageState::DoSortChildren( wxPGProperty
* p
,
653 // Can only sort items with children
654 if ( !p
->GetChildCount() )
657 // Never sort children of aggregate properties
658 if ( p
->HasFlag(wxPG_PROP_AGGREGATE
) )
661 if ( (flags
& wxPG_SORT_TOP_LEVEL_ONLY
)
662 && !p
->IsCategory() && !p
->IsRoot() )
665 if ( GetGrid()->GetSortFunction() )
666 p
->m_children
.Sort( wxPG_SortFunc_ByFunction
);
668 p
->m_children
.Sort( wxPG_SortFunc_ByLabel
);
672 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
674 if ( GetGrid()->GetSortFunction() )
675 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
676 wxPG_SortFunc_ByFunction
);
678 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
679 wxPG_SortFunc_ByLabel
);
683 p
->FixIndicesOfChildren();
685 if ( flags
& wxPG_RECURSE
)
687 // Apply sort recursively
688 for ( unsigned int i
=0; i
<p
->GetChildCount(); i
++ )
689 DoSortChildren(p
->Item(i
), flags
);
693 // -----------------------------------------------------------------------
695 void wxPropertyGridPageState::DoSort( int flags
)
697 DoSortChildren( m_properties
, flags
| wxPG_RECURSE
);
699 // We used to sort categories as well here also if in non-categorized
700 // mode, but doing would naturally cause child indices to become
704 // -----------------------------------------------------------------------
706 bool wxPropertyGridPageState::PrepareAfterItemsAdded()
708 if ( !m_itemsAdded
) return false;
710 wxPropertyGrid
* pg
= GetGrid();
714 if ( pg
->HasFlag(wxPG_AUTO_SORT
) )
715 DoSort(wxPG_SORT_TOP_LEVEL_ONLY
);
720 // -----------------------------------------------------------------------
721 // wxPropertyGridPageState splitter, column and hittest functions
722 // -----------------------------------------------------------------------
724 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
731 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
734 // -----------------------------------------------------------------------
736 wxPropertyGridHitTestResult
737 wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
739 wxPropertyGridHitTestResult result
;
740 result
.m_column
= HitTestH( pt
.x
, &result
.m_splitter
,
741 &result
.m_splitterHitOffset
);
742 result
.m_property
= DoGetItemAtY( pt
.y
);
746 // -----------------------------------------------------------------------
748 // Used by SetSplitterLeft() and DotFitColumns()
749 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
754 wxPropertyGrid
* pg
= m_pPropGrid
;
759 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
761 wxPGProperty
* p
= pwc
->Item(i
);
762 if ( !p
->IsCategory() )
764 const wxPGCell
* cell
= NULL
;
766 p
->GetDisplayInfo(col
, -1, 0, &text
, &cell
);
767 dc
.GetTextExtent(text
, &w
, &h
);
769 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
771 // account for the bitmap
773 w
+= p
->GetImageOffset(pg
->GetImageRect(p
, -1).GetWidth());
776 w
+= (wxPG_XBEFORETEXT
*2);
782 if ( p
->GetChildCount() &&
783 ( subProps
|| p
->IsCategory() ) )
785 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
795 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
797 int n
= GetGrid()->m_marginWidth
;
799 for ( i
=0; i
<=splitterColumn
; i
++ )
804 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
806 return wxPG_DRAG_MARGIN
;
809 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
811 int origWidth
= m_colWidths
[column
];
812 m_colWidths
[column
] -= decrease
;
813 int min
= GetColumnMinWidth(column
);
815 if ( m_colWidths
[column
] < min
)
817 more
= decrease
- (origWidth
- min
);
818 m_colWidths
[column
] = min
;
822 // FIXME: Causes erratic splitter changing, so as a workaround
823 // disabled if two or less columns.
825 if ( m_colWidths
.size() <= 2 )
829 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
830 PropagateColSizeDec( column
, more
, dir
);
833 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
835 wxPropertyGrid
* pg
= GetGrid();
837 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
839 if ( !pg
->HasVirtualWidth() )
845 otherColumn
= splitterColumn
+ 1;
846 if ( otherColumn
== (int)m_colWidths
.size() )
848 m_colWidths
[splitterColumn
] += adjust
;
849 PropagateColSizeDec( otherColumn
, adjust
, 1 );
853 otherColumn
= splitterColumn
+ 1;
854 if ( otherColumn
== (int)m_colWidths
.size() )
856 m_colWidths
[otherColumn
] -= adjust
;
857 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
862 m_colWidths
[splitterColumn
] += adjust
;
865 if ( splitterColumn
== 0 )
866 m_fSplitterX
= (double) newXPos
;
868 if ( !fromAutoCenter
)
870 // Don't allow initial splitter auto-positioning after this.
871 if ( pg
->GetState() == this )
872 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
878 // Moves splitter so that all labels are visible, but just.
879 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
881 wxPropertyGrid
* pg
= GetGrid();
883 dc
.SetFont(pg
->GetFont());
885 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
889 maxW
+= pg
->m_marginWidth
;
890 DoSetSplitterPosition( maxW
);
893 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
896 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
898 wxPropertyGrid
* pg
= GetGrid();
900 dc
.SetFont(pg
->GetFont());
902 int marginWidth
= pg
->m_marginWidth
;
903 int accWid
= marginWidth
;
904 int maxColWidth
= 500;
906 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
908 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
909 int colMinWidth
= GetColumnMinWidth(col
);
910 if ( fitWid
< colMinWidth
)
911 fitWid
= colMinWidth
;
912 else if ( fitWid
> maxColWidth
)
913 fitWid
= maxColWidth
;
915 m_colWidths
[col
] = fitWid
;
920 // Expand last one to fill the width
921 int remaining
= m_width
- accWid
;
922 m_colWidths
[GetColumnCount()-1] += remaining
;
924 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
926 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
927 m_fSplitterX
= (double) firstSplitterX
;
929 // Don't allow initial splitter auto-positioning after this.
930 if ( pg
->GetState() == this )
932 pg
->SetSplitterPosition(firstSplitterX
, false);
937 pg
->GetVirtualSize(&x
, &y
);
939 return wxSize(accWid
, y
);
942 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
947 wxPropertyGrid
* pg
= GetGrid();
950 unsigned int lastColumn
= m_colWidths
.size() - 1;
952 int clientWidth
= pg
->GetClientSize().x
;
955 // Column to reduce, if needed. Take last one that exceeds minimum width.
958 wxLogTrace("propgrid",
959 wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
964 for ( i
=0; i
<m_colWidths
.size(); i
++ )
966 int min
= GetColumnMinWidth(i
);
967 if ( m_colWidths
[i
] <= min
)
969 m_colWidths
[i
] = min
;
973 // Always reduce the last column that is larger than minimum size
974 // (looks nicer, even with auto-centering enabled).
979 int colsWidth
= pg
->m_marginWidth
;
980 for ( i
=0; i
<m_colWidths
.size(); i
++ )
981 colsWidth
+= m_colWidths
[i
];
983 wxLogTrace("propgrid",
984 wxS(" HasVirtualWidth: %i colsWidth: %i"),
985 (int)pg
->HasVirtualWidth(), colsWidth
);
987 // Then mode-based requirement
988 if ( !pg
->HasVirtualWidth() )
990 int widthHigher
= width
- colsWidth
;
992 // Adapt colsWidth to width
993 if ( colsWidth
< width
)
996 wxLogTrace("propgrid",
997 wxS(" Adjust last column to %i"),
998 m_colWidths
[lastColumn
] + widthHigher
);
999 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
1001 else if ( colsWidth
> width
)
1004 if ( reduceCol
!= -1 )
1006 wxLogTrace("propgrid",
1007 wxT(" Reduce column %i (by %i)"),
1008 reduceCol
, -widthHigher
);
1010 // Reduce widest column, and recheck
1011 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
1012 CheckColumnWidths();
1018 // Only check colsWidth against clientWidth
1019 if ( colsWidth
< clientWidth
)
1021 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
1024 m_width
= colsWidth
;
1026 // If width changed, recalculate virtual size
1027 if ( pg
->GetState() == this )
1028 pg
->RecalculateVirtualSize();
1031 for ( i
=0; i
<m_colWidths
.size(); i
++ )
1033 wxLogTrace("propgrid", wxS("col%i: %i"), i
, m_colWidths
[i
]);
1036 // Auto center splitter
1037 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
1038 m_colWidths
.size() == 2 )
1040 float centerX
= (float)(pg
->m_width
/2);
1043 if ( m_fSplitterX
< 0.0 )
1045 splitterX
= centerX
;
1047 else if ( widthChange
)
1049 //float centerX = float(pg->GetSize().x) * 0.5;
1052 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
1053 float deviation
= fabs(centerX
- splitterX
);
1055 // If deviating from center, adjust towards it
1056 if ( deviation
> 20.0 )
1058 if ( splitterX
> centerX
)
1066 // No width change, just keep sure we keep splitter position intact
1067 splitterX
= m_fSplitterX
;
1068 float deviation
= fabs(centerX
- splitterX
);
1069 if ( deviation
> 50.0 )
1071 splitterX
= centerX
;
1075 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1077 m_fSplitterX
= splitterX
; // needed to retain accuracy
1081 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1083 wxASSERT( colCount
>= 2 );
1084 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1085 if ( m_colWidths
.size() > (unsigned int)colCount
)
1086 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1088 if ( m_pPropGrid
->GetState() == this )
1089 m_pPropGrid
->RecalculateVirtualSize();
1091 CheckColumnWidths();
1094 // Returns column index, -1 for margin
1095 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1097 int cx
= GetGrid()->m_marginWidth
;
1099 int prevSplitter
= -1;
1104 if ( col
>= (int)m_colWidths
.size() )
1110 cx
+= m_colWidths
[col
];
1113 // Near prev. splitter
1116 int diff
= x
- prevSplitter
;
1117 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1119 *pSplitterHit
= col
- 1;
1120 *pSplitterHitOffset
= diff
;
1125 // Near next splitter
1126 int nextSplitter
= cx
;
1127 if ( col
< (int)(m_colWidths
.size()-1) )
1129 int diff
= x
- nextSplitter
;
1130 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1132 *pSplitterHit
= col
;
1133 *pSplitterHitOffset
= diff
;
1142 bool wxPropertyGridPageState::ArePropertiesAdjacent( wxPGProperty
* prop1
,
1143 wxPGProperty
* prop2
,
1144 int iterFlags
) const
1146 const wxPGProperty
* ap1
=
1147 wxPropertyGridConstIterator::OneStep(this,
1151 if ( ap1
&& ap1
== prop2
)
1154 const wxPGProperty
* ap2
=
1155 wxPropertyGridConstIterator::OneStep(this,
1159 if ( ap2
&& ap2
== prop2
)
1165 // -----------------------------------------------------------------------
1166 // wxPropertyGridPageState property value setting and getting
1167 // -----------------------------------------------------------------------
1169 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1173 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1175 wxVariant variant
= p
->GetValueRef();
1178 if ( p
->GetMaxLength() <= 0 )
1179 res
= p
->StringToValue( variant
, value
, flags
);
1181 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1185 p
->SetValue(variant
);
1186 if ( p
== m_pPropGrid
->GetSelection() &&
1187 this == m_pPropGrid
->GetState() )
1188 m_pPropGrid
->RefreshEditor();
1196 // -----------------------------------------------------------------------
1198 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1203 if ( p
== m_pPropGrid
->GetSelection() &&
1204 this == m_pPropGrid
->GetState() )
1205 m_pPropGrid
->RefreshEditor();
1212 // -----------------------------------------------------------------------
1214 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1218 // wnd_primary has to be given so the control can be updated as well.
1220 DoSetPropertyValue(p
, v
);
1226 // -----------------------------------------------------------------------
1227 // wxPropertyGridPageState property operations
1228 // -----------------------------------------------------------------------
1230 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1232 const wxArrayPGProperty
& selection
= m_selection
;
1234 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1236 if ( selection
[i
] == prop
)
1243 // -----------------------------------------------------------------------
1245 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1247 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1249 if ( m_selection
[i
] == prop
)
1251 wxPropertyGrid
* pg
= m_pPropGrid
;
1252 if ( i
== 0 && pg
->GetState() == this )
1254 // If first item (ie. one with the active editor) was
1255 // deselected, then we need to take some extra measures.
1256 wxArrayPGProperty sel
= m_selection
;
1257 sel
.erase( sel
.begin() + i
);
1259 wxPGProperty
* newFirst
;
1265 pg
->DoSelectProperty(newFirst
,
1266 wxPG_SEL_DONT_SEND_EVENT
);
1274 m_selection
.erase( m_selection
.begin() + i
);
1281 // -----------------------------------------------------------------------
1283 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1285 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1287 if ( !p
->GetChildCount() ) return false;
1289 if ( !p
->IsExpanded() ) return false;
1291 p
->SetExpanded(false);
1293 VirtualHeightChanged();
1298 // -----------------------------------------------------------------------
1300 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1302 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1304 if ( !p
->GetChildCount() ) return false;
1306 if ( p
->IsExpanded() ) return false;
1308 p
->SetExpanded(true);
1310 VirtualHeightChanged();
1315 // -----------------------------------------------------------------------
1317 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1319 if ( this == m_pPropGrid
->GetState() )
1320 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1326 // -----------------------------------------------------------------------
1328 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1331 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1333 p
->SetFlag( wxPG_PROP_HIDDEN
);
1335 if ( flags
& wxPG_RECURSE
)
1338 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1339 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1342 VirtualHeightChanged();
1347 // -----------------------------------------------------------------------
1349 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1355 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1360 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1364 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1369 p
->m_flags
|= wxPG_PROP_DISABLED
;
1373 // Apply same to sub-properties as well
1375 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1376 DoEnableProperty( p
->Item(i
), enable
);
1383 // -----------------------------------------------------------------------
1384 // wxPropertyGridPageState wxVariant related routines
1385 // -----------------------------------------------------------------------
1387 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1388 // Never includes sub-properties (unless they are parented by wxParentProperty).
1389 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1390 wxPGProperty
* baseparent
,
1393 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1395 // Root is the default base-parent.
1399 wxVariantList tempList
;
1400 wxVariant
v( tempList
, listname
);
1402 if ( pwc
->GetChildCount() )
1404 if ( flags
& wxPG_KEEP_STRUCTURE
)
1406 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1409 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1411 wxPGProperty
* p
= pwc
->Item(i
);
1412 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1414 wxVariant variant
= p
->GetValue();
1415 variant
.SetName( p
->GetBaseName() );
1416 v
.Append( variant
);
1420 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1422 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1423 v
.Append( p
->GetAttributesAsList() );
1428 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1429 it
.SetBaseParent( pwc
);
1431 for ( ; !it
.AtEnd(); it
.Next() )
1433 const wxPGProperty
* p
= it
.GetProperty();
1435 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1436 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1438 wxVariant variant
= p
->GetValue();
1439 variant
.SetName( p
->GetName() );
1440 v
.Append( variant
);
1441 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1442 v
.Append( p
->GetAttributesAsList() );
1451 // -----------------------------------------------------------------------
1453 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1455 unsigned char origFrozen
= 1;
1457 if ( m_pPropGrid
->GetState() == this )
1459 origFrozen
= m_pPropGrid
->m_frozen
;
1460 if ( !origFrozen
) m_pPropGrid
->Freeze();
1463 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1465 if ( !use_category
)
1466 use_category
= (wxPropertyCategory
*)m_properties
;
1468 // Let's iterate over the list of variants.
1469 wxVariantList::const_iterator node
;
1470 int numSpecialEntries
= 0;
1473 // Second pass for special entries
1474 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1476 wxVariant
*current
= (wxVariant
*)*node
;
1478 // Make sure it is wxVariant.
1479 wxASSERT( current
);
1480 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1482 const wxString
& name
= current
->GetName();
1483 if ( name
.length() > 0 )
1486 // '@' signified a special entry
1487 if ( name
[0] == wxS('@') )
1489 numSpecialEntries
++;
1493 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1496 wxPGProperty
* p
= foundProp
;
1498 // If it was a list, we still have to go through it.
1499 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1501 DoSetPropertyValues( current
->GetList(),
1502 p
->IsCategory()?p
:(NULL
)
1507 wxASSERT_LEVEL_2_MSG(
1508 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1510 wxS("setting value of property \"%s\" from variant"),
1511 p
->GetName().c_str())
1514 p
->SetValue(*current
);
1520 if ( current
->GetType() != wxS("list") )
1526 // Yes, it is; create a sub category and append contents there.
1527 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1528 DoSetPropertyValues( current
->GetList(), newCat
);
1535 if ( numSpecialEntries
)
1537 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1539 wxVariant
*current
= (wxVariant
*)*node
;
1541 const wxString
& name
= current
->GetName();
1542 if ( name
.length() > 0 )
1545 // '@' signified a special entry
1546 if ( name
[0] == wxS('@') )
1548 numSpecialEntries
--;
1550 size_t pos2
= name
.rfind(wxS('@'));
1551 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1553 wxString propName
= name
.substr(1, pos2
-1);
1554 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1556 if ( entryType
== wxS("attr") )
1559 // List of attributes
1560 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1563 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1565 wxVariantList
& list2
= current
->GetList();
1566 wxVariantList::const_iterator node2
;
1568 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1570 wxVariant
*attr
= (wxVariant
*)*node2
;
1571 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1576 // ERROR: No such property: 'propName'
1582 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1587 if ( !numSpecialEntries
)
1594 m_pPropGrid
->Thaw();
1596 if ( this == m_pPropGrid
->GetState() )
1597 m_pPropGrid
->RefreshEditor();
1602 // -----------------------------------------------------------------------
1603 // wxPropertyGridPageState property adding and removal
1604 // -----------------------------------------------------------------------
1606 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1607 wxPGProperty
* scheduledParent
)
1609 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1611 // This will allow better behavior.
1612 if ( scheduledParent
== m_properties
)
1613 scheduledParent
= NULL
;
1615 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1617 wxASSERT_MSG( property
->GetBaseName().length(),
1618 "Property's children must have unique, non-empty names within their scope" );
1621 property
->m_parentState
= this;
1623 if ( property
->IsCategory() )
1626 // Parent of a category must be either root or another category
1627 // (otherwise Bad Things might happen).
1628 wxASSERT_MSG( scheduledParent
== NULL
||
1629 scheduledParent
== m_properties
||
1630 scheduledParent
->IsCategory(),
1631 wxT("Parent of a category must be either root or another category."));
1633 // If we already have category with same name, delete given property
1634 // and use it instead as most recent caption item.
1635 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1638 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1639 if ( pwc
->IsCategory() ) // Must be a category.
1642 m_currentCategory
= pwc
;
1649 // Warn for identical names in debug mode.
1650 if ( BaseGetPropertyByName(property
->GetName()) &&
1651 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1653 wxFAIL_MSG(wxString::Format(
1654 "wxPropertyGrid item with name \"%s\" already exists",
1655 property
->GetName()));
1657 wxPGGlobalVars
->m_warnings
++;
1659 #endif // wxDEBUG_LEVEL
1661 // Make sure nothing is selected.
1663 propGrid
->ClearSelection(false);
1665 // NULL parent == root parent
1666 if ( !scheduledParent
)
1667 scheduledParent
= DoGetRoot();
1669 property
->m_parent
= scheduledParent
;
1671 property
->InitAfterAdded(this, propGrid
);
1673 if ( property
->IsCategory() )
1675 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1677 m_currentCategory
= pc
;
1679 // Calculate text extent for category caption
1681 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1687 // -----------------------------------------------------------------------
1689 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1691 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1692 if ( property
->IsCategory() )
1695 return DoInsert( cur_cat
, -1, property
);
1698 // -----------------------------------------------------------------------
1700 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1703 parent
= m_properties
;
1705 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1707 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1709 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1711 // PrepareToAddItem() may just decide to use use current category
1712 // instead of adding new one.
1714 return m_currentCategory
;
1716 bool parentIsRoot
= parent
->IsRoot();
1717 bool parentIsCategory
= parent
->IsCategory();
1719 // Note that item must be added into current mode later.
1721 // If parent is wxParentProperty, just stick it in...
1722 // If parent is root (m_properties), then...
1723 // In categoric mode: Add as last item in m_abcArray (if not category).
1724 // Add to given index in m_regularArray.
1725 // In non-cat mode: Add as last item in m_regularArray.
1726 // Add to given index in m_abcArray.
1727 // If parent is category, then...
1728 // 1) Add to given category in given index.
1729 // 2) Add as last item in m_abcArray.
1731 if ( m_properties
== &m_regularArray
)
1733 // We are currently in Categorized mode
1735 // Only add non-categories to m_abcArray.
1736 if ( m_abcArray
&& !property
->IsCategory() &&
1737 (parentIsCategory
|| parentIsRoot
) )
1739 m_abcArray
->DoAddChild( property
, -1, false );
1742 // Add to current mode.
1743 parent
->DoAddChild( property
, index
, true );
1747 // We are currently in Non-categorized/Alphabetic mode
1749 if ( parentIsCategory
)
1750 // Parent is category.
1751 parent
->DoAddChild( property
, index
, false );
1752 else if ( parentIsRoot
)
1754 m_regularArray
.DoAddChild( property
, -1, false );
1756 // Add to current mode
1757 if ( !property
->IsCategory() )
1758 m_abcArray
->DoAddChild( property
, index
, true );
1762 if ( property
->IsCategory() )
1764 // This is a category caption item.
1766 // Last caption is not the bottom one (this info required by append)
1767 m_lastCaptionBottomnest
= 0;
1770 // Only add name to hashmap if parent is root or category
1771 if ( property
->m_name
.length() &&
1772 (parentIsCategory
|| parentIsRoot
) )
1773 m_dictName
[property
->m_name
] = (void*) property
;
1775 VirtualHeightChanged();
1777 property
->UpdateParentValues();
1784 // -----------------------------------------------------------------------
1786 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1788 wxCHECK_RET( item
->GetParent(),
1789 wxT("this property was already deleted") );
1791 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1792 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1794 unsigned int indinparent
= item
->GetIndexInParent();
1796 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1797 wxPGProperty
* parent
= item
->GetParent();
1799 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1800 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1802 wxASSERT( item
->GetParentState() == this );
1804 wxPropertyGrid
* pg
= GetGrid();
1806 if ( DoIsPropertySelected(item
) )
1808 if ( pg
&& pg
->GetState() == this )
1810 pg
->DoRemoveFromSelection(item
,
1811 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1815 DoRemoveFromSelection(item
);
1819 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1822 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1824 // deleting a category
1825 if ( item
->IsCategory() )
1827 if ( pwc
== m_currentCategory
)
1828 m_currentCategory
= NULL
;
1831 item
->DeleteChildren();
1834 if ( !IsInNonCatMode() )
1836 // categorized mode - non-categorized array
1838 // Remove from non-cat array
1839 if ( !item
->IsCategory() &&
1840 (parent
->IsCategory() || parent
->IsRoot()) )
1843 m_abcArray
->RemoveChild(item
);
1846 // categorized mode - categorized array
1847 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1848 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1849 item
->m_parent
->FixIndicesOfChildren();
1853 // non-categorized mode - categorized array
1855 // We need to find location of item.
1856 wxPGProperty
* cat_parent
= &m_regularArray
;
1857 int cat_index
= m_regularArray
.GetChildCount();
1859 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1861 wxPGProperty
* p
= m_regularArray
.Item(i
);
1862 if ( p
== item
) { cat_index
= i
; break; }
1863 if ( p
->IsCategory() )
1865 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1866 if ( subind
!= wxNOT_FOUND
)
1868 cat_parent
= ((wxPGProperty
*)p
);
1874 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1876 // non-categorized mode - non-categorized array
1877 if ( !item
->IsCategory() )
1879 wxASSERT( item
->m_parent
== m_abcArray
);
1880 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1881 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1882 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1886 if ( item
->GetBaseName().length() &&
1887 (parent
->IsCategory() || parent
->IsRoot()) )
1888 m_dictName
.erase(item
->GetBaseName());
1890 // We need to clear parent grid's m_propHover, if it matches item
1891 if ( pg
&& pg
->m_propHover
== item
)
1892 pg
->m_propHover
= NULL
;
1894 // We can actually delete it now
1898 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1900 VirtualHeightChanged();
1903 // -----------------------------------------------------------------------
1905 #endif // wxUSE_PROPGRID