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 // By default, we only have the 'value' column editable
222 m_editableColumns
.push_back(1);
225 // -----------------------------------------------------------------------
227 wxPropertyGridPageState::~wxPropertyGridPageState()
232 // -----------------------------------------------------------------------
234 void wxPropertyGridPageState::InitNonCatMode()
238 m_abcArray
= new wxPGRootProperty(wxS("<Root_NonCat>"));
239 m_abcArray
->SetParentState(this);
240 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
243 // Must be called when state::m_properties still points to regularArray.
244 wxPGProperty
* oldProperties
= m_properties
;
246 // Must use temp value in state::m_properties for item iteration loop
247 // to run as expected.
248 m_properties
= &m_regularArray
;
250 if ( m_properties
->GetChildCount() )
253 // Prepare m_abcArray
254 wxPropertyGridIterator
it( this, wxPG_ITERATE_PROPERTIES
);
256 for ( ; !it
.AtEnd(); it
.Next() )
258 wxPGProperty
* p
= it
.GetProperty();
259 wxPGProperty
* parent
= p
->GetParent();
260 if ( parent
->IsCategory() || parent
->IsRoot() )
262 m_abcArray
->DoAddChild(p
);
263 p
->m_parent
= &m_regularArray
;
268 m_properties
= oldProperties
;
271 // -----------------------------------------------------------------------
273 void wxPropertyGridPageState::DoClear()
275 if ( m_pPropGrid
&& m_pPropGrid
->GetState() == this )
277 m_pPropGrid
->ClearSelection(false);
284 m_regularArray
.Empty();
290 m_currentCategory
= NULL
;
291 m_lastCaptionBottomnest
= 1;
298 // -----------------------------------------------------------------------
300 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
302 wxPropertyGrid
* propGrid
= GetGrid();
304 VirtualHeightChanged();
306 // Recalculate caption text extents.
309 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
311 wxPGProperty
* p
=m_regularArray
.Item(i
);
313 if ( p
->IsCategory() )
314 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
318 // -----------------------------------------------------------------------
320 void wxPropertyGridPageState::SetVirtualWidth( int width
)
322 wxASSERT( width
>= 0 );
323 wxPropertyGrid
* pg
= GetGrid();
324 int gw
= pg
->GetClientSize().x
;
331 // -----------------------------------------------------------------------
333 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
335 wxPropertyGrid
* pg
= GetGrid();
337 if ( pg
->HasVirtualWidth() )
339 if ( m_width
< newWidth
)
340 SetVirtualWidth( newWidth
);
342 CheckColumnWidths(widthChange
);
346 SetVirtualWidth( newWidth
);
348 // This should be done before splitter auto centering
349 // NOTE: Splitter auto-centering is done in this function.
352 CheckColumnWidths(widthChange
);
354 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
355 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
357 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
359 // If too long, don't set splitter
360 if ( timeSinceCreation
< 250 )
362 if ( m_properties
->GetChildCount() )
364 SetSplitterLeft( false );
368 DoSetSplitterPosition( newWidth
/ 2 );
369 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
376 // -----------------------------------------------------------------------
377 // wxPropertyGridPageState item iteration methods
378 // -----------------------------------------------------------------------
380 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
382 if ( !m_properties
->GetChildCount() )
385 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
387 // First, get last child of last parent
388 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
389 while ( pwc
->GetChildCount() &&
390 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
391 pwc
= (wxPGProperty
*) pwc
->Last();
393 // Then, if it doesn't fit our criteria, back up until we find something that does
394 if ( pwc
->GetFlags() & itemExMask
)
396 wxPropertyGridIterator
it( this, flags
, pwc
);
397 for ( ; !it
.AtEnd(); it
.Prev() )
399 pwc
= (wxPGProperty
*) it
.GetProperty();
405 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
407 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
408 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
411 parent
= grandparent
;
412 grandparent
= (wxPGProperty
*)parent
->GetParent();
413 if ( parent
->IsCategory() && grandparent
)
414 return (wxPropertyCategory
*)parent
;
415 } while ( grandparent
);
420 // -----------------------------------------------------------------------
421 // wxPropertyGridPageState GetPropertyXXX methods
422 // -----------------------------------------------------------------------
424 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
425 wxPGProperty
* parent
) const
430 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
432 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
434 wxPGProperty
* p
= parent
->Item(i
);
435 if ( p
->m_label
== label
)
437 // Check children recursively.
438 if ( p
->GetChildCount() )
440 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
449 // -----------------------------------------------------------------------
451 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
453 wxPGHashMapS2P::const_iterator it
;
454 it
= m_dictName
.find(name
);
455 if ( it
!= m_dictName
.end() )
456 return (wxPGProperty
*) it
->second
;
460 // -----------------------------------------------------------------------
462 void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty
* p
,
463 const wxString
& newName
)
465 wxCHECK_RET( p
, wxT("invalid property id") );
467 wxPGProperty
* parent
= p
->GetParent();
469 if ( parent
->IsCategory() || parent
->IsRoot() )
471 if ( p
->GetBaseName().length() )
472 m_dictName
.erase( p
->GetBaseName() );
473 if ( newName
.length() )
474 m_dictName
[newName
] = (void*) p
;
477 p
->DoSetName(newName
);
480 // -----------------------------------------------------------------------
481 // wxPropertyGridPageState global operations
482 // -----------------------------------------------------------------------
484 // -----------------------------------------------------------------------
485 // Item iteration macros
486 // NB: Nowadays only needed for alphabetic/categoric mode switching.
487 // -----------------------------------------------------------------------
489 //#define II_INVALID_I 0x00FFFFFF
491 #define ITEM_ITERATION_VARIABLES \
492 wxPGProperty* parent; \
496 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
497 parent = m_properties; \
501 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
502 parent = startparent; \
503 i = (unsigned int)startindex; \
504 if ( parent == NULL ) \
506 parent = state->m_properties; \
511 #define ITEM_ITERATION_LOOP_BEGIN \
514 iMax = parent->GetChildCount(); \
517 wxPGProperty* p = parent->Item(i);
519 #define ITEM_ITERATION_LOOP_END \
520 if ( p->GetChildCount() ) \
523 parent = (wxPGProperty*)p; \
524 iMax = parent->GetChildCount(); \
529 i = parent->m_arrIndex + 1; \
530 parent = parent->m_parent; \
532 while ( parent != NULL );
534 bool wxPropertyGridPageState::EnableCategories( bool enable
)
537 // NB: We can't use wxPropertyGridIterator in this
538 // function, since it depends on m_arrIndexes,
539 // which, among other things, is being fixed here.
541 ITEM_ITERATION_VARIABLES
549 if ( !IsInNonCatMode() )
552 m_properties
= &m_regularArray
;
554 // fix parents, indexes, and depths
555 ITEM_ITERATION_INIT_FROM_THE_TOP
557 ITEM_ITERATION_LOOP_BEGIN
561 p
->m_parent
= parent
;
563 // If parent was category, and this is not,
564 // then the depth stays the same.
565 if ( parent
->IsCategory() &&
567 p
->m_depth
= parent
->m_depth
;
569 p
->m_depth
= parent
->m_depth
+ 1;
571 ITEM_ITERATION_LOOP_END
577 // Disable categories
580 if ( IsInNonCatMode() )
583 // Create array, if necessary.
587 m_properties
= m_abcArray
;
589 // fix parents, indexes, and depths
590 ITEM_ITERATION_INIT_FROM_THE_TOP
592 ITEM_ITERATION_LOOP_BEGIN
596 p
->m_parent
= parent
;
598 p
->m_depth
= parent
->m_depth
+ 1;
600 ITEM_ITERATION_LOOP_END
603 VirtualHeightChanged();
605 if ( m_pPropGrid
->GetState() == this )
606 m_pPropGrid
->RecalculateVirtualSize();
611 // -----------------------------------------------------------------------
613 static int wxPG_SortFunc_ByFunction(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
615 wxPGProperty
*p1
= *pp1
;
616 wxPGProperty
*p2
= *pp2
;
617 wxPropertyGrid
* pg
= p1
->GetGrid();
618 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
619 return sortFunction(pg
, p1
, p2
);
622 static int wxPG_SortFunc_ByLabel(wxPGProperty
**pp1
, wxPGProperty
**pp2
)
624 wxPGProperty
*p1
= *pp1
;
625 wxPGProperty
*p2
= *pp2
;
626 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() );
631 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
636 static bool wxPG_SortFunc_ByFunction(wxPGProperty
*p1
, wxPGProperty
*p2
)
638 wxPropertyGrid
* pg
= p1
->GetGrid();
639 wxPGSortCallback sortFunction
= pg
->GetSortFunction();
640 return sortFunction(pg
, p1
, p2
) < 0;
643 static bool wxPG_SortFunc_ByLabel(wxPGProperty
*p1
, wxPGProperty
*p2
)
645 return p1
->GetLabel().CmpNoCase( p2
->GetLabel() ) < 0;
649 void wxPropertyGridPageState::DoSortChildren( wxPGProperty
* p
,
655 // Can only sort items with children
656 if ( !p
->GetChildCount() )
659 // Never sort children of aggregate properties
660 if ( p
->HasFlag(wxPG_PROP_AGGREGATE
) )
663 if ( (flags
& wxPG_SORT_TOP_LEVEL_ONLY
)
664 && !p
->IsCategory() && !p
->IsRoot() )
667 if ( GetGrid()->GetSortFunction() )
668 p
->m_children
.Sort( wxPG_SortFunc_ByFunction
);
670 p
->m_children
.Sort( wxPG_SortFunc_ByLabel
);
674 // For wxVector w/ wxUSE_STL=1, you would use code like this instead:
676 if ( GetGrid()->GetSortFunction() )
677 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
678 wxPG_SortFunc_ByFunction
);
680 std::sort(p
->m_children
.begin(), p
->m_children
.end(),
681 wxPG_SortFunc_ByLabel
);
685 p
->FixIndicesOfChildren();
687 if ( flags
& wxPG_RECURSE
)
689 // Apply sort recursively
690 for ( unsigned int i
=0; i
<p
->GetChildCount(); i
++ )
691 DoSortChildren(p
->Item(i
), flags
);
695 // -----------------------------------------------------------------------
697 void wxPropertyGridPageState::DoSort( int flags
)
699 DoSortChildren( m_properties
, flags
| wxPG_RECURSE
);
701 // We used to sort categories as well here also if in non-categorized
702 // mode, but doing would naturally cause child indices to become
706 // -----------------------------------------------------------------------
708 bool wxPropertyGridPageState::PrepareAfterItemsAdded()
710 if ( !m_itemsAdded
) return false;
712 wxPropertyGrid
* pg
= GetGrid();
716 if ( pg
->HasFlag(wxPG_AUTO_SORT
) )
717 DoSort(wxPG_SORT_TOP_LEVEL_ONLY
);
722 // -----------------------------------------------------------------------
723 // wxPropertyGridPageState splitter, column and hittest functions
724 // -----------------------------------------------------------------------
726 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
733 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
736 // -----------------------------------------------------------------------
738 wxPropertyGridHitTestResult
739 wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
741 wxPropertyGridHitTestResult result
;
742 result
.m_column
= HitTestH( pt
.x
, &result
.m_splitter
,
743 &result
.m_splitterHitOffset
);
744 result
.m_property
= DoGetItemAtY( pt
.y
);
748 // -----------------------------------------------------------------------
750 // Used by SetSplitterLeft() and DotFitColumns()
751 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
756 wxPropertyGrid
* pg
= m_pPropGrid
;
761 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
763 wxPGProperty
* p
= pwc
->Item(i
);
764 if ( !p
->IsCategory() )
766 const wxPGCell
* cell
= NULL
;
768 p
->GetDisplayInfo(col
, -1, 0, &text
, &cell
);
769 dc
.GetTextExtent(text
, &w
, &h
);
771 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
773 // account for the bitmap
775 w
+= p
->GetImageOffset(pg
->GetImageRect(p
, -1).GetWidth());
778 w
+= (wxPG_XBEFORETEXT
*2);
784 if ( p
->GetChildCount() &&
785 ( subProps
|| p
->IsCategory() ) )
787 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
797 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
799 int n
= GetGrid()->m_marginWidth
;
801 for ( i
=0; i
<=splitterColumn
; i
++ )
806 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
808 return wxPG_DRAG_MARGIN
;
811 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
813 int origWidth
= m_colWidths
[column
];
814 m_colWidths
[column
] -= decrease
;
815 int min
= GetColumnMinWidth(column
);
817 if ( m_colWidths
[column
] < min
)
819 more
= decrease
- (origWidth
- min
);
820 m_colWidths
[column
] = min
;
824 // FIXME: Causes erratic splitter changing, so as a workaround
825 // disabled if two or less columns.
827 if ( m_colWidths
.size() <= 2 )
831 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
832 PropagateColSizeDec( column
, more
, dir
);
835 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
837 wxPropertyGrid
* pg
= GetGrid();
839 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
841 if ( !pg
->HasVirtualWidth() )
847 otherColumn
= splitterColumn
+ 1;
848 if ( otherColumn
== (int)m_colWidths
.size() )
850 m_colWidths
[splitterColumn
] += adjust
;
851 PropagateColSizeDec( otherColumn
, adjust
, 1 );
855 otherColumn
= splitterColumn
+ 1;
856 if ( otherColumn
== (int)m_colWidths
.size() )
858 m_colWidths
[otherColumn
] -= adjust
;
859 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
864 m_colWidths
[splitterColumn
] += adjust
;
867 if ( splitterColumn
== 0 )
868 m_fSplitterX
= (double) newXPos
;
870 if ( !fromAutoCenter
)
872 // Don't allow initial splitter auto-positioning after this.
873 if ( pg
->GetState() == this )
874 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
880 // Moves splitter so that all labels are visible, but just.
881 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
883 wxPropertyGrid
* pg
= GetGrid();
885 dc
.SetFont(pg
->GetFont());
887 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
891 maxW
+= pg
->m_marginWidth
;
892 DoSetSplitterPosition( maxW
);
895 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
898 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
900 wxPropertyGrid
* pg
= GetGrid();
902 dc
.SetFont(pg
->GetFont());
904 int marginWidth
= pg
->m_marginWidth
;
905 int accWid
= marginWidth
;
906 int maxColWidth
= 500;
908 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
910 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
911 int colMinWidth
= GetColumnMinWidth(col
);
912 if ( fitWid
< colMinWidth
)
913 fitWid
= colMinWidth
;
914 else if ( fitWid
> maxColWidth
)
915 fitWid
= maxColWidth
;
917 m_colWidths
[col
] = fitWid
;
922 // Expand last one to fill the width
923 int remaining
= m_width
- accWid
;
924 m_colWidths
[GetColumnCount()-1] += remaining
;
926 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
928 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
929 m_fSplitterX
= (double) firstSplitterX
;
931 // Don't allow initial splitter auto-positioning after this.
932 if ( pg
->GetState() == this )
934 pg
->SetSplitterPosition(firstSplitterX
, false);
939 pg
->GetVirtualSize(&x
, &y
);
941 return wxSize(accWid
, y
);
944 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
949 wxPropertyGrid
* pg
= GetGrid();
952 unsigned int lastColumn
= m_colWidths
.size() - 1;
954 int clientWidth
= pg
->GetClientSize().x
;
957 // Column to reduce, if needed. Take last one that exceeds minimum width.
960 wxLogTrace("propgrid",
961 wxS("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"),
966 for ( i
=0; i
<m_colWidths
.size(); i
++ )
968 int min
= GetColumnMinWidth(i
);
969 if ( m_colWidths
[i
] <= min
)
971 m_colWidths
[i
] = min
;
975 // Always reduce the last column that is larger than minimum size
976 // (looks nicer, even with auto-centering enabled).
981 int colsWidth
= pg
->m_marginWidth
;
982 for ( i
=0; i
<m_colWidths
.size(); i
++ )
983 colsWidth
+= m_colWidths
[i
];
985 wxLogTrace("propgrid",
986 wxS(" HasVirtualWidth: %i colsWidth: %i"),
987 (int)pg
->HasVirtualWidth(), colsWidth
);
989 // Then mode-based requirement
990 if ( !pg
->HasVirtualWidth() )
992 int widthHigher
= width
- colsWidth
;
994 // Adapt colsWidth to width
995 if ( colsWidth
< width
)
998 wxLogTrace("propgrid",
999 wxS(" Adjust last column to %i"),
1000 m_colWidths
[lastColumn
] + widthHigher
);
1001 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
1003 else if ( colsWidth
> width
)
1006 if ( reduceCol
!= -1 )
1008 wxLogTrace("propgrid",
1009 wxT(" Reduce column %i (by %i)"),
1010 reduceCol
, -widthHigher
);
1012 // Reduce widest column, and recheck
1013 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
1014 CheckColumnWidths();
1020 // Only check colsWidth against clientWidth
1021 if ( colsWidth
< clientWidth
)
1023 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
1026 m_width
= colsWidth
;
1028 // If width changed, recalculate virtual size
1029 if ( pg
->GetState() == this )
1030 pg
->RecalculateVirtualSize();
1033 for ( i
=0; i
<m_colWidths
.size(); i
++ )
1035 wxLogTrace("propgrid", wxS("col%i: %i"), i
, m_colWidths
[i
]);
1038 // Auto center splitter
1039 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
1040 m_colWidths
.size() == 2 )
1042 float centerX
= (float)(pg
->m_width
/2);
1045 if ( m_fSplitterX
< 0.0 )
1047 splitterX
= centerX
;
1049 else if ( widthChange
)
1051 //float centerX = float(pg->GetSize().x) * 0.5;
1054 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
1055 float deviation
= fabs(centerX
- splitterX
);
1057 // If deviating from center, adjust towards it
1058 if ( deviation
> 20.0 )
1060 if ( splitterX
> centerX
)
1068 // No width change, just keep sure we keep splitter position intact
1069 splitterX
= m_fSplitterX
;
1070 float deviation
= fabs(centerX
- splitterX
);
1071 if ( deviation
> 50.0 )
1073 splitterX
= centerX
;
1077 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1079 m_fSplitterX
= splitterX
; // needed to retain accuracy
1083 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1085 wxASSERT( colCount
>= 2 );
1086 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1087 if ( m_colWidths
.size() > (unsigned int)colCount
)
1088 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1090 if ( m_pPropGrid
->GetState() == this )
1091 m_pPropGrid
->RecalculateVirtualSize();
1093 CheckColumnWidths();
1096 // Returns column index, -1 for margin
1097 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1099 int cx
= GetGrid()->m_marginWidth
;
1101 int prevSplitter
= -1;
1106 if ( col
>= (int)m_colWidths
.size() )
1112 cx
+= m_colWidths
[col
];
1115 // Near prev. splitter
1118 int diff
= x
- prevSplitter
;
1119 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1121 *pSplitterHit
= col
- 1;
1122 *pSplitterHitOffset
= diff
;
1127 // Near next splitter
1128 int nextSplitter
= cx
;
1129 if ( col
< (int)(m_colWidths
.size()-1) )
1131 int diff
= x
- nextSplitter
;
1132 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1134 *pSplitterHit
= col
;
1135 *pSplitterHitOffset
= diff
;
1144 bool wxPropertyGridPageState::ArePropertiesAdjacent( wxPGProperty
* prop1
,
1145 wxPGProperty
* prop2
,
1146 int iterFlags
) const
1148 const wxPGProperty
* ap1
=
1149 wxPropertyGridConstIterator::OneStep(this,
1153 if ( ap1
&& ap1
== prop2
)
1156 const wxPGProperty
* ap2
=
1157 wxPropertyGridConstIterator::OneStep(this,
1161 if ( ap2
&& ap2
== prop2
)
1167 // -----------------------------------------------------------------------
1168 // wxPropertyGridPageState property value setting and getting
1169 // -----------------------------------------------------------------------
1171 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1175 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
|wxPG_PROGRAMMATIC_VALUE
;
1177 wxVariant variant
= p
->GetValueRef();
1180 if ( p
->GetMaxLength() <= 0 )
1181 res
= p
->StringToValue( variant
, value
, flags
);
1183 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1187 p
->SetValue(variant
);
1188 if ( p
== m_pPropGrid
->GetSelection() &&
1189 this == m_pPropGrid
->GetState() )
1190 m_pPropGrid
->RefreshEditor();
1198 // -----------------------------------------------------------------------
1200 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1205 if ( p
== m_pPropGrid
->GetSelection() &&
1206 this == m_pPropGrid
->GetState() )
1207 m_pPropGrid
->RefreshEditor();
1214 // -----------------------------------------------------------------------
1216 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1220 // wnd_primary has to be given so the control can be updated as well.
1222 DoSetPropertyValue(p
, v
);
1228 // -----------------------------------------------------------------------
1229 // wxPropertyGridPageState property operations
1230 // -----------------------------------------------------------------------
1232 bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty
* prop
) const
1234 const wxArrayPGProperty
& selection
= m_selection
;
1236 for ( unsigned int i
=0; i
<selection
.size(); i
++ )
1238 if ( selection
[i
] == prop
)
1245 // -----------------------------------------------------------------------
1247 void wxPropertyGridPageState::DoRemoveFromSelection( wxPGProperty
* prop
)
1249 for ( unsigned int i
=0; i
<m_selection
.size(); i
++ )
1251 if ( m_selection
[i
] == prop
)
1253 wxPropertyGrid
* pg
= m_pPropGrid
;
1254 if ( i
== 0 && pg
->GetState() == this )
1256 // If first item (ie. one with the active editor) was
1257 // deselected, then we need to take some extra measures.
1258 wxArrayPGProperty sel
= m_selection
;
1259 sel
.erase( sel
.begin() + i
);
1261 wxPGProperty
* newFirst
;
1267 pg
->DoSelectProperty(newFirst
,
1268 wxPG_SEL_DONT_SEND_EVENT
);
1276 m_selection
.erase( m_selection
.begin() + i
);
1283 // -----------------------------------------------------------------------
1285 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1287 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1289 if ( !p
->GetChildCount() ) return false;
1291 if ( !p
->IsExpanded() ) return false;
1293 p
->SetExpanded(false);
1295 VirtualHeightChanged();
1300 // -----------------------------------------------------------------------
1302 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1304 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1306 if ( !p
->GetChildCount() ) return false;
1308 if ( p
->IsExpanded() ) return false;
1310 p
->SetExpanded(true);
1312 VirtualHeightChanged();
1317 // -----------------------------------------------------------------------
1319 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1321 if ( this == m_pPropGrid
->GetState() )
1322 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1328 // -----------------------------------------------------------------------
1330 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1333 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1335 p
->SetFlag( wxPG_PROP_HIDDEN
);
1337 if ( flags
& wxPG_RECURSE
)
1340 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1341 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1344 VirtualHeightChanged();
1349 // -----------------------------------------------------------------------
1351 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1357 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1362 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1366 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1371 p
->m_flags
|= wxPG_PROP_DISABLED
;
1375 // Apply same to sub-properties as well
1377 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1378 DoEnableProperty( p
->Item(i
), enable
);
1385 // -----------------------------------------------------------------------
1386 // wxPropertyGridPageState wxVariant related routines
1387 // -----------------------------------------------------------------------
1389 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1390 // Never includes sub-properties (unless they are parented by wxParentProperty).
1391 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1392 wxPGProperty
* baseparent
,
1395 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1397 // Root is the default base-parent.
1401 wxVariantList tempList
;
1402 wxVariant
v( tempList
, listname
);
1404 if ( pwc
->GetChildCount() )
1406 if ( flags
& wxPG_KEEP_STRUCTURE
)
1408 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1411 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1413 wxPGProperty
* p
= pwc
->Item(i
);
1414 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1416 wxVariant variant
= p
->GetValue();
1417 variant
.SetName( p
->GetBaseName() );
1418 v
.Append( variant
);
1422 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1424 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1425 v
.Append( p
->GetAttributesAsList() );
1430 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1431 it
.SetBaseParent( pwc
);
1433 for ( ; !it
.AtEnd(); it
.Next() )
1435 const wxPGProperty
* p
= it
.GetProperty();
1437 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1438 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1440 wxVariant variant
= p
->GetValue();
1441 variant
.SetName( p
->GetName() );
1442 v
.Append( variant
);
1443 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1444 v
.Append( p
->GetAttributesAsList() );
1453 // -----------------------------------------------------------------------
1455 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1457 unsigned char origFrozen
= 1;
1459 if ( m_pPropGrid
->GetState() == this )
1461 origFrozen
= m_pPropGrid
->m_frozen
;
1462 if ( !origFrozen
) m_pPropGrid
->Freeze();
1465 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1467 if ( !use_category
)
1468 use_category
= (wxPropertyCategory
*)m_properties
;
1470 // Let's iterate over the list of variants.
1471 wxVariantList::const_iterator node
;
1472 int numSpecialEntries
= 0;
1475 // Second pass for special entries
1476 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1478 wxVariant
*current
= (wxVariant
*)*node
;
1480 // Make sure it is wxVariant.
1481 wxASSERT( current
);
1482 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1484 const wxString
& name
= current
->GetName();
1485 if ( name
.length() > 0 )
1488 // '@' signified a special entry
1489 if ( name
[0] == wxS('@') )
1491 numSpecialEntries
++;
1495 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1498 wxPGProperty
* p
= foundProp
;
1500 // If it was a list, we still have to go through it.
1501 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1503 DoSetPropertyValues( current
->GetList(),
1504 p
->IsCategory()?p
:(NULL
)
1509 wxASSERT_LEVEL_2_MSG(
1510 wxStrcmp(current
->GetType(), p
->GetValue().GetType()) == 0,
1512 wxS("setting value of property \"%s\" from variant"),
1513 p
->GetName().c_str())
1516 p
->SetValue(*current
);
1522 if ( current
->GetType() != wxS("list") )
1528 // Yes, it is; create a sub category and append contents there.
1529 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1530 DoSetPropertyValues( current
->GetList(), newCat
);
1537 if ( numSpecialEntries
)
1539 for ( node
= list
.begin(); node
!= list
.end(); ++node
)
1541 wxVariant
*current
= (wxVariant
*)*node
;
1543 const wxString
& name
= current
->GetName();
1544 if ( name
.length() > 0 )
1547 // '@' signified a special entry
1548 if ( name
[0] == wxS('@') )
1550 numSpecialEntries
--;
1552 size_t pos2
= name
.rfind(wxS('@'));
1553 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1555 wxString propName
= name
.substr(1, pos2
-1);
1556 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1558 if ( entryType
== wxS("attr") )
1561 // List of attributes
1562 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1565 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1567 wxVariantList
& list2
= current
->GetList();
1568 wxVariantList::const_iterator node2
;
1570 for ( node2
= list2
.begin(); node2
!= list2
.end(); ++node2
)
1572 wxVariant
*attr
= (wxVariant
*)*node2
;
1573 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1578 // ERROR: No such property: 'propName'
1584 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1589 if ( !numSpecialEntries
)
1596 m_pPropGrid
->Thaw();
1598 if ( this == m_pPropGrid
->GetState() )
1599 m_pPropGrid
->RefreshEditor();
1604 // -----------------------------------------------------------------------
1605 // wxPropertyGridPageState property adding and removal
1606 // -----------------------------------------------------------------------
1608 bool wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1609 wxPGProperty
* scheduledParent
)
1611 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1613 // This will allow better behavior.
1614 if ( scheduledParent
== m_properties
)
1615 scheduledParent
= NULL
;
1617 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1619 wxASSERT_MSG( property
->GetBaseName().length(),
1620 "Property's children must have unique, non-empty names within their scope" );
1623 property
->m_parentState
= this;
1625 if ( property
->IsCategory() )
1628 // Parent of a category must be either root or another category
1629 // (otherwise Bad Things might happen).
1630 wxASSERT_MSG( scheduledParent
== NULL
||
1631 scheduledParent
== m_properties
||
1632 scheduledParent
->IsCategory(),
1633 wxT("Parent of a category must be either root or another category."));
1635 // If we already have category with same name, delete given property
1636 // and use it instead as most recent caption item.
1637 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1640 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1641 if ( pwc
->IsCategory() ) // Must be a category.
1644 m_currentCategory
= pwc
;
1651 // Warn for identical names in debug mode.
1652 if ( BaseGetPropertyByName(property
->GetName()) &&
1653 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1655 wxFAIL_MSG(wxString::Format(
1656 "wxPropertyGrid item with name \"%s\" already exists",
1657 property
->GetName()));
1659 wxPGGlobalVars
->m_warnings
++;
1661 #endif // wxDEBUG_LEVEL
1663 // Make sure nothing is selected.
1665 propGrid
->ClearSelection(false);
1667 // NULL parent == root parent
1668 if ( !scheduledParent
)
1669 scheduledParent
= DoGetRoot();
1671 property
->m_parent
= scheduledParent
;
1673 property
->InitAfterAdded(this, propGrid
);
1675 if ( property
->IsCategory() )
1677 wxPropertyCategory
* pc
= wxStaticCast(property
, wxPropertyCategory
);
1679 m_currentCategory
= pc
;
1681 // Calculate text extent for category caption
1683 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1689 // -----------------------------------------------------------------------
1691 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1693 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1694 if ( property
->IsCategory() )
1697 return DoInsert( cur_cat
, -1, property
);
1700 // -----------------------------------------------------------------------
1702 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1705 parent
= m_properties
;
1707 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1709 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1711 bool res
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1713 // PrepareToAddItem() may just decide to use use current category
1714 // instead of adding new one.
1716 return m_currentCategory
;
1718 bool parentIsRoot
= parent
->IsRoot();
1719 bool parentIsCategory
= parent
->IsCategory();
1721 // Note that item must be added into current mode later.
1723 // If parent is wxParentProperty, just stick it in...
1724 // If parent is root (m_properties), then...
1725 // In categoric mode: Add as last item in m_abcArray (if not category).
1726 // Add to given index in m_regularArray.
1727 // In non-cat mode: Add as last item in m_regularArray.
1728 // Add to given index in m_abcArray.
1729 // If parent is category, then...
1730 // 1) Add to given category in given index.
1731 // 2) Add as last item in m_abcArray.
1733 if ( m_properties
== &m_regularArray
)
1735 // We are currently in Categorized mode
1737 // Only add non-categories to m_abcArray.
1738 if ( m_abcArray
&& !property
->IsCategory() &&
1739 (parentIsCategory
|| parentIsRoot
) )
1741 m_abcArray
->DoAddChild( property
, -1, false );
1744 // Add to current mode.
1745 parent
->DoAddChild( property
, index
, true );
1749 // We are currently in Non-categorized/Alphabetic mode
1751 if ( parentIsCategory
)
1752 // Parent is category.
1753 parent
->DoAddChild( property
, index
, false );
1754 else if ( parentIsRoot
)
1756 m_regularArray
.DoAddChild( property
, -1, false );
1758 // Add to current mode
1759 if ( !property
->IsCategory() )
1760 m_abcArray
->DoAddChild( property
, index
, true );
1764 if ( property
->IsCategory() )
1766 // This is a category caption item.
1768 // Last caption is not the bottom one (this info required by append)
1769 m_lastCaptionBottomnest
= 0;
1772 // Only add name to hashmap if parent is root or category
1773 if ( property
->m_name
.length() &&
1774 (parentIsCategory
|| parentIsRoot
) )
1775 m_dictName
[property
->m_name
] = (void*) property
;
1777 VirtualHeightChanged();
1779 property
->UpdateParentValues();
1786 // -----------------------------------------------------------------------
1788 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
, bool doDelete
)
1790 wxCHECK_RET( item
->GetParent(),
1791 wxT("this property was already deleted") );
1793 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1794 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1796 unsigned int indinparent
= item
->GetIndexInParent();
1798 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1799 wxPGProperty
* parent
= item
->GetParent();
1801 wxCHECK_RET( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1802 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1804 wxASSERT( item
->GetParentState() == this );
1806 wxPropertyGrid
* pg
= GetGrid();
1808 if ( DoIsPropertySelected(item
) )
1810 if ( pg
&& pg
->GetState() == this )
1812 pg
->DoRemoveFromSelection(item
,
1813 wxPG_SEL_DELETING
|wxPG_SEL_NOVALIDATE
);
1817 DoRemoveFromSelection(item
);
1821 item
->SetFlag(wxPG_PROP_BEING_DELETED
);
1824 if ( item
->GetChildCount() && !item
->HasFlag(wxPG_PROP_AGGREGATE
) )
1826 // deleting a category
1827 if ( item
->IsCategory() )
1829 if ( pwc
== m_currentCategory
)
1830 m_currentCategory
= NULL
;
1833 item
->DeleteChildren();
1836 if ( !IsInNonCatMode() )
1838 // categorized mode - non-categorized array
1840 // Remove from non-cat array
1841 if ( !item
->IsCategory() &&
1842 (parent
->IsCategory() || parent
->IsRoot()) )
1845 m_abcArray
->RemoveChild(item
);
1848 // categorized mode - categorized array
1849 wxArrayPGProperty
& parentsChildren
= parent
->m_children
;
1850 parentsChildren
.erase( parentsChildren
.begin() + indinparent
);
1851 item
->m_parent
->FixIndicesOfChildren();
1855 // non-categorized mode - categorized array
1857 // We need to find location of item.
1858 wxPGProperty
* cat_parent
= &m_regularArray
;
1859 int cat_index
= m_regularArray
.GetChildCount();
1861 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1863 wxPGProperty
* p
= m_regularArray
.Item(i
);
1864 if ( p
== item
) { cat_index
= i
; break; }
1865 if ( p
->IsCategory() )
1867 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1868 if ( subind
!= wxNOT_FOUND
)
1870 cat_parent
= ((wxPGProperty
*)p
);
1876 cat_parent
->m_children
.erase(cat_parent
->m_children
.begin()+cat_index
);
1878 // non-categorized mode - non-categorized array
1879 if ( !item
->IsCategory() )
1881 wxASSERT( item
->m_parent
== m_abcArray
);
1882 wxArrayPGProperty
& parentsChildren
= item
->m_parent
->m_children
;
1883 parentsChildren
.erase(parentsChildren
.begin() + indinparent
);
1884 item
->m_parent
->FixIndicesOfChildren(indinparent
);
1888 if ( item
->GetBaseName().length() &&
1889 (parent
->IsCategory() || parent
->IsRoot()) )
1890 m_dictName
.erase(item
->GetBaseName());
1892 // We need to clear parent grid's m_propHover, if it matches item
1893 if ( pg
&& pg
->m_propHover
== item
)
1894 pg
->m_propHover
= NULL
;
1896 // We can actually delete it now
1900 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1902 VirtualHeightChanged();
1905 // -----------------------------------------------------------------------
1907 #endif // wxUSE_PROPGRID