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 // -----------------------------------------------------------------------
1143 // wxPropertyGridPageState property value setting and getting
1144 // -----------------------------------------------------------------------
1146 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1150 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1152 wxVariant variant
= p
->GetValueRef();
1155 if ( p
->GetMaxLength() <= 0 )
1156 res
= p
->StringToValue( variant
, value
, flags
);
1158 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1162 p
->SetValue(variant
);
1163 if ( p
== m_pPropGrid
->GetSelection() &&
1164 this == m_pPropGrid
->GetState() )
1165 m_pPropGrid
->RefreshEditor();
1173 // -----------------------------------------------------------------------
1175 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1180 if ( p
== m_pPropGrid
->GetSelection() &&
1181 this == m_pPropGrid
->GetState() )
1182 m_pPropGrid
->RefreshEditor();
1189 // -----------------------------------------------------------------------
1191 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1195 // wnd_primary has to be given so the control can be updated as well.
1197 DoSetPropertyValue(p
, v
);
1203 // -----------------------------------------------------------------------
1204 // wxPropertyGridPageState property operations
1205 // -----------------------------------------------------------------------
1207 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1209 const wxArrayPGProperty
& selection
= m_selection
;
1211 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1213 if ( selection
[i
] == prop
)
1220 // -----------------------------------------------------------------------
1222 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1224 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1226 if ( m_selection
[i
] == prop
)
1228 wxPropertyGrid
* pg
= m_pPropGrid
;
1229 if ( i
== 0 && pg
->GetState() == this )
1231 // If first item (ie. one with the active editor) was
1232 // deselected, then we need to take some extra measures.
1233 wxArrayPGProperty sel
= m_selection
;
1234 sel
.erase( sel
.begin() + i
);
1236 wxPGProperty
* newFirst
;
1242 pg
->DoSelectProperty(newFirst
,
1243 wxPG_SEL_DONT_SEND_EVENT
);
1251 m_selection
.erase( m_selection
.begin() + i
);
1258 // -----------------------------------------------------------------------
1260 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1262 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1264 if ( !p
->GetChildCount() ) return false;
1266 if ( !p
->IsExpanded() ) return false;
1268 p
->SetExpanded(false);
1270 VirtualHeightChanged();
1275 // -----------------------------------------------------------------------
1277 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1279 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1281 if ( !p
->GetChildCount() ) return false;
1283 if ( p
->IsExpanded() ) return false;
1285 p
->SetExpanded(true);
1287 VirtualHeightChanged();
1292 // -----------------------------------------------------------------------
1294 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1296 if ( this == m_pPropGrid
->GetState() )
1297 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1303 // -----------------------------------------------------------------------
1305 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1308 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1310 p
->SetFlag( wxPG_PROP_HIDDEN
);
1312 if ( flags
& wxPG_RECURSE
)
1315 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1316 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1319 VirtualHeightChanged();
1324 // -----------------------------------------------------------------------
1326 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1332 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1337 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1341 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1346 p
->m_flags
|= wxPG_PROP_DISABLED
;
1350 // Apply same to sub-properties as well
1352 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1353 DoEnableProperty( p
->Item(i
), enable
);
1360 // -----------------------------------------------------------------------
1361 // wxPropertyGridPageState wxVariant related routines
1362 // -----------------------------------------------------------------------
1364 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1365 // Never includes sub-properties (unless they are parented by wxParentProperty).
1366 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1367 wxPGProperty
* baseparent
,
1370 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1372 // Root is the default base-parent.
1376 wxVariantList tempList
;
1377 wxVariant
v( tempList
, listname
);
1379 if ( pwc
->GetChildCount() )
1381 if ( flags
& wxPG_KEEP_STRUCTURE
)
1383 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1386 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1388 wxPGProperty
* p
= pwc
->Item(i
);
1389 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1391 wxVariant variant
= p
->GetValue();
1392 variant
.SetName( p
->GetBaseName() );
1393 v
.Append( variant
);
1397 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1399 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1400 v
.Append( p
->GetAttributesAsList() );
1405 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1406 it
.SetBaseParent( pwc
);
1408 for ( ; !it
.AtEnd(); it
.Next() )
1410 const wxPGProperty
* p
= it
.GetProperty();
1412 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1413 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1415 wxVariant variant
= p
->GetValue();
1416 variant
.SetName( p
->GetName() );
1417 v
.Append( variant
);
1418 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1419 v
.Append( p
->GetAttributesAsList() );
1428 // -----------------------------------------------------------------------
1430 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1432 unsigned char origFrozen
= 1;
1434 if ( m_pPropGrid
->GetState() == this )
1436 origFrozen
= m_pPropGrid
->m_frozen
;
1437 if ( !origFrozen
) m_pPropGrid
->Freeze();
1440 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1442 if ( !use_category
)
1443 use_category
= (wxPropertyCategory
*)m_properties
;
1445 // Let's iterate over the list of variants.
1446 wxVariantList::const_iterator node
;
1447 int numSpecialEntries
= 0;
1450 // Second pass for special entries
1451 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1453 wxVariant
*current
= (wxVariant
*)*node
;
1455 // Make sure it is wxVariant.
1456 wxASSERT( current
);
1457 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1459 const wxString
& name
= current
->GetName();
1460 if ( name
.length() > 0 )
1463 // '@' signified a special entry
1464 if ( name
[0] == wxS('@') )
1466 numSpecialEntries
++;
1470 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1473 wxPGProperty
* p
= foundProp
;
1475 // If it was a list, we still have to go through it.
1476 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1478 DoSetPropertyValues( current
->GetList(),
1479 p
->IsCategory()?p
:(NULL
)
1484 wxASSERT_LEVEL_2_MSG(
1485 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1487 wxS("setting value of property \"%s\" from variant"),
1488 p
->GetName().c_str())
1491 p
->SetValue(*current
);
1497 if ( current
->GetType() != wxS("list") )
1503 // Yes, it is; create a sub category and append contents there.
1504 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1505 DoSetPropertyValues( current
->GetList(), newCat
);
1512 if ( numSpecialEntries
)
1514 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1516 wxVariant
*current
= (wxVariant
*)*node
;
1518 const wxString
& name
= current
->GetName();
1519 if ( name
.length() > 0 )
1522 // '@' signified a special entry
1523 if ( name
[0] == wxS('@') )
1525 numSpecialEntries
--;
1527 size_t pos2
= name
.rfind(wxS('@'));
1528 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1530 wxString propName
= name
.substr(1, pos2
-1);
1531 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1533 if ( entryType
== wxS("attr") )
1536 // List of attributes
1537 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1540 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1542 wxVariantList
& list2
= current
->GetList();
1543 wxVariantList::const_iterator node2
;
1545 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1547 wxVariant
*attr
= (wxVariant
*)*node2
;
1548 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1553 // ERROR: No such property: 'propName'
1559 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1564 if ( !numSpecialEntries
)
1571 m_pPropGrid
->Thaw();
1573 if ( this == m_pPropGrid
->GetState() )
1574 m_pPropGrid
->RefreshEditor();
1579 // -----------------------------------------------------------------------
1580 // wxPropertyGridPageState property adding and removal
1581 // -----------------------------------------------------------------------
1583 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1584 wxPGProperty
* scheduledParent
)
1586 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1588 // This will allow better behavior.
1589 if ( scheduledParent
== m_properties
)
1590 scheduledParent
= NULL
;
1592 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1594 wxASSERT_MSG( property
->GetBaseName().length(),
1595 "Property's children must have unique, non-empty names within their scope" );
1598 property
->m_parentState
= this;
1600 if ( property
->IsCategory() )
1603 // Parent of a category must be either root or another category
1604 // (otherwise Bad Things might happen).
1605 wxASSERT_MSG( scheduledParent
== NULL
||
1606 scheduledParent
== m_properties
||
1607 scheduledParent
->IsCategory(),
1608 wxT("Parent of a category must be either root or another category."));
1610 // If we already have category with same name, delete given property
1611 // and use it instead as most recent caption item.
1612 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1615 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1616 if ( pwc
->IsCategory() ) // Must be a category.
1619 m_currentCategory
= pwc
;
1626 // Warn for identical names in debug mode.
1627 if ( BaseGetPropertyByName(property
->GetName()) &&
1628 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1630 wxFAIL_MSG(wxString::Format(
1631 "wxPropertyGrid item with name \"%s\" already exists",
1632 property
->GetName()));
1634 wxPGGlobalVars
->m_warnings
++;
1636 #endif // wxDEBUG_LEVEL
1638 // Make sure nothing is selected.
1640 propGrid
->ClearSelection(false);
1642 // NULL parent == root parent
1643 if ( !scheduledParent
)
1644 scheduledParent
= DoGetRoot();
1646 property
->m_parent
= scheduledParent
;
1648 property
->InitAfterAdded(this, propGrid
);
1650 if ( property
->IsCategory() )
1652 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1654 m_currentCategory
= pc
;
1656 // Calculate text extent for category caption
1658 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1664 // -----------------------------------------------------------------------
1666 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1668 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1669 if ( property
->IsCategory() )
1672 return DoInsert( cur_cat
, -1, property
);
1675 // -----------------------------------------------------------------------
1677 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1680 parent
= m_properties
;
1682 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1684 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1686 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1688 // PrepareToAddItem() may just decide to use use current category
1689 // instead of adding new one.
1691 return m_currentCategory
;
1693 bool parentIsRoot
= parent
->IsRoot();
1694 bool parentIsCategory
= parent
->IsCategory();
1696 // Note that item must be added into current mode later.
1698 // If parent is wxParentProperty, just stick it in...
1699 // If parent is root (m_properties), then...
1700 // In categoric mode: Add as last item in m_abcArray (if not category).
1701 // Add to given index in m_regularArray.
1702 // In non-cat mode: Add as last item in m_regularArray.
1703 // Add to given index in m_abcArray.
1704 // If parent is category, then...
1705 // 1) Add to given category in given index.
1706 // 2) Add as last item in m_abcArray.
1708 if ( m_properties
== &m_regularArray
)
1710 // We are currently in Categorized mode
1712 // Only add non-categories to m_abcArray.
1713 if ( m_abcArray
&& !property
->IsCategory() &&
1714 (parentIsCategory
|| parentIsRoot
) )
1716 m_abcArray
->DoAddChild( property
, -1, false );
1719 // Add to current mode.
1720 parent
->DoAddChild( property
, index
, true );
1724 // We are currently in Non-categorized/Alphabetic mode
1726 if ( parentIsCategory
)
1727 // Parent is category.
1728 parent
->DoAddChild( property
, index
, false );
1729 else if ( parentIsRoot
)
1731 m_regularArray
.DoAddChild( property
, -1, false );
1733 // Add to current mode
1734 if ( !property
->IsCategory() )
1735 m_abcArray
->DoAddChild( property
, index
, true );
1739 if ( property
->IsCategory() )
1741 // This is a category caption item.
1743 // Last caption is not the bottom one (this info required by append)
1744 m_lastCaptionBottomnest
= 0;
1747 // Only add name to hashmap if parent is root or category
1748 if ( property
->m_name
.length() &&
1749 (parentIsCategory
|| parentIsRoot
) )
1750 m_dictName
[property
->m_name
] = (void*) property
;
1752 VirtualHeightChanged();
1754 property
->UpdateParentValues();
1761 // -----------------------------------------------------------------------
1763 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1765 wxCHECK_RET( item
->GetParent(),
1766 wxT("this property was already deleted") );
1768 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1769 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1771 unsigned int indinparent
= item
->GetIndexInParent();
1773 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1774 wxPGProperty
* parent
= item
->GetParent();
1776 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1777 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1779 wxASSERT( item
->GetParentState() == this );
1781 wxPropertyGrid
* pg
= GetGrid();
1783 if ( DoIsPropertySelected(item
) )
1785 if ( pg
&& pg
->GetState() == this )
1787 pg
->DoRemoveFromSelection(item
,
1788 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1792 DoRemoveFromSelection(item
);
1796 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1799 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1801 // deleting a category
1802 if ( item
->IsCategory() )
1804 if ( pwc
== m_currentCategory
)
1805 m_currentCategory
= NULL
;
1808 item
->DeleteChildren();
1811 if ( !IsInNonCatMode() )
1813 // categorized mode - non-categorized array
1815 // Remove from non-cat array
1816 if ( !item
->IsCategory() &&
1817 (parent
->IsCategory() || parent
->IsRoot()) )
1820 m_abcArray
->RemoveChild(item
);
1823 // categorized mode - categorized array
1824 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1825 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1826 item
->m_parent
->FixIndicesOfChildren();
1830 // non-categorized mode - categorized array
1832 // We need to find location of item.
1833 wxPGProperty
* cat_parent
= &m_regularArray
;
1834 int cat_index
= m_regularArray
.GetChildCount();
1836 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1838 wxPGProperty
* p
= m_regularArray
.Item(i
);
1839 if ( p
== item
) { cat_index
= i
; break; }
1840 if ( p
->IsCategory() )
1842 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1843 if ( subind
!= wxNOT_FOUND
)
1845 cat_parent
= ((wxPGProperty
*)p
);
1851 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1853 // non-categorized mode - non-categorized array
1854 if ( !item
->IsCategory() )
1856 wxASSERT( item
->m_parent
== m_abcArray
);
1857 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1858 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1859 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1863 if ( item
->GetBaseName().length() &&
1864 (parent
->IsCategory() || parent
->IsRoot()) )
1865 m_dictName
.erase(item
->GetBaseName());
1867 // We need to clear parent grid's m_propHover, if it matches item
1868 if ( pg
&& pg
->m_propHover
== item
)
1869 pg
->m_propHover
= NULL
;
1871 // We can actually delete it now
1875 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1877 VirtualHeightChanged();
1880 // -----------------------------------------------------------------------
1882 #endif // wxUSE_PROPGRID