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
;
113 wxPGProperty
* parent
= property
->GetParent();
115 unsigned int index
= property
->GetIndexInParent();
122 property
= parent
->Item(index
);
124 // Go to last children?
125 if ( property
->GetChildCount() &&
126 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) )
129 property
= property
->Last();
135 if ( parent
== m_baseParent
)
146 m_property
= property
;
148 // If property does not match our criteria, skip it
149 if ( property
->GetFlags() & m_itemExMask
)
153 void wxPropertyGridIteratorBase::Next( bool iterateChildren
)
155 wxPGProperty
* property
= m_property
;
159 if ( property
->GetChildCount() &&
160 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) &&
164 property
= property
->Item(0);
168 wxPGProperty
* parent
= property
->GetParent();
170 unsigned int index
= property
->GetIndexInParent() + 1;
172 if ( index
< parent
->GetChildCount() )
175 property
= parent
->Item(index
);
179 // Next sibling of parent
180 if ( parent
== m_baseParent
)
193 m_property
= property
;
195 // If property does not match our criteria, skip it
196 if ( property
->GetFlags() & m_itemExMask
)
200 // -----------------------------------------------------------------------
201 // wxPropertyGridPageState
202 // -----------------------------------------------------------------------
204 wxPropertyGridPageState::wxPropertyGridPageState()
207 m_regularArray
.SetParentState(this);
208 m_properties
= &m_regularArray
;
210 m_currentCategory
= NULL
;
213 m_lastCaptionBottomnest
= 1;
217 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
218 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
219 m_fSplitterX
= wxPG_DEFAULT_SPLITTERX
;
221 m_isSplitterPreSet
= false;
222 m_dontCenterSplitter
= false;
224 // By default, we only have the 'value' column editable
225 m_editableColumns
.push_back(1);
228 // -----------------------------------------------------------------------
230 wxPropertyGridPageState::~wxPropertyGridPageState()
235 // -----------------------------------------------------------------------
237 void wxPropertyGridPageState::InitNonCatMode()
241 m_abcArray
= new wxPGRootProperty(wxS("<Root_NonCat>"));
242 m_abcArray
->SetParentState(this);
243 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
246 // Must be called when state::m_properties still points to regularArray.
247 wxPGProperty
* oldProperties
= m_properties
;
249 // Must use temp value in state::m_properties for item iteration loop
250 // to run as expected.
251 m_properties
= &m_regularArray
;
253 if ( m_properties
->GetChildCount() )
256 // Prepare m_abcArray
257 wxPropertyGridIterator
it( this, wxPG_ITERATE_PROPERTIES
);
259 for ( ; !it
.AtEnd(); it
.Next() )
261 wxPGProperty
* p
= it
.GetProperty();
262 wxPGProperty
* parent
= p
->GetParent();
263 if ( parent
->IsCategory() || parent
->IsRoot() )
265 m_abcArray
->DoAddChild(p
);
266 p
->m_parent
= &m_regularArray
;
271 m_properties
= oldProperties
;
274 // -----------------------------------------------------------------------
276 void wxPropertyGridPageState::DoClear()
278 if ( m_pPropGrid
&& m_pPropGrid
->GetState() == this )
280 m_pPropGrid
->ClearSelection(false);
287 m_regularArray
.Empty();
293 m_currentCategory
= NULL
;
294 m_lastCaptionBottomnest
= 1;
301 // -----------------------------------------------------------------------
303 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
305 wxPropertyGrid
* propGrid
= GetGrid();
307 VirtualHeightChanged();
309 // Recalculate caption text extents.
312 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
314 wxPGProperty
* p
=m_regularArray
.Item(i
);
316 if ( p
->IsCategory() )
317 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
321 // -----------------------------------------------------------------------
323 void wxPropertyGridPageState::SetVirtualWidth( int width
)
325 // Sometimes width less than 0 is offered. Let's make things easy for
326 // everybody and deal with it here.
330 wxPropertyGrid
* pg
= GetGrid();
331 int gw
= pg
->GetClientSize().x
;
338 // -----------------------------------------------------------------------
340 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
342 wxPropertyGrid
* pg
= GetGrid();
344 if ( pg
->HasVirtualWidth() )
346 if ( m_width
< newWidth
)
347 SetVirtualWidth( newWidth
);
349 CheckColumnWidths(widthChange
);
353 SetVirtualWidth( newWidth
);
355 // This should be done before splitter auto centering
356 // NOTE: Splitter auto-centering is done in this function.
359 CheckColumnWidths(widthChange
);
361 if ( !m_isSplitterPreSet
&& m_dontCenterSplitter
)
363 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
365 // If too long, don't set splitter
366 if ( timeSinceCreation
< 250 )
368 if ( m_properties
->GetChildCount() )
370 SetSplitterLeft( false );
374 DoSetSplitterPosition( newWidth
/ 2 );
375 m_isSplitterPreSet
= false;
382 // -----------------------------------------------------------------------
383 // wxPropertyGridPageState item iteration methods
384 // -----------------------------------------------------------------------
386 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
388 if ( !m_properties
->GetChildCount() )
391 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
393 // First, get last child of last parent
394 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
395 while ( pwc
->GetChildCount() &&
396 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
397 pwc
= (wxPGProperty
*) pwc
->Last();
399 // Then, if it doesn't fit our criteria, back up until we find something that does
400 if ( pwc
->GetFlags() & itemExMask
)
402 wxPropertyGridIterator
it( this, flags
, pwc
);
403 for ( ; !it
.AtEnd(); it
.Prev() )
405 pwc
= (wxPGProperty
*) it
.GetProperty();
411 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
413 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
414 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
417 parent
= grandparent
;
418 grandparent
= (wxPGProperty
*)parent
->GetParent();
419 if ( parent
->IsCategory() && grandparent
)
420 return (wxPropertyCategory
*)parent
;
421 } while ( grandparent
);
426 // -----------------------------------------------------------------------
427 // wxPropertyGridPageState GetPropertyXXX methods
428 // -----------------------------------------------------------------------
430 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
431 wxPGProperty
* parent
) const
436 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
438 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
440 wxPGProperty
* p
= parent
->Item(i
);
441 if ( p
->m_label
== label
)
443 // Check children recursively.
444 if ( p
->GetChildCount() )
446 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
455 // -----------------------------------------------------------------------
457 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
459 wxPGHashMapS2P::const_iterator it
;
460 it
= m_dictName
.find(name
);
461 if ( it
!= m_dictName
.end() )
462 return (wxPGProperty
*) it
->second
;
466 // -----------------------------------------------------------------------
468 void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty
* p
,
469 const wxString
& newName
)
471 wxCHECK_RET( p
, wxT("invalid property id") );
473 wxPGProperty
* parent
= p
->GetParent();
475 if ( parent
->IsCategory() || parent
->IsRoot() )
477 if ( p
->GetBaseName().length() )
478 m_dictName
.erase( p
->GetBaseName() );
479 if ( newName
.length() )
480 m_dictName
[newName
] = (void*) p
;
483 p
->DoSetName(newName
);
486 // -----------------------------------------------------------------------
487 // wxPropertyGridPageState global operations
488 // -----------------------------------------------------------------------
490 // -----------------------------------------------------------------------
491 // Item iteration macros
492 // NB: Nowadays only needed for alphabetic/categoric mode switching.
493 // -----------------------------------------------------------------------
495 //#define II_INVALID_I 0x00FFFFFF
497 #define ITEM_ITERATION_VARIABLES \
498 wxPGProperty* parent; \
502 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
503 parent = m_properties; \
507 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
508 parent = startparent; \
509 i = (unsigned int)startindex; \
510 if ( parent == NULL ) \
512 parent = state->m_properties; \
517 #define ITEM_ITERATION_LOOP_BEGIN \
520 iMax = parent->GetChildCount(); \
523 wxPGProperty* p = parent->Item(i);
525 #define ITEM_ITERATION_LOOP_END \
526 if ( p->GetChildCount() ) \
529 parent = (wxPGProperty*)p; \
530 iMax = parent->GetChildCount(); \
535 i = parent->m_arrIndex + 1; \
536 parent = parent->m_parent; \
538 while ( parent != NULL );
540 bool wxPropertyGridPageState::EnableCategories( bool enable
)
543 // NB: We can't use wxPropertyGridIterator in this
544 // function, since it depends on m_arrIndexes,
545 // which, among other things, is being fixed here.
547 ITEM_ITERATION_VARIABLES
555 if ( !IsInNonCatMode() )
558 m_properties
= &m_regularArray
;
560 // fix parents, indexes, and depths
561 ITEM_ITERATION_INIT_FROM_THE_TOP
563 ITEM_ITERATION_LOOP_BEGIN
567 p
->m_parent
= parent
;
569 // If parent was category, and this is not,
570 // then the depth stays the same.
571 if ( parent
->IsCategory() &&
573 p
->m_depth
= parent
->m_depth
;
575 p
->m_depth
= parent
->m_depth
+ 1;
577 ITEM_ITERATION_LOOP_END
583 // Disable categories
586 if ( IsInNonCatMode() )
589 // Create array, if necessary.
593 m_properties
= m_abcArray
;
595 // fix parents, indexes, and depths
596 ITEM_ITERATION_INIT_FROM_THE_TOP
598 ITEM_ITERATION_LOOP_BEGIN
602 p
->m_parent
= parent
;
604 p
->m_depth
= parent
->m_depth
+ 1;
606 ITEM_ITERATION_LOOP_END
609 VirtualHeightChanged();
611 if ( m_pPropGrid
->GetState() == this )
612 m_pPropGrid
->RecalculateVirtualSize();
617 // -----------------------------------------------------------------------
619 static int wxPG_SortFunc_ByFunction(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
621 wxPGProperty
*p1
= *pp1
;
622 wxPGProperty
*p2
= *pp2
;
623 wxPropertyGrid
* pg
= p1
->GetGrid();
624 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
625 return sortFunction(pg
, p1
, p2
);
628 static int wxPG_SortFunc_ByLabel(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
630 wxPGProperty
*p1
= *pp1
;
631 wxPGProperty
*p2
= *pp2
;
632 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() );
637 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
642 static bool wxPG_SortFunc_ByFunction(wxPGProperty
*p1
, wxPGProperty
*p2
)
644 wxPropertyGrid
* pg
= p1
->GetGrid();
645 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
646 return sortFunction(pg
, p1
, p2
) < 0;
649 static bool wxPG_SortFunc_ByLabel(wxPGProperty
*p1
, wxPGProperty
*p2
)
651 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() ) < 0;
655 void wxPropertyGridPageState::DoSortChildren( wxPGProperty
* p
,
661 // Can only sort items with children
662 if ( !p
->GetChildCount() )
665 // Never sort children of aggregate properties
666 if ( p
->HasFlag(wxPG_PROP_AGGREGATE
) )
669 if ( (flags
& wxPG_SORT_TOP_LEVEL_ONLY
)
670 && !p
->IsCategory() && !p
->IsRoot() )
673 if ( GetGrid()->GetSortFunction() )
674 p
->m_children
.Sort( wxPG_SortFunc_ByFunction
);
676 p
->m_children
.Sort( wxPG_SortFunc_ByLabel
);
680 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
682 if ( GetGrid()->GetSortFunction() )
683 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
684 wxPG_SortFunc_ByFunction
);
686 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
687 wxPG_SortFunc_ByLabel
);
691 p
->FixIndicesOfChildren();
693 if ( flags
& wxPG_RECURSE
)
695 // Apply sort recursively
696 for ( unsigned int i
=0; i
<p
->GetChildCount(); i
++ )
697 DoSortChildren(p
->Item(i
), flags
);
701 // -----------------------------------------------------------------------
703 void wxPropertyGridPageState::DoSort( int flags
)
705 DoSortChildren( m_properties
, flags
| wxPG_RECURSE
);
707 // We used to sort categories as well here also if in non-categorized
708 // mode, but doing would naturally cause child indices to become
712 // -----------------------------------------------------------------------
714 bool wxPropertyGridPageState::PrepareAfterItemsAdded()
716 if ( !m_itemsAdded
) return false;
718 wxPropertyGrid
* pg
= GetGrid();
722 if ( pg
->HasFlag(wxPG_AUTO_SORT
) )
723 DoSort(wxPG_SORT_TOP_LEVEL_ONLY
);
728 // -----------------------------------------------------------------------
729 // wxPropertyGridPageState splitter, column and hittest functions
730 // -----------------------------------------------------------------------
732 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
739 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
742 // -----------------------------------------------------------------------
744 wxPropertyGridHitTestResult
745 wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
747 wxPropertyGridHitTestResult result
;
748 result
.m_column
= HitTestH( pt
.x
, &result
.m_splitter
,
749 &result
.m_splitterHitOffset
);
750 result
.m_property
= DoGetItemAtY( pt
.y
);
754 // -----------------------------------------------------------------------
756 // Used by SetSplitterLeft() and DotFitColumns()
757 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
762 wxPropertyGrid
* pg
= m_pPropGrid
;
767 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
769 wxPGProperty
* p
= pwc
->Item(i
);
770 if ( !p
->IsCategory() )
772 const wxPGCell
* cell
= NULL
;
774 p
->GetDisplayInfo(col
, -1, 0, &text
, &cell
);
775 dc
.GetTextExtent(text
, &w
, &h
);
777 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
779 // account for the bitmap
781 w
+= p
->GetImageOffset(pg
->GetImageRect(p
, -1).GetWidth());
784 w
+= (wxPG_XBEFORETEXT
*2);
790 if ( p
->GetChildCount() &&
791 ( subProps
|| p
->IsCategory() ) )
793 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
803 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
805 int n
= GetGrid()->m_marginWidth
;
807 for ( i
=0; i
<=splitterColumn
; i
++ )
812 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
814 return wxPG_DRAG_MARGIN
;
817 void wxPropertyGridPageState::PropagateColSizeDec( int column
,
821 int origWidth
= m_colWidths
[column
];
822 m_colWidths
[column
] -= decrease
;
823 int min
= GetColumnMinWidth(column
);
825 if ( m_colWidths
[column
] < min
)
827 more
= decrease
- (origWidth
- min
);
828 m_colWidths
[column
] = min
;
832 // FIXME: Causes erratic splitter changing, so as a workaround
833 // disabled if two or less columns.
835 if ( m_colWidths
.size() <= 2 )
839 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
840 PropagateColSizeDec( column
, more
, dir
);
843 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
,
845 bool WXUNUSED(allPages
),
846 bool fromAutoCenter
)
848 wxPropertyGrid
* pg
= GetGrid();
850 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
852 if ( !pg
->HasVirtualWidth() )
858 otherColumn
= splitterColumn
+ 1;
859 if ( otherColumn
== (int)m_colWidths
.size() )
861 m_colWidths
[splitterColumn
] += adjust
;
862 PropagateColSizeDec( otherColumn
, adjust
, 1 );
866 otherColumn
= splitterColumn
+ 1;
867 if ( otherColumn
== (int)m_colWidths
.size() )
869 m_colWidths
[otherColumn
] -= adjust
;
870 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
875 m_colWidths
[splitterColumn
] += adjust
;
878 if ( splitterColumn
== 0 )
879 m_fSplitterX
= (double) newXPos
;
881 if ( !fromAutoCenter
)
883 // Don't allow initial splitter auto-positioning after this.
884 m_isSplitterPreSet
= true;
890 // Moves splitter so that all labels are visible, but just.
891 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
893 wxPropertyGrid
* pg
= GetGrid();
895 dc
.SetFont(pg
->GetFont());
897 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
901 maxW
+= pg
->m_marginWidth
;
902 DoSetSplitterPosition( maxW
);
905 m_dontCenterSplitter
= true;
908 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
910 wxPropertyGrid
* pg
= GetGrid();
912 dc
.SetFont(pg
->GetFont());
914 int marginWidth
= pg
->m_marginWidth
;
915 int accWid
= marginWidth
;
916 int maxColWidth
= 500;
918 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
920 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
921 int colMinWidth
= GetColumnMinWidth(col
);
922 if ( fitWid
< colMinWidth
)
923 fitWid
= colMinWidth
;
924 else if ( fitWid
> maxColWidth
)
925 fitWid
= maxColWidth
;
927 m_colWidths
[col
] = fitWid
;
932 // Expand last one to fill the width
933 int remaining
= m_width
- accWid
;
934 m_colWidths
[GetColumnCount()-1] += remaining
;
936 m_dontCenterSplitter
= true;
938 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
939 m_fSplitterX
= (double) firstSplitterX
;
941 // Don't allow initial splitter auto-positioning after this.
942 if ( pg
->GetState() == this )
944 pg
->SetSplitterPosition(firstSplitterX
, false);
949 pg
->GetVirtualSize(&x
, &y
);
951 return wxSize(accWid
, y
);
954 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
959 wxPropertyGrid
* pg
= GetGrid();
962 unsigned int lastColumn
= m_colWidths
.size() - 1;
964 int clientWidth
= pg
->GetClientSize().x
;
967 // Column to reduce, if needed. Take last one that exceeds minimum width.
970 wxLogTrace("propgrid",
971 wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
976 for ( i
=0; i
<m_colWidths
.size(); i
++ )
978 int min
= GetColumnMinWidth(i
);
979 if ( m_colWidths
[i
] <= min
)
981 m_colWidths
[i
] = min
;
985 // Always reduce the last column that is larger than minimum size
986 // (looks nicer, even with auto-centering enabled).
991 int colsWidth
= pg
->m_marginWidth
;
992 for ( i
=0; i
<m_colWidths
.size(); i
++ )
993 colsWidth
+= m_colWidths
[i
];
995 wxLogTrace("propgrid",
996 wxS(" HasVirtualWidth: %i colsWidth: %i"),
997 (int)pg
->HasVirtualWidth(), colsWidth
);
999 // Then mode-based requirement
1000 if ( !pg
->HasVirtualWidth() )
1002 int widthHigher
= width
- colsWidth
;
1004 // Adapt colsWidth to width
1005 if ( colsWidth
< width
)
1008 wxLogTrace("propgrid",
1009 wxS(" Adjust last column to %i"),
1010 m_colWidths
[lastColumn
] + widthHigher
);
1011 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
1013 else if ( colsWidth
> width
)
1016 if ( reduceCol
!= -1 )
1018 wxLogTrace("propgrid",
1019 wxT(" Reduce column %i (by %i)"),
1020 reduceCol
, -widthHigher
);
1022 // Reduce widest column, and recheck
1023 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
1024 CheckColumnWidths();
1030 // Only check colsWidth against clientWidth
1031 if ( colsWidth
< clientWidth
)
1033 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
1036 m_width
= colsWidth
;
1038 // If width changed, recalculate virtual size
1039 if ( pg
->GetState() == this )
1040 pg
->RecalculateVirtualSize();
1043 for ( i
=0; i
<m_colWidths
.size(); i
++ )
1045 wxLogTrace("propgrid", wxS("col%i: %i"), i
, m_colWidths
[i
]);
1048 // Auto center splitter
1049 if ( !m_dontCenterSplitter
&& m_colWidths
.size() == 2 )
1051 float centerX
= (float)(pg
->m_width
/2);
1054 if ( m_fSplitterX
< 0.0 )
1056 splitterX
= centerX
;
1058 else if ( widthChange
)
1060 //float centerX = float(pg->GetSize().x) * 0.5;
1063 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
1064 float deviation
= fabs(centerX
- splitterX
);
1066 // If deviating from center, adjust towards it
1067 if ( deviation
> 20.0 )
1069 if ( splitterX
> centerX
)
1077 // No width change, just keep sure we keep splitter position intact
1078 splitterX
= m_fSplitterX
;
1079 float deviation
= fabs(centerX
- splitterX
);
1080 if ( deviation
> 50.0 )
1082 splitterX
= centerX
;
1086 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1088 m_fSplitterX
= splitterX
; // needed to retain accuracy
1092 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1094 wxASSERT( colCount
>= 2 );
1095 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1096 if ( m_colWidths
.size() > (unsigned int)colCount
)
1097 m_colWidths
.RemoveAt( m_colWidths
.size()-1,
1098 m_colWidths
.size() - colCount
);
1100 if ( m_pPropGrid
->GetState() == this )
1101 m_pPropGrid
->RecalculateVirtualSize();
1103 CheckColumnWidths();
1106 // Returns column index, -1 for margin
1107 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1109 int cx
= GetGrid()->m_marginWidth
;
1111 int prevSplitter
= -1;
1116 if ( col
>= (int)m_colWidths
.size() )
1122 cx
+= m_colWidths
[col
];
1125 // Near prev. splitter
1128 int diff
= x
- prevSplitter
;
1129 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1131 *pSplitterHit
= col
- 1;
1132 *pSplitterHitOffset
= diff
;
1137 // Near next splitter
1138 int nextSplitter
= cx
;
1139 if ( col
< (int)(m_colWidths
.size()-1) )
1141 int diff
= x
- nextSplitter
;
1142 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1144 *pSplitterHit
= col
;
1145 *pSplitterHitOffset
= diff
;
1154 bool wxPropertyGridPageState::ArePropertiesAdjacent( wxPGProperty
* prop1
,
1155 wxPGProperty
* prop2
,
1156 int iterFlags
) const
1158 const wxPGProperty
* ap1
=
1159 wxPropertyGridConstIterator::OneStep(this,
1163 if ( ap1
&& ap1
== prop2
)
1166 const wxPGProperty
* ap2
=
1167 wxPropertyGridConstIterator::OneStep(this,
1171 if ( ap2
&& ap2
== prop2
)
1177 // -----------------------------------------------------------------------
1178 // wxPropertyGridPageState property value setting and getting
1179 // -----------------------------------------------------------------------
1181 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1185 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1187 wxVariant variant
= p
->GetValueRef();
1190 if ( p
->GetMaxLength() <= 0 )
1191 res
= p
->StringToValue( variant
, value
, flags
);
1193 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1197 p
->SetValue(variant
);
1198 if ( p
== m_pPropGrid
->GetSelection() &&
1199 this == m_pPropGrid
->GetState() )
1200 m_pPropGrid
->RefreshEditor();
1208 // -----------------------------------------------------------------------
1210 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1215 if ( p
== m_pPropGrid
->GetSelection() &&
1216 this == m_pPropGrid
->GetState() )
1217 m_pPropGrid
->RefreshEditor();
1224 // -----------------------------------------------------------------------
1226 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1230 // wnd_primary has to be given so the control can be updated as well.
1232 DoSetPropertyValue(p
, v
);
1238 // -----------------------------------------------------------------------
1239 // wxPropertyGridPageState property operations
1240 // -----------------------------------------------------------------------
1242 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1244 const wxArrayPGProperty
& selection
= m_selection
;
1246 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1248 if ( selection
[i
] == prop
)
1255 // -----------------------------------------------------------------------
1257 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1259 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1261 if ( m_selection
[i
] == prop
)
1263 wxPropertyGrid
* pg
= m_pPropGrid
;
1264 if ( i
== 0 && pg
->GetState() == this )
1266 // If first item (ie. one with the active editor) was
1267 // deselected, then we need to take some extra measures.
1268 wxArrayPGProperty sel
= m_selection
;
1269 sel
.erase( sel
.begin() + i
);
1271 wxPGProperty
* newFirst
;
1277 pg
->DoSelectProperty(newFirst
,
1278 wxPG_SEL_DONT_SEND_EVENT
);
1286 m_selection
.erase( m_selection
.begin() + i
);
1293 // -----------------------------------------------------------------------
1295 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1297 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1299 if ( !p
->GetChildCount() ) return false;
1301 if ( !p
->IsExpanded() ) return false;
1303 p
->SetExpanded(false);
1305 VirtualHeightChanged();
1310 // -----------------------------------------------------------------------
1312 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1314 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1316 if ( !p
->GetChildCount() ) return false;
1318 if ( p
->IsExpanded() ) return false;
1320 p
->SetExpanded(true);
1322 VirtualHeightChanged();
1327 // -----------------------------------------------------------------------
1329 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1331 if ( this == m_pPropGrid
->GetState() )
1332 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1338 // -----------------------------------------------------------------------
1340 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1343 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1345 p
->SetFlag( wxPG_PROP_HIDDEN
);
1347 if ( flags
& wxPG_RECURSE
)
1350 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1351 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1354 VirtualHeightChanged();
1359 // -----------------------------------------------------------------------
1361 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1367 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1372 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1376 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1381 p
->m_flags
|= wxPG_PROP_DISABLED
;
1385 // Apply same to sub-properties as well
1387 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1388 DoEnableProperty( p
->Item(i
), enable
);
1395 // -----------------------------------------------------------------------
1396 // wxPropertyGridPageState wxVariant related routines
1397 // -----------------------------------------------------------------------
1399 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1400 // Never includes sub-properties (unless they are parented by wxParentProperty).
1401 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1402 wxPGProperty
* baseparent
,
1405 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1407 // Root is the default base-parent.
1411 wxVariantList tempList
;
1412 wxVariant
v( tempList
, listname
);
1414 if ( pwc
->GetChildCount() )
1416 if ( flags
& wxPG_KEEP_STRUCTURE
)
1418 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1421 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1423 wxPGProperty
* p
= pwc
->Item(i
);
1424 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1426 wxVariant variant
= p
->GetValue();
1427 variant
.SetName( p
->GetBaseName() );
1428 v
.Append( variant
);
1432 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1434 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1435 v
.Append( p
->GetAttributesAsList() );
1440 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1441 it
.SetBaseParent( pwc
);
1443 for ( ; !it
.AtEnd(); it
.Next() )
1445 const wxPGProperty
* p
= it
.GetProperty();
1447 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1448 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1450 wxVariant variant
= p
->GetValue();
1451 variant
.SetName( p
->GetName() );
1452 v
.Append( variant
);
1453 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1454 v
.Append( p
->GetAttributesAsList() );
1463 // -----------------------------------------------------------------------
1465 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1467 unsigned char origFrozen
= 1;
1469 if ( m_pPropGrid
->GetState() == this )
1471 origFrozen
= m_pPropGrid
->m_frozen
;
1472 if ( !origFrozen
) m_pPropGrid
->Freeze();
1475 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1477 if ( !use_category
)
1478 use_category
= (wxPropertyCategory
*)m_properties
;
1480 // Let's iterate over the list of variants.
1481 wxVariantList::const_iterator node
;
1482 int numSpecialEntries
= 0;
1485 // Second pass for special entries
1486 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1488 wxVariant
*current
= (wxVariant
*)*node
;
1490 // Make sure it is wxVariant.
1491 wxASSERT( current
);
1492 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1494 const wxString
& name
= current
->GetName();
1495 if ( name
.length() > 0 )
1498 // '@' signified a special entry
1499 if ( name
[0] == wxS('@') )
1501 numSpecialEntries
++;
1505 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1508 wxPGProperty
* p
= foundProp
;
1510 // If it was a list, we still have to go through it.
1511 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1513 DoSetPropertyValues( current
->GetList(),
1514 p
->IsCategory()?p
:(NULL
)
1519 wxASSERT_LEVEL_2_MSG(
1520 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1522 wxS("setting value of property \"%s\" from variant"),
1523 p
->GetName().c_str())
1526 p
->SetValue(*current
);
1532 if ( current
->GetType() != wxS("list") )
1538 // Yes, it is; create a sub category and append contents there.
1539 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1540 DoSetPropertyValues( current
->GetList(), newCat
);
1547 if ( numSpecialEntries
)
1549 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1551 wxVariant
*current
= (wxVariant
*)*node
;
1553 const wxString
& name
= current
->GetName();
1554 if ( name
.length() > 0 )
1557 // '@' signified a special entry
1558 if ( name
[0] == wxS('@') )
1560 numSpecialEntries
--;
1562 size_t pos2
= name
.rfind(wxS('@'));
1563 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1565 wxString propName
= name
.substr(1, pos2
-1);
1566 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1568 if ( entryType
== wxS("attr") )
1571 // List of attributes
1572 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1575 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1577 wxVariantList
& list2
= current
->GetList();
1578 wxVariantList::const_iterator node2
;
1580 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1582 wxVariant
*attr
= (wxVariant
*)*node2
;
1583 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1588 // ERROR: No such property: 'propName'
1594 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1599 if ( !numSpecialEntries
)
1606 m_pPropGrid
->Thaw();
1608 if ( this == m_pPropGrid
->GetState() )
1609 m_pPropGrid
->RefreshEditor();
1614 // -----------------------------------------------------------------------
1615 // wxPropertyGridPageState property adding and removal
1616 // -----------------------------------------------------------------------
1618 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1619 wxPGProperty
* scheduledParent
)
1621 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1623 // This will allow better behavior.
1624 if ( scheduledParent
== m_properties
)
1625 scheduledParent
= NULL
;
1627 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1629 wxASSERT_MSG( property
->GetBaseName().length(),
1630 "Property's children must have unique, non-empty names within their scope" );
1633 property
->m_parentState
= this;
1635 if ( property
->IsCategory() )
1638 // Parent of a category must be either root or another category
1639 // (otherwise Bad Things might happen).
1640 wxASSERT_MSG( scheduledParent
== NULL
||
1641 scheduledParent
== m_properties
||
1642 scheduledParent
->IsCategory(),
1643 wxT("Parent of a category must be either root or another category."));
1645 // If we already have category with same name, delete given property
1646 // and use it instead as most recent caption item.
1647 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1650 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1651 if ( pwc
->IsCategory() ) // Must be a category.
1654 m_currentCategory
= pwc
;
1661 // Warn for identical names in debug mode.
1662 if ( BaseGetPropertyByName(property
->GetName()) &&
1663 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1665 wxFAIL_MSG(wxString::Format(
1666 "wxPropertyGrid item with name \"%s\" already exists",
1667 property
->GetName()));
1669 wxPGGlobalVars
->m_warnings
++;
1671 #endif // wxDEBUG_LEVEL
1673 // Make sure nothing is selected.
1675 propGrid
->ClearSelection(false);
1677 // NULL parent == root parent
1678 if ( !scheduledParent
)
1679 scheduledParent
= DoGetRoot();
1681 property
->m_parent
= scheduledParent
;
1683 property
->InitAfterAdded(this, propGrid
);
1685 if ( property
->IsCategory() )
1687 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1689 m_currentCategory
= pc
;
1691 // Calculate text extent for category caption
1693 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1699 // -----------------------------------------------------------------------
1701 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1703 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1704 if ( property
->IsCategory() )
1707 return DoInsert( cur_cat
, -1, property
);
1710 // -----------------------------------------------------------------------
1712 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1715 parent
= m_properties
;
1717 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1719 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1721 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1723 // PrepareToAddItem() may just decide to use use current category
1724 // instead of adding new one.
1726 return m_currentCategory
;
1728 bool parentIsRoot
= parent
->IsRoot();
1729 bool parentIsCategory
= parent
->IsCategory();
1731 // Note that item must be added into current mode later.
1733 // If parent is wxParentProperty, just stick it in...
1734 // If parent is root (m_properties), then...
1735 // In categoric mode: Add as last item in m_abcArray (if not category).
1736 // Add to given index in m_regularArray.
1737 // In non-cat mode: Add as last item in m_regularArray.
1738 // Add to given index in m_abcArray.
1739 // If parent is category, then...
1740 // 1) Add to given category in given index.
1741 // 2) Add as last item in m_abcArray.
1743 if ( m_properties
== &m_regularArray
)
1745 // We are currently in Categorized mode
1747 // Only add non-categories to m_abcArray.
1748 if ( m_abcArray
&& !property
->IsCategory() &&
1749 (parentIsCategory
|| parentIsRoot
) )
1751 m_abcArray
->DoAddChild( property
, -1, false );
1754 // Add to current mode.
1755 parent
->DoAddChild( property
, index
, true );
1759 // We are currently in Non-categorized/Alphabetic mode
1761 if ( parentIsCategory
)
1762 // Parent is category.
1763 parent
->DoAddChild( property
, index
, false );
1764 else if ( parentIsRoot
)
1766 m_regularArray
.DoAddChild( property
, -1, false );
1768 // Add to current mode
1769 if ( !property
->IsCategory() )
1770 m_abcArray
->DoAddChild( property
, index
, true );
1774 if ( property
->IsCategory() )
1776 // This is a category caption item.
1778 // Last caption is not the bottom one (this info required by append)
1779 m_lastCaptionBottomnest
= 0;
1782 // Only add name to hashmap if parent is root or category
1783 if ( property
->m_name
.length() &&
1784 (parentIsCategory
|| parentIsRoot
) )
1785 m_dictName
[property
->m_name
] = (void*) property
;
1787 VirtualHeightChanged();
1789 property
->UpdateParentValues();
1796 // -----------------------------------------------------------------------
1798 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1800 wxCHECK_RET( item
->GetParent(),
1801 wxT("this property was already deleted") );
1803 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1804 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1806 unsigned int indinparent
= item
->GetIndexInParent();
1808 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1809 wxPGProperty
* parent
= item
->GetParent();
1811 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1812 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1814 wxASSERT( item
->GetParentState() == this );
1816 wxPropertyGrid
* pg
= GetGrid();
1818 if ( DoIsPropertySelected(item
) )
1820 if ( pg
&& pg
->GetState() == this )
1822 pg
->DoRemoveFromSelection(item
,
1823 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1827 DoRemoveFromSelection(item
);
1831 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1834 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1836 // deleting a category
1837 if ( item
->IsCategory() )
1839 if ( pwc
== m_currentCategory
)
1840 m_currentCategory
= NULL
;
1843 item
->DeleteChildren();
1846 if ( !IsInNonCatMode() )
1848 // categorized mode - non-categorized array
1850 // Remove from non-cat array
1851 if ( !item
->IsCategory() &&
1852 (parent
->IsCategory() || parent
->IsRoot()) )
1855 m_abcArray
->RemoveChild(item
);
1858 // categorized mode - categorized array
1859 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1860 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1861 item
->m_parent
->FixIndicesOfChildren();
1865 // non-categorized mode - categorized array
1867 // We need to find location of item.
1868 wxPGProperty
* cat_parent
= &m_regularArray
;
1869 int cat_index
= m_regularArray
.GetChildCount();
1871 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1873 wxPGProperty
* p
= m_regularArray
.Item(i
);
1874 if ( p
== item
) { cat_index
= i
; break; }
1875 if ( p
->IsCategory() )
1877 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1878 if ( subind
!= wxNOT_FOUND
)
1880 cat_parent
= ((wxPGProperty
*)p
);
1886 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1888 // non-categorized mode - non-categorized array
1889 if ( !item
->IsCategory() )
1891 wxASSERT( item
->m_parent
== m_abcArray
);
1892 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1893 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1894 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1898 if ( item
->GetBaseName().length() &&
1899 (parent
->IsCategory() || parent
->IsRoot()) )
1900 m_dictName
.erase(item
->GetBaseName());
1902 // We need to clear parent grid's m_propHover, if it matches item
1903 if ( pg
&& pg
->m_propHover
== item
)
1904 pg
->m_propHover
= NULL
;
1906 // We can actually delete it now
1910 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1912 VirtualHeightChanged();
1915 // -----------------------------------------------------------------------
1917 #endif // wxUSE_PROPGRID