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
);
772 // TODO: Add bitmap support.
774 w
+= (wxPG_XBEFORETEXT
*2);
780 if ( p
->GetChildCount() &&
781 ( subProps
|| p
->IsCategory() ) )
783 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
793 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
795 int n
= GetGrid()->m_marginWidth
;
797 for ( i
=0; i
<=splitterColumn
; i
++ )
802 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
804 return wxPG_DRAG_MARGIN
;
807 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
809 int origWidth
= m_colWidths
[column
];
810 m_colWidths
[column
] -= decrease
;
811 int min
= GetColumnMinWidth(column
);
813 if ( m_colWidths
[column
] < min
)
815 more
= decrease
- (origWidth
- min
);
816 m_colWidths
[column
] = min
;
820 // FIXME: Causes erratic splitter changing, so as a workaround
821 // disabled if two or less columns.
823 if ( m_colWidths
.size() <= 2 )
827 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
828 PropagateColSizeDec( column
, more
, dir
);
831 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
833 wxPropertyGrid
* pg
= GetGrid();
835 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
837 if ( !pg
->HasVirtualWidth() )
843 otherColumn
= splitterColumn
+ 1;
844 if ( otherColumn
== (int)m_colWidths
.size() )
846 m_colWidths
[splitterColumn
] += adjust
;
847 PropagateColSizeDec( otherColumn
, adjust
, 1 );
851 otherColumn
= splitterColumn
+ 1;
852 if ( otherColumn
== (int)m_colWidths
.size() )
854 m_colWidths
[otherColumn
] -= adjust
;
855 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
860 m_colWidths
[splitterColumn
] += adjust
;
863 if ( splitterColumn
== 0 )
864 m_fSplitterX
= (double) newXPos
;
866 if ( !fromAutoCenter
)
868 // Don't allow initial splitter auto-positioning after this.
869 if ( pg
->GetState() == this )
870 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
876 // Moves splitter so that all labels are visible, but just.
877 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
879 wxPropertyGrid
* pg
= GetGrid();
881 dc
.SetFont(pg
->GetFont());
883 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
887 maxW
+= pg
->m_marginWidth
;
888 DoSetSplitterPosition( maxW
);
891 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
894 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
896 wxPropertyGrid
* pg
= GetGrid();
898 dc
.SetFont(pg
->GetFont());
900 int marginWidth
= pg
->m_marginWidth
;
901 int accWid
= marginWidth
;
902 int maxColWidth
= 500;
904 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
906 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
907 int colMinWidth
= GetColumnMinWidth(col
);
908 if ( fitWid
< colMinWidth
)
909 fitWid
= colMinWidth
;
910 else if ( fitWid
> maxColWidth
)
911 fitWid
= maxColWidth
;
913 m_colWidths
[col
] = fitWid
;
918 // Expand last one to fill the width
919 int remaining
= m_width
- accWid
;
920 m_colWidths
[GetColumnCount()-1] += remaining
;
922 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
924 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
925 m_fSplitterX
= (double) firstSplitterX
;
927 // Don't allow initial splitter auto-positioning after this.
928 if ( pg
->GetState() == this )
930 pg
->SetSplitterPosition(firstSplitterX
, false);
935 pg
->GetVirtualSize(&x
, &y
);
937 return wxSize(accWid
, y
);
940 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
945 wxPropertyGrid
* pg
= GetGrid();
948 unsigned int lastColumn
= m_colWidths
.size() - 1;
950 int clientWidth
= pg
->GetClientSize().x
;
953 // Column to reduce, if needed. Take last one that exceeds minimum width.
956 wxLogTrace("propgrid",
957 wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
962 for ( i
=0; i
<m_colWidths
.size(); i
++ )
964 int min
= GetColumnMinWidth(i
);
965 if ( m_colWidths
[i
] <= min
)
967 m_colWidths
[i
] = min
;
971 // Always reduce the last column that is larger than minimum size
972 // (looks nicer, even with auto-centering enabled).
977 int colsWidth
= pg
->m_marginWidth
;
978 for ( i
=0; i
<m_colWidths
.size(); i
++ )
979 colsWidth
+= m_colWidths
[i
];
981 wxLogTrace("propgrid",
982 wxS(" HasVirtualWidth: %i colsWidth: %i"),
983 (int)pg
->HasVirtualWidth(), colsWidth
);
985 // Then mode-based requirement
986 if ( !pg
->HasVirtualWidth() )
988 int widthHigher
= width
- colsWidth
;
990 // Adapt colsWidth to width
991 if ( colsWidth
< width
)
994 wxLogTrace("propgrid",
995 wxS(" Adjust last column to %i"),
996 m_colWidths
[lastColumn
] + widthHigher
);
997 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
999 else if ( colsWidth
> width
)
1002 if ( reduceCol
!= -1 )
1004 wxLogTrace("propgrid",
1005 wxT(" Reduce column %i (by %i)"),
1006 reduceCol
, -widthHigher
);
1008 // Reduce widest column, and recheck
1009 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
1010 CheckColumnWidths();
1016 // Only check colsWidth against clientWidth
1017 if ( colsWidth
< clientWidth
)
1019 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
1022 m_width
= colsWidth
;
1024 // If width changed, recalculate virtual size
1025 if ( pg
->GetState() == this )
1026 pg
->RecalculateVirtualSize();
1029 for ( i
=0; i
<m_colWidths
.size(); i
++ )
1031 wxLogTrace("propgrid", wxS("col%i: %i"), i
, m_colWidths
[i
]);
1034 // Auto center splitter
1035 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
1036 m_colWidths
.size() == 2 )
1038 float centerX
= (float)(pg
->m_width
/2);
1041 if ( m_fSplitterX
< 0.0 )
1043 splitterX
= centerX
;
1045 else if ( widthChange
)
1047 //float centerX = float(pg->GetSize().x) * 0.5;
1050 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
1051 float deviation
= fabs(centerX
- splitterX
);
1053 // If deviating from center, adjust towards it
1054 if ( deviation
> 20.0 )
1056 if ( splitterX
> centerX
)
1064 // No width change, just keep sure we keep splitter position intact
1065 splitterX
= m_fSplitterX
;
1066 float deviation
= fabs(centerX
- splitterX
);
1067 if ( deviation
> 50.0 )
1069 splitterX
= centerX
;
1073 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1075 m_fSplitterX
= splitterX
; // needed to retain accuracy
1079 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1081 wxASSERT( colCount
>= 2 );
1082 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1083 if ( m_colWidths
.size() > (unsigned int)colCount
)
1084 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1086 if ( m_pPropGrid
->GetState() == this )
1087 m_pPropGrid
->RecalculateVirtualSize();
1089 CheckColumnWidths();
1092 // Returns column index, -1 for margin
1093 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1095 int cx
= GetGrid()->m_marginWidth
;
1097 int prevSplitter
= -1;
1102 if ( col
>= (int)m_colWidths
.size() )
1108 cx
+= m_colWidths
[col
];
1111 // Near prev. splitter
1114 int diff
= x
- prevSplitter
;
1115 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1117 *pSplitterHit
= col
- 1;
1118 *pSplitterHitOffset
= diff
;
1123 // Near next splitter
1124 int nextSplitter
= cx
;
1125 if ( col
< (int)(m_colWidths
.size()-1) )
1127 int diff
= x
- nextSplitter
;
1128 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1130 *pSplitterHit
= col
;
1131 *pSplitterHitOffset
= diff
;
1140 // -----------------------------------------------------------------------
1141 // wxPropertyGridPageState property value setting and getting
1142 // -----------------------------------------------------------------------
1144 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1148 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1150 wxVariant variant
= p
->GetValueRef();
1153 if ( p
->GetMaxLength() <= 0 )
1154 res
= p
->StringToValue( variant
, value
, flags
);
1156 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1160 p
->SetValue(variant
);
1161 if ( p
== m_pPropGrid
->GetSelection() &&
1162 this == m_pPropGrid
->GetState() )
1163 m_pPropGrid
->RefreshEditor();
1171 // -----------------------------------------------------------------------
1173 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1178 if ( p
== m_pPropGrid
->GetSelection() &&
1179 this == m_pPropGrid
->GetState() )
1180 m_pPropGrid
->RefreshEditor();
1187 // -----------------------------------------------------------------------
1189 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1193 // wnd_primary has to be given so the control can be updated as well.
1195 DoSetPropertyValue(p
, v
);
1201 // -----------------------------------------------------------------------
1202 // wxPropertyGridPageState property operations
1203 // -----------------------------------------------------------------------
1205 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1207 const wxArrayPGProperty
& selection
= m_selection
;
1209 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1211 if ( selection
[i
] == prop
)
1218 // -----------------------------------------------------------------------
1220 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1222 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1224 if ( m_selection
[i
] == prop
)
1226 wxPropertyGrid
* pg
= m_pPropGrid
;
1227 if ( i
== 0 && pg
->GetState() == this )
1229 // If first item (ie. one with the active editor) was
1230 // deselected, then we need to take some extra measures.
1231 wxArrayPGProperty sel
= m_selection
;
1232 sel
.erase( sel
.begin() + i
);
1234 wxPGProperty
* newFirst
;
1240 pg
->DoSelectProperty(newFirst
,
1241 wxPG_SEL_DONT_SEND_EVENT
);
1249 m_selection
.erase( m_selection
.begin() + i
);
1256 // -----------------------------------------------------------------------
1258 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1260 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1262 if ( !p
->GetChildCount() ) return false;
1264 if ( !p
->IsExpanded() ) return false;
1266 p
->SetExpanded(false);
1268 VirtualHeightChanged();
1273 // -----------------------------------------------------------------------
1275 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1277 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1279 if ( !p
->GetChildCount() ) return false;
1281 if ( p
->IsExpanded() ) return false;
1283 p
->SetExpanded(true);
1285 VirtualHeightChanged();
1290 // -----------------------------------------------------------------------
1292 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1294 if ( this == m_pPropGrid
->GetState() )
1295 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1301 // -----------------------------------------------------------------------
1303 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1306 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1308 p
->SetFlag( wxPG_PROP_HIDDEN
);
1310 if ( flags
& wxPG_RECURSE
)
1313 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1314 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1317 VirtualHeightChanged();
1322 // -----------------------------------------------------------------------
1324 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1330 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1335 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1339 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1344 p
->m_flags
|= wxPG_PROP_DISABLED
;
1348 // Apply same to sub-properties as well
1350 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1351 DoEnableProperty( p
->Item(i
), enable
);
1358 // -----------------------------------------------------------------------
1359 // wxPropertyGridPageState wxVariant related routines
1360 // -----------------------------------------------------------------------
1362 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1363 // Never includes sub-properties (unless they are parented by wxParentProperty).
1364 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1365 wxPGProperty
* baseparent
,
1368 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1370 // Root is the default base-parent.
1374 wxVariantList tempList
;
1375 wxVariant
v( tempList
, listname
);
1377 if ( pwc
->GetChildCount() )
1379 if ( flags
& wxPG_KEEP_STRUCTURE
)
1381 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1384 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1386 wxPGProperty
* p
= pwc
->Item(i
);
1387 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1389 wxVariant variant
= p
->GetValue();
1390 variant
.SetName( p
->GetBaseName() );
1391 v
.Append( variant
);
1395 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1397 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1398 v
.Append( p
->GetAttributesAsList() );
1403 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1404 it
.SetBaseParent( pwc
);
1406 for ( ; !it
.AtEnd(); it
.Next() )
1408 const wxPGProperty
* p
= it
.GetProperty();
1410 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1411 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1413 wxVariant variant
= p
->GetValue();
1414 variant
.SetName( p
->GetName() );
1415 v
.Append( variant
);
1416 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1417 v
.Append( p
->GetAttributesAsList() );
1426 // -----------------------------------------------------------------------
1428 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1430 unsigned char origFrozen
= 1;
1432 if ( m_pPropGrid
->GetState() == this )
1434 origFrozen
= m_pPropGrid
->m_frozen
;
1435 if ( !origFrozen
) m_pPropGrid
->Freeze();
1438 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1440 if ( !use_category
)
1441 use_category
= (wxPropertyCategory
*)m_properties
;
1443 // Let's iterate over the list of variants.
1444 wxVariantList::const_iterator node
;
1445 int numSpecialEntries
= 0;
1448 // Second pass for special entries
1449 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1451 wxVariant
*current
= (wxVariant
*)*node
;
1453 // Make sure it is wxVariant.
1454 wxASSERT( current
);
1455 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1457 const wxString
& name
= current
->GetName();
1458 if ( name
.length() > 0 )
1461 // '@' signified a special entry
1462 if ( name
[0] == wxS('@') )
1464 numSpecialEntries
++;
1468 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1471 wxPGProperty
* p
= foundProp
;
1473 // If it was a list, we still have to go through it.
1474 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1476 DoSetPropertyValues( current
->GetList(),
1477 p
->IsCategory()?p
:(NULL
)
1482 wxASSERT_LEVEL_2_MSG(
1483 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1485 wxS("setting value of property \"%s\" from variant"),
1486 p
->GetName().c_str())
1489 p
->SetValue(*current
);
1495 if ( current
->GetType() != wxS("list") )
1501 // Yes, it is; create a sub category and append contents there.
1502 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1503 DoSetPropertyValues( current
->GetList(), newCat
);
1510 if ( numSpecialEntries
)
1512 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1514 wxVariant
*current
= (wxVariant
*)*node
;
1516 const wxString
& name
= current
->GetName();
1517 if ( name
.length() > 0 )
1520 // '@' signified a special entry
1521 if ( name
[0] == wxS('@') )
1523 numSpecialEntries
--;
1525 size_t pos2
= name
.rfind(wxS('@'));
1526 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1528 wxString propName
= name
.substr(1, pos2
-1);
1529 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1531 if ( entryType
== wxS("attr") )
1534 // List of attributes
1535 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1538 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1540 wxVariantList
& list2
= current
->GetList();
1541 wxVariantList::const_iterator node2
;
1543 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1545 wxVariant
*attr
= (wxVariant
*)*node2
;
1546 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1551 // ERROR: No such property: 'propName'
1557 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1562 if ( !numSpecialEntries
)
1569 m_pPropGrid
->Thaw();
1571 if ( this == m_pPropGrid
->GetState() )
1572 m_pPropGrid
->RefreshEditor();
1577 // -----------------------------------------------------------------------
1578 // wxPropertyGridPageState property adding and removal
1579 // -----------------------------------------------------------------------
1581 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1582 wxPGProperty
* scheduledParent
)
1584 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1586 // This will allow better behavior.
1587 if ( scheduledParent
== m_properties
)
1588 scheduledParent
= NULL
;
1590 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1592 wxASSERT_MSG( property
->GetBaseName().length(),
1593 "Property's children must have unique, non-empty names within their scope" );
1596 property
->m_parentState
= this;
1598 if ( property
->IsCategory() )
1601 // Parent of a category must be either root or another category
1602 // (otherwise Bad Things might happen).
1603 wxASSERT_MSG( scheduledParent
== NULL
||
1604 scheduledParent
== m_properties
||
1605 scheduledParent
->IsCategory(),
1606 wxT("Parent of a category must be either root or another category."));
1608 // If we already have category with same name, delete given property
1609 // and use it instead as most recent caption item.
1610 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1613 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1614 if ( pwc
->IsCategory() ) // Must be a category.
1617 m_currentCategory
= pwc
;
1624 // Warn for identical names in debug mode.
1625 if ( BaseGetPropertyByName(property
->GetName()) &&
1626 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1628 wxFAIL_MSG(wxString::Format(
1629 "wxPropertyGrid item with name \"%s\" already exists",
1630 property
->GetName()));
1632 wxPGGlobalVars
->m_warnings
++;
1634 #endif // wxDEBUG_LEVEL
1636 // Make sure nothing is selected.
1638 propGrid
->ClearSelection(false);
1640 // NULL parent == root parent
1641 if ( !scheduledParent
)
1642 scheduledParent
= DoGetRoot();
1644 property
->m_parent
= scheduledParent
;
1646 property
->InitAfterAdded(this, propGrid
);
1648 if ( property
->IsCategory() )
1650 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1652 m_currentCategory
= pc
;
1654 // Calculate text extent for category caption
1656 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1662 // -----------------------------------------------------------------------
1664 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1666 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1667 if ( property
->IsCategory() )
1670 return DoInsert( cur_cat
, -1, property
);
1673 // -----------------------------------------------------------------------
1675 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1678 parent
= m_properties
;
1680 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1682 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1684 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1686 // PrepareToAddItem() may just decide to use use current category
1687 // instead of adding new one.
1689 return m_currentCategory
;
1691 bool parentIsRoot
= parent
->IsRoot();
1692 bool parentIsCategory
= parent
->IsCategory();
1694 // Note that item must be added into current mode later.
1696 // If parent is wxParentProperty, just stick it in...
1697 // If parent is root (m_properties), then...
1698 // In categoric mode: Add as last item in m_abcArray (if not category).
1699 // Add to given index in m_regularArray.
1700 // In non-cat mode: Add as last item in m_regularArray.
1701 // Add to given index in m_abcArray.
1702 // If parent is category, then...
1703 // 1) Add to given category in given index.
1704 // 2) Add as last item in m_abcArray.
1706 if ( m_properties
== &m_regularArray
)
1708 // We are currently in Categorized mode
1710 // Only add non-categories to m_abcArray.
1711 if ( m_abcArray
&& !property
->IsCategory() &&
1712 (parentIsCategory
|| parentIsRoot
) )
1714 m_abcArray
->DoAddChild( property
, -1, false );
1717 // Add to current mode.
1718 parent
->DoAddChild( property
, index
, true );
1722 // We are currently in Non-categorized/Alphabetic mode
1724 if ( parentIsCategory
)
1725 // Parent is category.
1726 parent
->DoAddChild( property
, index
, false );
1727 else if ( parentIsRoot
)
1729 m_regularArray
.DoAddChild( property
, -1, false );
1731 // Add to current mode
1732 if ( !property
->IsCategory() )
1733 m_abcArray
->DoAddChild( property
, index
, true );
1737 if ( property
->IsCategory() )
1739 // This is a category caption item.
1741 // Last caption is not the bottom one (this info required by append)
1742 m_lastCaptionBottomnest
= 0;
1745 // Only add name to hashmap if parent is root or category
1746 if ( property
->m_name
.length() &&
1747 (parentIsCategory
|| parentIsRoot
) )
1748 m_dictName
[property
->m_name
] = (void*) property
;
1750 VirtualHeightChanged();
1752 property
->UpdateParentValues();
1759 // -----------------------------------------------------------------------
1761 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1763 wxCHECK_RET( item
->GetParent(),
1764 wxT("this property was already deleted") );
1766 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1767 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1769 unsigned int indinparent
= item
->GetIndexInParent();
1771 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1772 wxPGProperty
* parent
= item
->GetParent();
1774 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1775 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1777 wxASSERT( item
->GetParentState() == this );
1779 wxPropertyGrid
* pg
= GetGrid();
1781 if ( DoIsPropertySelected(item
) )
1783 if ( pg
&& pg
->GetState() == this )
1785 pg
->DoRemoveFromSelection(item
,
1786 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1790 DoRemoveFromSelection(item
);
1794 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1797 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1799 // deleting a category
1800 if ( item
->IsCategory() )
1802 if ( pwc
== m_currentCategory
)
1803 m_currentCategory
= NULL
;
1806 item
->DeleteChildren();
1809 if ( !IsInNonCatMode() )
1811 // categorized mode - non-categorized array
1813 // Remove from non-cat array
1814 if ( !item
->IsCategory() &&
1815 (parent
->IsCategory() || parent
->IsRoot()) )
1818 m_abcArray
->RemoveChild(item
);
1821 // categorized mode - categorized array
1822 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1823 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1824 item
->m_parent
->FixIndicesOfChildren();
1828 // non-categorized mode - categorized array
1830 // We need to find location of item.
1831 wxPGProperty
* cat_parent
= &m_regularArray
;
1832 int cat_index
= m_regularArray
.GetChildCount();
1834 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1836 wxPGProperty
* p
= m_regularArray
.Item(i
);
1837 if ( p
== item
) { cat_index
= i
; break; }
1838 if ( p
->IsCategory() )
1840 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1841 if ( subind
!= wxNOT_FOUND
)
1843 cat_parent
= ((wxPGProperty
*)p
);
1849 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1851 // non-categorized mode - non-categorized array
1852 if ( !item
->IsCategory() )
1854 wxASSERT( item
->m_parent
== m_abcArray
);
1855 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1856 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1857 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1861 if ( item
->GetBaseName().length() &&
1862 (parent
->IsCategory() || parent
->IsRoot()) )
1863 m_dictName
.erase(item
->GetBaseName());
1865 // We need to clear parent grid's m_propHover, if it matches item
1866 if ( pg
&& pg
->m_propHover
== item
)
1867 pg
->m_propHover
= NULL
;
1869 // We can actually delete it now
1873 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1875 VirtualHeightChanged();
1878 // -----------------------------------------------------------------------
1880 #endif // wxUSE_PROPGRID