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 wxASSERT( width
>= 0 );
326 wxPropertyGrid
* pg
= GetGrid();
327 int gw
= pg
->GetClientSize().x
;
334 // -----------------------------------------------------------------------
336 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
338 wxPropertyGrid
* pg
= GetGrid();
340 if ( pg
->HasVirtualWidth() )
342 if ( m_width
< newWidth
)
343 SetVirtualWidth( newWidth
);
345 CheckColumnWidths(widthChange
);
349 SetVirtualWidth( newWidth
);
351 // This should be done before splitter auto centering
352 // NOTE: Splitter auto-centering is done in this function.
355 CheckColumnWidths(widthChange
);
357 if ( !m_isSplitterPreSet
&& m_dontCenterSplitter
)
359 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
361 // If too long, don't set splitter
362 if ( timeSinceCreation
< 250 )
364 if ( m_properties
->GetChildCount() )
366 SetSplitterLeft( false );
370 DoSetSplitterPosition( newWidth
/ 2 );
371 m_isSplitterPreSet
= false;
378 // -----------------------------------------------------------------------
379 // wxPropertyGridPageState item iteration methods
380 // -----------------------------------------------------------------------
382 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
384 if ( !m_properties
->GetChildCount() )
387 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
389 // First, get last child of last parent
390 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
391 while ( pwc
->GetChildCount() &&
392 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
393 pwc
= (wxPGProperty
*) pwc
->Last();
395 // Then, if it doesn't fit our criteria, back up until we find something that does
396 if ( pwc
->GetFlags() & itemExMask
)
398 wxPropertyGridIterator
it( this, flags
, pwc
);
399 for ( ; !it
.AtEnd(); it
.Prev() )
401 pwc
= (wxPGProperty
*) it
.GetProperty();
407 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
409 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
410 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
413 parent
= grandparent
;
414 grandparent
= (wxPGProperty
*)parent
->GetParent();
415 if ( parent
->IsCategory() && grandparent
)
416 return (wxPropertyCategory
*)parent
;
417 } while ( grandparent
);
422 // -----------------------------------------------------------------------
423 // wxPropertyGridPageState GetPropertyXXX methods
424 // -----------------------------------------------------------------------
426 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
427 wxPGProperty
* parent
) const
432 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
434 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
436 wxPGProperty
* p
= parent
->Item(i
);
437 if ( p
->m_label
== label
)
439 // Check children recursively.
440 if ( p
->GetChildCount() )
442 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
451 // -----------------------------------------------------------------------
453 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
455 wxPGHashMapS2P::const_iterator it
;
456 it
= m_dictName
.find(name
);
457 if ( it
!= m_dictName
.end() )
458 return (wxPGProperty
*) it
->second
;
462 // -----------------------------------------------------------------------
464 void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty
* p
,
465 const wxString
& newName
)
467 wxCHECK_RET( p
, wxT("invalid property id") );
469 wxPGProperty
* parent
= p
->GetParent();
471 if ( parent
->IsCategory() || parent
->IsRoot() )
473 if ( p
->GetBaseName().length() )
474 m_dictName
.erase( p
->GetBaseName() );
475 if ( newName
.length() )
476 m_dictName
[newName
] = (void*) p
;
479 p
->DoSetName(newName
);
482 // -----------------------------------------------------------------------
483 // wxPropertyGridPageState global operations
484 // -----------------------------------------------------------------------
486 // -----------------------------------------------------------------------
487 // Item iteration macros
488 // NB: Nowadays only needed for alphabetic/categoric mode switching.
489 // -----------------------------------------------------------------------
491 //#define II_INVALID_I 0x00FFFFFF
493 #define ITEM_ITERATION_VARIABLES \
494 wxPGProperty* parent; \
498 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
499 parent = m_properties; \
503 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
504 parent = startparent; \
505 i = (unsigned int)startindex; \
506 if ( parent == NULL ) \
508 parent = state->m_properties; \
513 #define ITEM_ITERATION_LOOP_BEGIN \
516 iMax = parent->GetChildCount(); \
519 wxPGProperty* p = parent->Item(i);
521 #define ITEM_ITERATION_LOOP_END \
522 if ( p->GetChildCount() ) \
525 parent = (wxPGProperty*)p; \
526 iMax = parent->GetChildCount(); \
531 i = parent->m_arrIndex + 1; \
532 parent = parent->m_parent; \
534 while ( parent != NULL );
536 bool wxPropertyGridPageState::EnableCategories( bool enable
)
539 // NB: We can't use wxPropertyGridIterator in this
540 // function, since it depends on m_arrIndexes,
541 // which, among other things, is being fixed here.
543 ITEM_ITERATION_VARIABLES
551 if ( !IsInNonCatMode() )
554 m_properties
= &m_regularArray
;
556 // fix parents, indexes, and depths
557 ITEM_ITERATION_INIT_FROM_THE_TOP
559 ITEM_ITERATION_LOOP_BEGIN
563 p
->m_parent
= parent
;
565 // If parent was category, and this is not,
566 // then the depth stays the same.
567 if ( parent
->IsCategory() &&
569 p
->m_depth
= parent
->m_depth
;
571 p
->m_depth
= parent
->m_depth
+ 1;
573 ITEM_ITERATION_LOOP_END
579 // Disable categories
582 if ( IsInNonCatMode() )
585 // Create array, if necessary.
589 m_properties
= m_abcArray
;
591 // fix parents, indexes, and depths
592 ITEM_ITERATION_INIT_FROM_THE_TOP
594 ITEM_ITERATION_LOOP_BEGIN
598 p
->m_parent
= parent
;
600 p
->m_depth
= parent
->m_depth
+ 1;
602 ITEM_ITERATION_LOOP_END
605 VirtualHeightChanged();
607 if ( m_pPropGrid
->GetState() == this )
608 m_pPropGrid
->RecalculateVirtualSize();
613 // -----------------------------------------------------------------------
615 static int wxPG_SortFunc_ByFunction(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
617 wxPGProperty
*p1
= *pp1
;
618 wxPGProperty
*p2
= *pp2
;
619 wxPropertyGrid
* pg
= p1
->GetGrid();
620 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
621 return sortFunction(pg
, p1
, p2
);
624 static int wxPG_SortFunc_ByLabel(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
626 wxPGProperty
*p1
= *pp1
;
627 wxPGProperty
*p2
= *pp2
;
628 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() );
633 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
638 static bool wxPG_SortFunc_ByFunction(wxPGProperty
*p1
, wxPGProperty
*p2
)
640 wxPropertyGrid
* pg
= p1
->GetGrid();
641 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
642 return sortFunction(pg
, p1
, p2
) < 0;
645 static bool wxPG_SortFunc_ByLabel(wxPGProperty
*p1
, wxPGProperty
*p2
)
647 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() ) < 0;
651 void wxPropertyGridPageState::DoSortChildren( wxPGProperty
* p
,
657 // Can only sort items with children
658 if ( !p
->GetChildCount() )
661 // Never sort children of aggregate properties
662 if ( p
->HasFlag(wxPG_PROP_AGGREGATE
) )
665 if ( (flags
& wxPG_SORT_TOP_LEVEL_ONLY
)
666 && !p
->IsCategory() && !p
->IsRoot() )
669 if ( GetGrid()->GetSortFunction() )
670 p
->m_children
.Sort( wxPG_SortFunc_ByFunction
);
672 p
->m_children
.Sort( wxPG_SortFunc_ByLabel
);
676 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
678 if ( GetGrid()->GetSortFunction() )
679 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
680 wxPG_SortFunc_ByFunction
);
682 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
683 wxPG_SortFunc_ByLabel
);
687 p
->FixIndicesOfChildren();
689 if ( flags
& wxPG_RECURSE
)
691 // Apply sort recursively
692 for ( unsigned int i
=0; i
<p
->GetChildCount(); i
++ )
693 DoSortChildren(p
->Item(i
), flags
);
697 // -----------------------------------------------------------------------
699 void wxPropertyGridPageState::DoSort( int flags
)
701 DoSortChildren( m_properties
, flags
| wxPG_RECURSE
);
703 // We used to sort categories as well here also if in non-categorized
704 // mode, but doing would naturally cause child indices to become
708 // -----------------------------------------------------------------------
710 bool wxPropertyGridPageState::PrepareAfterItemsAdded()
712 if ( !m_itemsAdded
) return false;
714 wxPropertyGrid
* pg
= GetGrid();
718 if ( pg
->HasFlag(wxPG_AUTO_SORT
) )
719 DoSort(wxPG_SORT_TOP_LEVEL_ONLY
);
724 // -----------------------------------------------------------------------
725 // wxPropertyGridPageState splitter, column and hittest functions
726 // -----------------------------------------------------------------------
728 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
735 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
738 // -----------------------------------------------------------------------
740 wxPropertyGridHitTestResult
741 wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
743 wxPropertyGridHitTestResult result
;
744 result
.m_column
= HitTestH( pt
.x
, &result
.m_splitter
,
745 &result
.m_splitterHitOffset
);
746 result
.m_property
= DoGetItemAtY( pt
.y
);
750 // -----------------------------------------------------------------------
752 // Used by SetSplitterLeft() and DotFitColumns()
753 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
758 wxPropertyGrid
* pg
= m_pPropGrid
;
763 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
765 wxPGProperty
* p
= pwc
->Item(i
);
766 if ( !p
->IsCategory() )
768 const wxPGCell
* cell
= NULL
;
770 p
->GetDisplayInfo(col
, -1, 0, &text
, &cell
);
771 dc
.GetTextExtent(text
, &w
, &h
);
773 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
775 // account for the bitmap
777 w
+= p
->GetImageOffset(pg
->GetImageRect(p
, -1).GetWidth());
780 w
+= (wxPG_XBEFORETEXT
*2);
786 if ( p
->GetChildCount() &&
787 ( subProps
|| p
->IsCategory() ) )
789 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
799 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
801 int n
= GetGrid()->m_marginWidth
;
803 for ( i
=0; i
<=splitterColumn
; i
++ )
808 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
810 return wxPG_DRAG_MARGIN
;
813 void wxPropertyGridPageState::PropagateColSizeDec( int column
,
817 int origWidth
= m_colWidths
[column
];
818 m_colWidths
[column
] -= decrease
;
819 int min
= GetColumnMinWidth(column
);
821 if ( m_colWidths
[column
] < min
)
823 more
= decrease
- (origWidth
- min
);
824 m_colWidths
[column
] = min
;
828 // FIXME: Causes erratic splitter changing, so as a workaround
829 // disabled if two or less columns.
831 if ( m_colWidths
.size() <= 2 )
835 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
836 PropagateColSizeDec( column
, more
, dir
);
839 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
,
841 bool WXUNUSED(allPages
),
842 bool fromAutoCenter
)
844 wxPropertyGrid
* pg
= GetGrid();
846 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
848 if ( !pg
->HasVirtualWidth() )
854 otherColumn
= splitterColumn
+ 1;
855 if ( otherColumn
== (int)m_colWidths
.size() )
857 m_colWidths
[splitterColumn
] += adjust
;
858 PropagateColSizeDec( otherColumn
, adjust
, 1 );
862 otherColumn
= splitterColumn
+ 1;
863 if ( otherColumn
== (int)m_colWidths
.size() )
865 m_colWidths
[otherColumn
] -= adjust
;
866 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
871 m_colWidths
[splitterColumn
] += adjust
;
874 if ( splitterColumn
== 0 )
875 m_fSplitterX
= (double) newXPos
;
877 if ( !fromAutoCenter
)
879 // Don't allow initial splitter auto-positioning after this.
880 m_isSplitterPreSet
= true;
886 // Moves splitter so that all labels are visible, but just.
887 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
889 wxPropertyGrid
* pg
= GetGrid();
891 dc
.SetFont(pg
->GetFont());
893 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
897 maxW
+= pg
->m_marginWidth
;
898 DoSetSplitterPosition( maxW
);
901 m_dontCenterSplitter
= true;
904 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
906 wxPropertyGrid
* pg
= GetGrid();
908 dc
.SetFont(pg
->GetFont());
910 int marginWidth
= pg
->m_marginWidth
;
911 int accWid
= marginWidth
;
912 int maxColWidth
= 500;
914 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
916 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
917 int colMinWidth
= GetColumnMinWidth(col
);
918 if ( fitWid
< colMinWidth
)
919 fitWid
= colMinWidth
;
920 else if ( fitWid
> maxColWidth
)
921 fitWid
= maxColWidth
;
923 m_colWidths
[col
] = fitWid
;
928 // Expand last one to fill the width
929 int remaining
= m_width
- accWid
;
930 m_colWidths
[GetColumnCount()-1] += remaining
;
932 m_dontCenterSplitter
= true;
934 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
935 m_fSplitterX
= (double) firstSplitterX
;
937 // Don't allow initial splitter auto-positioning after this.
938 if ( pg
->GetState() == this )
940 pg
->SetSplitterPosition(firstSplitterX
, false);
945 pg
->GetVirtualSize(&x
, &y
);
947 return wxSize(accWid
, y
);
950 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
955 wxPropertyGrid
* pg
= GetGrid();
958 unsigned int lastColumn
= m_colWidths
.size() - 1;
960 int clientWidth
= pg
->GetClientSize().x
;
963 // Column to reduce, if needed. Take last one that exceeds minimum width.
966 wxLogTrace("propgrid",
967 wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
972 for ( i
=0; i
<m_colWidths
.size(); i
++ )
974 int min
= GetColumnMinWidth(i
);
975 if ( m_colWidths
[i
] <= min
)
977 m_colWidths
[i
] = min
;
981 // Always reduce the last column that is larger than minimum size
982 // (looks nicer, even with auto-centering enabled).
987 int colsWidth
= pg
->m_marginWidth
;
988 for ( i
=0; i
<m_colWidths
.size(); i
++ )
989 colsWidth
+= m_colWidths
[i
];
991 wxLogTrace("propgrid",
992 wxS(" HasVirtualWidth: %i colsWidth: %i"),
993 (int)pg
->HasVirtualWidth(), colsWidth
);
995 // Then mode-based requirement
996 if ( !pg
->HasVirtualWidth() )
998 int widthHigher
= width
- colsWidth
;
1000 // Adapt colsWidth to width
1001 if ( colsWidth
< width
)
1004 wxLogTrace("propgrid",
1005 wxS(" Adjust last column to %i"),
1006 m_colWidths
[lastColumn
] + widthHigher
);
1007 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
1009 else if ( colsWidth
> width
)
1012 if ( reduceCol
!= -1 )
1014 wxLogTrace("propgrid",
1015 wxT(" Reduce column %i (by %i)"),
1016 reduceCol
, -widthHigher
);
1018 // Reduce widest column, and recheck
1019 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
1020 CheckColumnWidths();
1026 // Only check colsWidth against clientWidth
1027 if ( colsWidth
< clientWidth
)
1029 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
1032 m_width
= colsWidth
;
1034 // If width changed, recalculate virtual size
1035 if ( pg
->GetState() == this )
1036 pg
->RecalculateVirtualSize();
1039 for ( i
=0; i
<m_colWidths
.size(); i
++ )
1041 wxLogTrace("propgrid", wxS("col%i: %i"), i
, m_colWidths
[i
]);
1044 // Auto center splitter
1045 if ( !m_dontCenterSplitter
&& m_colWidths
.size() == 2 )
1047 float centerX
= (float)(pg
->m_width
/2);
1050 if ( m_fSplitterX
< 0.0 )
1052 splitterX
= centerX
;
1054 else if ( widthChange
)
1056 //float centerX = float(pg->GetSize().x) * 0.5;
1059 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
1060 float deviation
= fabs(centerX
- splitterX
);
1062 // If deviating from center, adjust towards it
1063 if ( deviation
> 20.0 )
1065 if ( splitterX
> centerX
)
1073 // No width change, just keep sure we keep splitter position intact
1074 splitterX
= m_fSplitterX
;
1075 float deviation
= fabs(centerX
- splitterX
);
1076 if ( deviation
> 50.0 )
1078 splitterX
= centerX
;
1082 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1084 m_fSplitterX
= splitterX
; // needed to retain accuracy
1088 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1090 wxASSERT( colCount
>= 2 );
1091 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1092 if ( m_colWidths
.size() > (unsigned int)colCount
)
1093 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1095 if ( m_pPropGrid
->GetState() == this )
1096 m_pPropGrid
->RecalculateVirtualSize();
1098 CheckColumnWidths();
1101 // Returns column index, -1 for margin
1102 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1104 int cx
= GetGrid()->m_marginWidth
;
1106 int prevSplitter
= -1;
1111 if ( col
>= (int)m_colWidths
.size() )
1117 cx
+= m_colWidths
[col
];
1120 // Near prev. splitter
1123 int diff
= x
- prevSplitter
;
1124 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1126 *pSplitterHit
= col
- 1;
1127 *pSplitterHitOffset
= diff
;
1132 // Near next splitter
1133 int nextSplitter
= cx
;
1134 if ( col
< (int)(m_colWidths
.size()-1) )
1136 int diff
= x
- nextSplitter
;
1137 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1139 *pSplitterHit
= col
;
1140 *pSplitterHitOffset
= diff
;
1149 bool wxPropertyGridPageState::ArePropertiesAdjacent( wxPGProperty
* prop1
,
1150 wxPGProperty
* prop2
,
1151 int iterFlags
) const
1153 const wxPGProperty
* ap1
=
1154 wxPropertyGridConstIterator::OneStep(this,
1158 if ( ap1
&& ap1
== prop2
)
1161 const wxPGProperty
* ap2
=
1162 wxPropertyGridConstIterator::OneStep(this,
1166 if ( ap2
&& ap2
== prop2
)
1172 // -----------------------------------------------------------------------
1173 // wxPropertyGridPageState property value setting and getting
1174 // -----------------------------------------------------------------------
1176 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1180 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1182 wxVariant variant
= p
->GetValueRef();
1185 if ( p
->GetMaxLength() <= 0 )
1186 res
= p
->StringToValue( variant
, value
, flags
);
1188 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1192 p
->SetValue(variant
);
1193 if ( p
== m_pPropGrid
->GetSelection() &&
1194 this == m_pPropGrid
->GetState() )
1195 m_pPropGrid
->RefreshEditor();
1203 // -----------------------------------------------------------------------
1205 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1210 if ( p
== m_pPropGrid
->GetSelection() &&
1211 this == m_pPropGrid
->GetState() )
1212 m_pPropGrid
->RefreshEditor();
1219 // -----------------------------------------------------------------------
1221 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1225 // wnd_primary has to be given so the control can be updated as well.
1227 DoSetPropertyValue(p
, v
);
1233 // -----------------------------------------------------------------------
1234 // wxPropertyGridPageState property operations
1235 // -----------------------------------------------------------------------
1237 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1239 const wxArrayPGProperty
& selection
= m_selection
;
1241 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1243 if ( selection
[i
] == prop
)
1250 // -----------------------------------------------------------------------
1252 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1254 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1256 if ( m_selection
[i
] == prop
)
1258 wxPropertyGrid
* pg
= m_pPropGrid
;
1259 if ( i
== 0 && pg
->GetState() == this )
1261 // If first item (ie. one with the active editor) was
1262 // deselected, then we need to take some extra measures.
1263 wxArrayPGProperty sel
= m_selection
;
1264 sel
.erase( sel
.begin() + i
);
1266 wxPGProperty
* newFirst
;
1272 pg
->DoSelectProperty(newFirst
,
1273 wxPG_SEL_DONT_SEND_EVENT
);
1281 m_selection
.erase( m_selection
.begin() + i
);
1288 // -----------------------------------------------------------------------
1290 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1292 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1294 if ( !p
->GetChildCount() ) return false;
1296 if ( !p
->IsExpanded() ) return false;
1298 p
->SetExpanded(false);
1300 VirtualHeightChanged();
1305 // -----------------------------------------------------------------------
1307 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1309 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1311 if ( !p
->GetChildCount() ) return false;
1313 if ( p
->IsExpanded() ) return false;
1315 p
->SetExpanded(true);
1317 VirtualHeightChanged();
1322 // -----------------------------------------------------------------------
1324 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1326 if ( this == m_pPropGrid
->GetState() )
1327 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1333 // -----------------------------------------------------------------------
1335 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1338 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1340 p
->SetFlag( wxPG_PROP_HIDDEN
);
1342 if ( flags
& wxPG_RECURSE
)
1345 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1346 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1349 VirtualHeightChanged();
1354 // -----------------------------------------------------------------------
1356 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1362 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1367 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1371 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1376 p
->m_flags
|= wxPG_PROP_DISABLED
;
1380 // Apply same to sub-properties as well
1382 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1383 DoEnableProperty( p
->Item(i
), enable
);
1390 // -----------------------------------------------------------------------
1391 // wxPropertyGridPageState wxVariant related routines
1392 // -----------------------------------------------------------------------
1394 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1395 // Never includes sub-properties (unless they are parented by wxParentProperty).
1396 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1397 wxPGProperty
* baseparent
,
1400 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1402 // Root is the default base-parent.
1406 wxVariantList tempList
;
1407 wxVariant
v( tempList
, listname
);
1409 if ( pwc
->GetChildCount() )
1411 if ( flags
& wxPG_KEEP_STRUCTURE
)
1413 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1416 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1418 wxPGProperty
* p
= pwc
->Item(i
);
1419 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1421 wxVariant variant
= p
->GetValue();
1422 variant
.SetName( p
->GetBaseName() );
1423 v
.Append( variant
);
1427 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1429 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1430 v
.Append( p
->GetAttributesAsList() );
1435 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1436 it
.SetBaseParent( pwc
);
1438 for ( ; !it
.AtEnd(); it
.Next() )
1440 const wxPGProperty
* p
= it
.GetProperty();
1442 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1443 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1445 wxVariant variant
= p
->GetValue();
1446 variant
.SetName( p
->GetName() );
1447 v
.Append( variant
);
1448 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1449 v
.Append( p
->GetAttributesAsList() );
1458 // -----------------------------------------------------------------------
1460 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1462 unsigned char origFrozen
= 1;
1464 if ( m_pPropGrid
->GetState() == this )
1466 origFrozen
= m_pPropGrid
->m_frozen
;
1467 if ( !origFrozen
) m_pPropGrid
->Freeze();
1470 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1472 if ( !use_category
)
1473 use_category
= (wxPropertyCategory
*)m_properties
;
1475 // Let's iterate over the list of variants.
1476 wxVariantList::const_iterator node
;
1477 int numSpecialEntries
= 0;
1480 // Second pass for special entries
1481 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1483 wxVariant
*current
= (wxVariant
*)*node
;
1485 // Make sure it is wxVariant.
1486 wxASSERT( current
);
1487 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1489 const wxString
& name
= current
->GetName();
1490 if ( name
.length() > 0 )
1493 // '@' signified a special entry
1494 if ( name
[0] == wxS('@') )
1496 numSpecialEntries
++;
1500 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1503 wxPGProperty
* p
= foundProp
;
1505 // If it was a list, we still have to go through it.
1506 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1508 DoSetPropertyValues( current
->GetList(),
1509 p
->IsCategory()?p
:(NULL
)
1514 wxASSERT_LEVEL_2_MSG(
1515 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1517 wxS("setting value of property \"%s\" from variant"),
1518 p
->GetName().c_str())
1521 p
->SetValue(*current
);
1527 if ( current
->GetType() != wxS("list") )
1533 // Yes, it is; create a sub category and append contents there.
1534 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1535 DoSetPropertyValues( current
->GetList(), newCat
);
1542 if ( numSpecialEntries
)
1544 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1546 wxVariant
*current
= (wxVariant
*)*node
;
1548 const wxString
& name
= current
->GetName();
1549 if ( name
.length() > 0 )
1552 // '@' signified a special entry
1553 if ( name
[0] == wxS('@') )
1555 numSpecialEntries
--;
1557 size_t pos2
= name
.rfind(wxS('@'));
1558 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1560 wxString propName
= name
.substr(1, pos2
-1);
1561 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1563 if ( entryType
== wxS("attr") )
1566 // List of attributes
1567 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1570 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1572 wxVariantList
& list2
= current
->GetList();
1573 wxVariantList::const_iterator node2
;
1575 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1577 wxVariant
*attr
= (wxVariant
*)*node2
;
1578 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1583 // ERROR: No such property: 'propName'
1589 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1594 if ( !numSpecialEntries
)
1601 m_pPropGrid
->Thaw();
1603 if ( this == m_pPropGrid
->GetState() )
1604 m_pPropGrid
->RefreshEditor();
1609 // -----------------------------------------------------------------------
1610 // wxPropertyGridPageState property adding and removal
1611 // -----------------------------------------------------------------------
1613 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1614 wxPGProperty
* scheduledParent
)
1616 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1618 // This will allow better behavior.
1619 if ( scheduledParent
== m_properties
)
1620 scheduledParent
= NULL
;
1622 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1624 wxASSERT_MSG( property
->GetBaseName().length(),
1625 "Property's children must have unique, non-empty names within their scope" );
1628 property
->m_parentState
= this;
1630 if ( property
->IsCategory() )
1633 // Parent of a category must be either root or another category
1634 // (otherwise Bad Things might happen).
1635 wxASSERT_MSG( scheduledParent
== NULL
||
1636 scheduledParent
== m_properties
||
1637 scheduledParent
->IsCategory(),
1638 wxT("Parent of a category must be either root or another category."));
1640 // If we already have category with same name, delete given property
1641 // and use it instead as most recent caption item.
1642 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1645 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1646 if ( pwc
->IsCategory() ) // Must be a category.
1649 m_currentCategory
= pwc
;
1656 // Warn for identical names in debug mode.
1657 if ( BaseGetPropertyByName(property
->GetName()) &&
1658 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1660 wxFAIL_MSG(wxString::Format(
1661 "wxPropertyGrid item with name \"%s\" already exists",
1662 property
->GetName()));
1664 wxPGGlobalVars
->m_warnings
++;
1666 #endif // wxDEBUG_LEVEL
1668 // Make sure nothing is selected.
1670 propGrid
->ClearSelection(false);
1672 // NULL parent == root parent
1673 if ( !scheduledParent
)
1674 scheduledParent
= DoGetRoot();
1676 property
->m_parent
= scheduledParent
;
1678 property
->InitAfterAdded(this, propGrid
);
1680 if ( property
->IsCategory() )
1682 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1684 m_currentCategory
= pc
;
1686 // Calculate text extent for category caption
1688 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1694 // -----------------------------------------------------------------------
1696 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1698 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1699 if ( property
->IsCategory() )
1702 return DoInsert( cur_cat
, -1, property
);
1705 // -----------------------------------------------------------------------
1707 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1710 parent
= m_properties
;
1712 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1714 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1716 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1718 // PrepareToAddItem() may just decide to use use current category
1719 // instead of adding new one.
1721 return m_currentCategory
;
1723 bool parentIsRoot
= parent
->IsRoot();
1724 bool parentIsCategory
= parent
->IsCategory();
1726 // Note that item must be added into current mode later.
1728 // If parent is wxParentProperty, just stick it in...
1729 // If parent is root (m_properties), then...
1730 // In categoric mode: Add as last item in m_abcArray (if not category).
1731 // Add to given index in m_regularArray.
1732 // In non-cat mode: Add as last item in m_regularArray.
1733 // Add to given index in m_abcArray.
1734 // If parent is category, then...
1735 // 1) Add to given category in given index.
1736 // 2) Add as last item in m_abcArray.
1738 if ( m_properties
== &m_regularArray
)
1740 // We are currently in Categorized mode
1742 // Only add non-categories to m_abcArray.
1743 if ( m_abcArray
&& !property
->IsCategory() &&
1744 (parentIsCategory
|| parentIsRoot
) )
1746 m_abcArray
->DoAddChild( property
, -1, false );
1749 // Add to current mode.
1750 parent
->DoAddChild( property
, index
, true );
1754 // We are currently in Non-categorized/Alphabetic mode
1756 if ( parentIsCategory
)
1757 // Parent is category.
1758 parent
->DoAddChild( property
, index
, false );
1759 else if ( parentIsRoot
)
1761 m_regularArray
.DoAddChild( property
, -1, false );
1763 // Add to current mode
1764 if ( !property
->IsCategory() )
1765 m_abcArray
->DoAddChild( property
, index
, true );
1769 if ( property
->IsCategory() )
1771 // This is a category caption item.
1773 // Last caption is not the bottom one (this info required by append)
1774 m_lastCaptionBottomnest
= 0;
1777 // Only add name to hashmap if parent is root or category
1778 if ( property
->m_name
.length() &&
1779 (parentIsCategory
|| parentIsRoot
) )
1780 m_dictName
[property
->m_name
] = (void*) property
;
1782 VirtualHeightChanged();
1784 property
->UpdateParentValues();
1791 // -----------------------------------------------------------------------
1793 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1795 wxCHECK_RET( item
->GetParent(),
1796 wxT("this property was already deleted") );
1798 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1799 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1801 unsigned int indinparent
= item
->GetIndexInParent();
1803 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1804 wxPGProperty
* parent
= item
->GetParent();
1806 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1807 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1809 wxASSERT( item
->GetParentState() == this );
1811 wxPropertyGrid
* pg
= GetGrid();
1813 if ( DoIsPropertySelected(item
) )
1815 if ( pg
&& pg
->GetState() == this )
1817 pg
->DoRemoveFromSelection(item
,
1818 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1822 DoRemoveFromSelection(item
);
1826 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1829 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1831 // deleting a category
1832 if ( item
->IsCategory() )
1834 if ( pwc
== m_currentCategory
)
1835 m_currentCategory
= NULL
;
1838 item
->DeleteChildren();
1841 if ( !IsInNonCatMode() )
1843 // categorized mode - non-categorized array
1845 // Remove from non-cat array
1846 if ( !item
->IsCategory() &&
1847 (parent
->IsCategory() || parent
->IsRoot()) )
1850 m_abcArray
->RemoveChild(item
);
1853 // categorized mode - categorized array
1854 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1855 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1856 item
->m_parent
->FixIndicesOfChildren();
1860 // non-categorized mode - categorized array
1862 // We need to find location of item.
1863 wxPGProperty
* cat_parent
= &m_regularArray
;
1864 int cat_index
= m_regularArray
.GetChildCount();
1866 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1868 wxPGProperty
* p
= m_regularArray
.Item(i
);
1869 if ( p
== item
) { cat_index
= i
; break; }
1870 if ( p
->IsCategory() )
1872 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1873 if ( subind
!= wxNOT_FOUND
)
1875 cat_parent
= ((wxPGProperty
*)p
);
1881 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1883 // non-categorized mode - non-categorized array
1884 if ( !item
->IsCategory() )
1886 wxASSERT( item
->m_parent
== m_abcArray
);
1887 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1888 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1889 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1893 if ( item
->GetBaseName().length() &&
1894 (parent
->IsCategory() || parent
->IsRoot()) )
1895 m_dictName
.erase(item
->GetBaseName());
1897 // We need to clear parent grid's m_propHover, if it matches item
1898 if ( pg
&& pg
->m_propHover
== item
)
1899 pg
->m_propHover
= NULL
;
1901 // We can actually delete it now
1905 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1907 VirtualHeightChanged();
1910 // -----------------------------------------------------------------------
1912 #endif // wxUSE_PROPGRID