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
;
79 if ( startPos
== wxTOP
)
85 else if ( startPos
== wxBOTTOM
)
87 property
= state
->GetLastItem(flags
);
93 wxASSERT_MSG( false, wxT("Only supported stating positions are wxTOP and wxBOTTOM") );
97 Init( state
, flags
, property
, dir
);
100 void wxPropertyGridIteratorBase::Assign( const wxPropertyGridIteratorBase
& it
)
102 m_property
= it
.m_property
;
103 m_state
= it
.m_state
;
104 m_baseParent
= it
.m_baseParent
;
105 m_itemExMask
= it
.m_itemExMask
;
106 m_parentExMask
= it
.m_parentExMask
;
109 void wxPropertyGridIteratorBase::Prev()
111 wxPGProperty
* property
= m_property
;
112 wxASSERT( property
);
114 wxPGProperty
* parent
= property
->GetParent();
116 unsigned int index
= property
->GetIndexInParent();
123 property
= parent
->Item(index
);
125 // Go to last children?
126 if ( property
->GetChildCount() &&
127 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) )
130 property
= property
->Last();
136 if ( parent
== m_baseParent
)
147 m_property
= property
;
149 // If property does not match our criteria, skip it
150 if ( property
->GetFlags() & m_itemExMask
)
154 void wxPropertyGridIteratorBase::Next( bool iterateChildren
)
156 wxPGProperty
* property
= m_property
;
157 wxASSERT( 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()
206 m_pPropGrid
= (wxPropertyGrid
*) NULL
;
207 m_regularArray
.SetParentState(this);
208 m_properties
= &m_regularArray
;
209 m_abcArray
= (wxPGRootProperty
*) NULL
;
210 m_currentCategory
= (wxPropertyCategory
*) NULL
;
211 m_selected
= (wxPGProperty
*) NULL
;
214 m_lastCaptionBottomnest
= 1;
218 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
219 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
220 m_fSplitterX
= wxPG_DEFAULT_SPLITTERX
;
223 // -----------------------------------------------------------------------
225 wxPropertyGridPageState::~wxPropertyGridPageState()
230 // -----------------------------------------------------------------------
232 void wxPropertyGridPageState::InitNonCatMode()
236 m_abcArray
= new wxPGRootProperty();
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 wxPropertyGridIterator
it( this, wxPG_ITERATE_DEFAULT
|wxPG_ITERATE_CATEGORIES
);
253 for ( ; !it
.AtEnd(); it
.Next() )
255 wxPGProperty
* p
= it
.GetProperty();
256 wxPGProperty
* parent
= p
->GetParent();
257 if ( p
->HasFlag(wxPG_PROP_MISC_PARENT
) &&
258 ( parent
== m_properties
|| (parent
->IsCategory() || parent
->IsRoot()) ) )
260 m_abcArray
->AddChild2( p
);
261 p
->m_parent
= &m_regularArray
;
266 m_properties
= oldProperties
;
269 // -----------------------------------------------------------------------
271 void wxPropertyGridPageState::DoClear()
273 m_regularArray
.Empty();
279 m_currentCategory
= (wxPropertyCategory
*) NULL
;
280 m_lastCaptionBottomnest
= 1;
286 m_selected
= (wxPGProperty
*) NULL
;
289 // -----------------------------------------------------------------------
291 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
293 wxPropertyGrid
* propGrid
= GetGrid();
295 VirtualHeightChanged();
297 // Recalculate caption text extents.
300 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
302 wxPGProperty
* p
=m_regularArray
.Item(i
);
304 if ( p
->IsCategory() )
305 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
309 // -----------------------------------------------------------------------
311 void wxPropertyGridPageState::SetVirtualWidth( int width
)
313 wxASSERT( width
>= 0 );
314 wxPropertyGrid
* pg
= GetGrid();
315 int gw
= pg
->GetClientSize().x
;
322 // -----------------------------------------------------------------------
324 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
326 wxPropertyGrid
* pg
= GetGrid();
328 if ( pg
->HasVirtualWidth() )
330 if ( m_width
< newWidth
)
331 SetVirtualWidth( newWidth
);
333 CheckColumnWidths(widthChange
);
337 SetVirtualWidth( newWidth
);
339 // This should be done before splitter auto centering
340 // NOTE: Splitter auto-centering is done in this function.
343 CheckColumnWidths(widthChange
);
345 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
346 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
348 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
350 // If too long, don't set splitter
351 if ( timeSinceCreation
< 3000 )
353 if ( m_properties
->GetChildCount() || timeSinceCreation
> 750 )
355 SetSplitterLeft( false );
359 DoSetSplitterPosition( newWidth
/ 2 );
360 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
367 // -----------------------------------------------------------------------
368 // wxPropertyGridPageState item iteration methods
369 // -----------------------------------------------------------------------
371 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
373 if ( !m_properties
->GetChildCount() )
374 return (wxPGProperty
*) NULL
;
376 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
378 // First, get last child of last parent
379 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
380 while ( pwc
->GetChildCount() &&
381 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
382 pwc
= (wxPGProperty
*) pwc
->Last();
384 // Then, if it doesn't fit our criteria, back up until we find something that does
385 if ( pwc
->GetFlags() & itemExMask
)
387 wxPropertyGridIterator
it( this, flags
, pwc
);
388 for ( ; !it
.AtEnd(); it
.Prev() )
390 pwc
= (wxPGProperty
*) it
.GetProperty();
396 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
398 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
399 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
402 parent
= grandparent
;
403 grandparent
= (wxPGProperty
*)parent
->GetParent();
404 if ( parent
->IsCategory() && grandparent
)
405 return (wxPropertyCategory
*)parent
;
406 } while ( grandparent
);
408 return (wxPropertyCategory
*) NULL
;
411 // -----------------------------------------------------------------------
412 // wxPropertyGridPageState GetPropertyXXX methods
413 // -----------------------------------------------------------------------
415 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
416 wxPGProperty
* parent
) const
421 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
423 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
425 wxPGProperty
* p
= parent
->Item(i
);
426 if ( p
->m_label
== label
)
428 // Check children recursively.
429 if ( p
->GetChildCount() )
431 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
440 // -----------------------------------------------------------------------
442 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
444 wxPGHashMapS2P::const_iterator it
;
445 it
= m_dictName
.find(name
);
446 if ( it
!= m_dictName
.end() )
447 return (wxPGProperty
*) it
->second
;
448 return (wxPGProperty
*) NULL
;
451 // -----------------------------------------------------------------------
452 // wxPropertyGridPageState global operations
453 // -----------------------------------------------------------------------
455 // -----------------------------------------------------------------------
456 // Item iteration macros
457 // NB: Nowadays only needed for alphabetic/categoric mode switching.
458 // -----------------------------------------------------------------------
460 #define II_INVALID_I 0x00FFFFFF
462 #define ITEM_ITERATION_VARIABLES \
463 wxPGProperty* parent; \
467 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
468 parent = m_properties; \
471 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
472 parent = startparent; \
473 i = (unsigned int)startindex; \
474 if ( parent == (wxPGProperty*) NULL ) \
476 parent = state->m_properties; \
480 #define ITEM_ITERATION_LOOP_BEGIN \
483 iMax = parent->GetChildCount(); \
486 wxPGProperty* p = parent->Item(i);
488 #define ITEM_ITERATION_LOOP_END \
489 if ( p->GetChildCount() ) \
492 parent = (wxPGProperty*)p; \
493 iMax = parent->GetChildCount(); \
498 i = parent->m_arrIndex + 1; \
499 parent = parent->m_parent; \
501 while ( parent != NULL );
503 bool wxPropertyGridPageState::EnableCategories( bool enable
)
506 // NB: We can't use wxPropertyGridIterator in this
507 // function, since it depends on m_arrIndexes,
508 // which, among other things, is being fixed here.
510 ITEM_ITERATION_VARIABLES
518 if ( !IsInNonCatMode() )
521 m_properties
= &m_regularArray
;
523 // fix parents, indexes, and depths
524 ITEM_ITERATION_INIT_FROM_THE_TOP
526 ITEM_ITERATION_LOOP_BEGIN
530 p
->m_parent
= parent
;
532 // If parent was category, and this is not,
533 // then the depth stays the same.
534 if ( parent
->IsCategory() &&
536 p
->m_depth
= parent
->m_depth
;
538 p
->m_depth
= parent
->m_depth
+ 1;
540 ITEM_ITERATION_LOOP_END
546 // Disable categories
549 if ( IsInNonCatMode() )
552 // Create array, if necessary.
556 m_properties
= m_abcArray
;
558 // fix parents, indexes, and depths
559 ITEM_ITERATION_INIT_FROM_THE_TOP
561 ITEM_ITERATION_LOOP_BEGIN
565 p
->m_parent
= parent
;
567 p
->m_depth
= parent
->m_depth
+ 1;
569 ITEM_ITERATION_LOOP_END
572 VirtualHeightChanged();
574 if ( m_pPropGrid
->GetState() == this )
575 m_pPropGrid
->RecalculateVirtualSize();
580 // -----------------------------------------------------------------------
582 static int wxPG_SortFunc(void **p1
, void **p2
)
584 wxPGProperty
*pp1
= *((wxPGProperty
**)p1
);
585 wxPGProperty
*pp2
= *((wxPGProperty
**)p2
);
586 return pp1
->GetLabel().compare( pp2
->GetLabel() );
589 void wxPropertyGridPageState::SortChildren( wxPGProperty
* p
)
592 p
= (wxPGProperty
*)m_properties
;
594 if ( !p
->GetChildCount() )
597 wxPGProperty
* pwc
= (wxPGProperty
*)p
;
599 // Can only sort items with children
600 if ( pwc
->GetChildCount() < 1 )
603 pwc
->m_children
.Sort( wxPG_SortFunc
);
606 pwc
->FixIndexesOfChildren();
610 // -----------------------------------------------------------------------
612 void wxPropertyGridPageState::Sort()
614 SortChildren( m_properties
);
616 // Sort categories as well
617 if ( !IsInNonCatMode() )
620 for ( i
=0;i
<m_properties
->GetChildCount();i
++)
622 wxPGProperty
* p
= m_properties
->Item(i
);
623 if ( p
->IsCategory() )
629 // -----------------------------------------------------------------------
630 // wxPropertyGridPageState splitter, column and hittest functions
631 // -----------------------------------------------------------------------
633 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
637 return (wxPGProperty
*) NULL
;
640 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
643 // -----------------------------------------------------------------------
645 wxPropertyGridHitTestResult
wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
647 wxPropertyGridHitTestResult result
;
648 result
.column
= HitTestH( pt
.x
, &result
.splitter
, &result
.splitterHitOffset
);
649 result
.property
= DoGetItemAtY( pt
.y
);
653 // -----------------------------------------------------------------------
655 // Used by SetSplitterLeft() and DotFitColumns()
656 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
661 wxPropertyGrid
* pg
= m_pPropGrid
;
666 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
668 wxPGProperty
* p
= pwc
->Item(i
);
669 if ( !p
->IsCategory() )
671 dc
.GetTextExtent( p
->GetColumnText(col
), &w
, &h
);
673 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
676 // TODO: Add bitmap support.
678 w
+= (wxPG_XBEFORETEXT
*2);
684 if ( p
->GetChildCount() &&
685 ( subProps
|| p
->IsCategory() ) )
687 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
697 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
699 int n
= GetGrid()->m_marginWidth
;
701 for ( i
=0; i
<=splitterColumn
; i
++ )
706 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
708 return wxPG_DRAG_MARGIN
;
711 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
713 int origWidth
= m_colWidths
[column
];
714 m_colWidths
[column
] -= decrease
;
715 int min
= GetColumnMinWidth(column
);
717 if ( m_colWidths
[column
] < min
)
719 more
= decrease
- (origWidth
- min
);
720 m_colWidths
[column
] = min
;
724 // FIXME: Causes erratic splitter changing, so as a workaround
725 // disabled if two or less columns.
727 if ( m_colWidths
.size() <= 2 )
731 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
732 PropagateColSizeDec( column
, more
, dir
);
735 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
737 wxPropertyGrid
* pg
= GetGrid();
739 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
741 if ( !pg
->HasVirtualWidth() )
747 otherColumn
= splitterColumn
+ 1;
748 if ( otherColumn
== (int)m_colWidths
.size() )
750 m_colWidths
[splitterColumn
] += adjust
;
751 PropagateColSizeDec( otherColumn
, adjust
, 1 );
755 otherColumn
= splitterColumn
+ 1;
756 if ( otherColumn
== (int)m_colWidths
.size() )
758 m_colWidths
[otherColumn
] -= adjust
;
759 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
764 m_colWidths
[splitterColumn
] += adjust
;
767 if ( splitterColumn
== 0 )
768 m_fSplitterX
= (double) newXPos
;
770 if ( !fromAutoCenter
)
772 // Don't allow initial splitter auto-positioning after this.
773 if ( pg
->GetState() == this )
774 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
780 // Moves splitter so that all labels are visible, but just.
781 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
783 wxPropertyGrid
* pg
= GetGrid();
785 dc
.SetFont(pg
->m_font
);
787 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
791 maxW
+= pg
->m_marginWidth
;
792 DoSetSplitterPosition( maxW
);
795 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
798 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
800 wxPropertyGrid
* pg
= GetGrid();
802 dc
.SetFont(pg
->m_font
);
804 int marginWidth
= pg
->m_marginWidth
;
805 int accWid
= marginWidth
;
806 int maxColWidth
= 500;
808 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
810 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
811 int colMinWidth
= GetColumnMinWidth(col
);
812 if ( fitWid
< colMinWidth
)
813 fitWid
= colMinWidth
;
814 else if ( fitWid
> maxColWidth
)
815 fitWid
= maxColWidth
;
817 m_colWidths
[col
] = fitWid
;
822 // Expand last one to fill the width
823 int remaining
= m_width
- accWid
;
824 m_colWidths
[GetColumnCount()-1] += remaining
;
826 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
828 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
829 m_fSplitterX
= (double) firstSplitterX
;
831 // Don't allow initial splitter auto-positioning after this.
832 if ( pg
->GetState() == this )
834 pg
->SetSplitterPosition(firstSplitterX
, false);
839 pg
->GetVirtualSize(&x
, &y
);
841 return wxSize(accWid
, y
);
844 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
849 wxPropertyGrid
* pg
= GetGrid();
852 const bool debug
= false;
856 unsigned int lastColumn
= m_colWidths
.size() - 1;
858 int clientWidth
= pg
->GetClientSize().x
;
861 // Column to reduce, if needed. Take last one that exceeds minimum width.
862 // Except if auto splitter centering is used, in which case use widest.
864 int highestColWidth
= 0;
866 bool minimizedCols
= false;
870 wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width
, clientWidth
);
875 for ( i
=0; i
<m_colWidths
.size(); i
++ )
877 int min
= GetColumnMinWidth(i
);
878 if ( m_colWidths
[i
] <= min
)
880 m_colWidths
[i
] = min
;
881 minimizedCols
= true;
885 if ( pg
->HasFlag(wxPG_SPLITTER_AUTO_CENTER
) )
887 if ( m_colWidths
[i
] >= highestColWidth
)
889 highestColWidth
= m_colWidths
[i
];
900 int colsWidth
= pg
->m_marginWidth
;
901 for ( i
=0; i
<m_colWidths
.size(); i
++ )
902 colsWidth
+= m_colWidths
[i
];
906 wxLogDebug(wxT(" HasVirtualWidth: %i colsWidth: %i"),(int)pg
->HasVirtualWidth(),colsWidth
);
909 // Then mode-based requirement
910 if ( !pg
->HasVirtualWidth() )
912 int widthHigher
= width
- colsWidth
;
914 // Adapt colsWidth to width
915 if ( colsWidth
< width
)
920 wxLogDebug(wxT(" Adjust last column to %i"), m_colWidths
[lastColumn
] + widthHigher
);
922 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
924 else if ( colsWidth
> width
)
927 if ( reduceCol
!= -1 )
931 wxLogDebug(wxT(" Reduce column %i (by %i)"), reduceCol
, -widthHigher
);
933 // Reduce widest column, and recheck
934 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
941 // Only check colsWidth against clientWidth
942 if ( colsWidth
< clientWidth
)
944 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
949 // If width changed, recalculate virtual size
950 if ( pg
->GetState() == this )
951 pg
->RecalculateVirtualSize();
956 for ( i
=0; i
<m_colWidths
.size(); i
++ )
957 wxLogDebug(wxT("col%i: %i"),i
,m_colWidths
[i
]);
960 // Auto center splitter
961 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
962 m_colWidths
.size() == 2 )
964 float centerX
= (float)(pg
->m_width
/2);
967 if ( m_fSplitterX
< 0.0 )
971 else if ( widthChange
)
973 //float centerX = float(pg->GetSize().x) * 0.5;
976 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
977 float deviation
= fabs(centerX
- splitterX
);
979 // If deviating from center, adjust towards it
980 if ( deviation
> 20.0 )
982 if ( splitterX
> centerX
)
990 // No width change, just keep sure we keep splitter position intact
991 splitterX
= m_fSplitterX
;
992 float deviation
= fabs(centerX
- splitterX
);
993 if ( deviation
> 50.0 )
999 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1001 m_fSplitterX
= splitterX
; // needed to retain accuracy
1005 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1007 wxASSERT( colCount
>= 2 );
1008 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1009 if ( m_colWidths
.size() > (unsigned int)colCount
)
1010 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1012 if ( m_pPropGrid
->GetState() == this )
1013 m_pPropGrid
->RecalculateVirtualSize();
1015 CheckColumnWidths();
1018 // Returns column index, -1 for margin
1019 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1021 int cx
= GetGrid()->m_marginWidth
;
1023 int prevSplitter
= -1;
1028 if ( col
>= (int)m_colWidths
.size() )
1034 cx
+= m_colWidths
[col
];
1037 // Near prev. splitter
1040 int diff
= x
- prevSplitter
;
1041 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1043 *pSplitterHit
= col
- 1;
1044 *pSplitterHitOffset
= diff
;
1049 // Near next splitter
1050 int nextSplitter
= cx
;
1051 if ( col
< (int)(m_colWidths
.size()-1) )
1053 int diff
= x
- nextSplitter
;
1054 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1056 *pSplitterHit
= col
;
1057 *pSplitterHitOffset
= diff
;
1066 // -----------------------------------------------------------------------
1067 // wxPropertyGridPageState property value setting and getting
1068 // -----------------------------------------------------------------------
1070 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1074 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
;
1076 wxVariant variant
= p
->GetValueRef();
1079 if ( p
->GetMaxLength() <= 0 )
1080 res
= p
->StringToValue( variant
, value
, flags
);
1082 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1086 p
->SetValue(variant
);
1087 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1088 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1096 // -----------------------------------------------------------------------
1098 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1103 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1104 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1111 // -----------------------------------------------------------------------
1113 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1117 // wnd_primary has to be given so the control can be updated as well.
1119 DoSetPropertyValue(p
, v
);
1125 // -----------------------------------------------------------------------
1127 void wxPropertyGridPageState::DoSetPropertyValueUnspecified( wxPGProperty
* p
)
1129 wxCHECK_RET( p
, wxT("invalid property id") );
1131 if ( !p
->IsValueUnspecified() )
1133 // Value should be set first - editor class methods may need it
1134 p
->m_value
.MakeNull();
1136 wxASSERT( m_pPropGrid
);
1138 if ( m_pPropGrid
->GetState() == this )
1140 if ( m_pPropGrid
->m_selected
== p
&& m_pPropGrid
->m_wndEditor
)
1142 p
->GetEditorClass()->SetValueToUnspecified(p
, m_pPropGrid
->GetEditorControl());
1147 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1148 DoSetPropertyValueUnspecified( p
->Item(i
) );
1152 // -----------------------------------------------------------------------
1153 // wxPropertyGridPageState property operations
1154 // -----------------------------------------------------------------------
1156 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1158 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1160 if ( !p
->GetChildCount() ) return false;
1162 if ( !p
->IsExpanded() ) return false;
1164 p
->SetExpanded(false);
1166 VirtualHeightChanged();
1171 // -----------------------------------------------------------------------
1173 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1175 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1177 if ( !p
->GetChildCount() ) return false;
1179 if ( p
->IsExpanded() ) return false;
1181 p
->SetExpanded(true);
1183 VirtualHeightChanged();
1188 // -----------------------------------------------------------------------
1190 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1192 if ( this == m_pPropGrid
->GetState() )
1193 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1199 // -----------------------------------------------------------------------
1201 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1204 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1206 p
->SetFlag( wxPG_PROP_HIDDEN
);
1208 if ( flags
& wxPG_RECURSE
)
1211 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1212 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1215 VirtualHeightChanged();
1220 // -----------------------------------------------------------------------
1222 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1228 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1233 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1237 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1242 p
->m_flags
|= wxPG_PROP_DISABLED
;
1246 // Apply same to sub-properties as well
1248 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1249 DoEnableProperty( p
->Item(i
), enable
);
1256 // -----------------------------------------------------------------------
1257 // wxPropertyGridPageState wxVariant related routines
1258 // -----------------------------------------------------------------------
1260 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1261 // Never includes sub-properties (unless they are parented by wxParentProperty).
1262 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1263 wxPGProperty
* baseparent
,
1266 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1268 // Root is the default base-parent.
1272 wxVariantList tempList
;
1273 wxVariant
v( tempList
, listname
);
1275 if ( pwc
->GetChildCount() )
1277 if ( flags
& wxPG_KEEP_STRUCTURE
)
1279 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1282 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1284 wxPGProperty
* p
= pwc
->Item(i
);
1285 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1287 wxVariant variant
= p
->GetValue();
1288 variant
.SetName( p
->GetBaseName() );
1289 v
.Append( variant
);
1293 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1295 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1296 v
.Append( p
->GetAttributesAsList() );
1301 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1302 it
.SetBaseParent( pwc
);
1304 for ( ; !it
.AtEnd(); it
.Next() )
1306 const wxPGProperty
* p
= it
.GetProperty();
1308 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1309 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1311 wxVariant variant
= p
->GetValue();
1312 variant
.SetName( p
->GetName() );
1313 v
.Append( variant
);
1314 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1315 v
.Append( p
->GetAttributesAsList() );
1324 // -----------------------------------------------------------------------
1326 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1328 unsigned char origFrozen
= 1;
1330 if ( m_pPropGrid
->GetState() == this )
1332 origFrozen
= m_pPropGrid
->m_frozen
;
1333 if ( !origFrozen
) m_pPropGrid
->Freeze();
1336 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1338 if ( !use_category
)
1339 use_category
= (wxPropertyCategory
*)m_properties
;
1341 // Let's iterate over the list of variants.
1342 wxVariantList::const_iterator node
;
1343 int numSpecialEntries
= 0;
1346 // Second pass for special entries
1347 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1349 wxVariant
*current
= (wxVariant
*)*node
;
1351 // Make sure it is wxVariant.
1352 wxASSERT( current
);
1353 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1355 const wxString
& name
= current
->GetName();
1356 if ( name
.length() > 0 )
1359 // '@' signified a special entry
1360 if ( name
[0] == wxS('@') )
1362 numSpecialEntries
++;
1366 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1369 wxPGProperty
* p
= foundProp
;
1371 // If it was a list, we still have to go through it.
1372 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1374 DoSetPropertyValues( current
->GetList(),
1375 p
->IsCategory()?p
:((wxPGProperty
*)NULL
)
1381 if ( wxStrcmp(current
->GetType(), p
->GetValue().GetType()) != 0)
1383 wxLogDebug(wxT("wxPropertyGridPageState::DoSetPropertyValues Warning: Setting value of property \"%s\" from variant"),
1384 p
->GetName().c_str());
1388 p
->SetValue(*current
);
1394 if ( current
->GetType() != wxS("list") )
1400 // Yes, it is; create a sub category and append contents there.
1401 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1402 DoSetPropertyValues( current
->GetList(), newCat
);
1409 if ( numSpecialEntries
)
1411 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1413 wxVariant
*current
= (wxVariant
*)*node
;
1415 const wxString
& name
= current
->GetName();
1416 if ( name
.length() > 0 )
1419 // '@' signified a special entry
1420 if ( name
[0] == wxS('@') )
1422 numSpecialEntries
--;
1424 size_t pos2
= name
.rfind(wxS('@'));
1425 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1427 wxString propName
= name
.substr(1, pos2
-1);
1428 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1430 if ( entryType
== wxS("attr") )
1433 // List of attributes
1434 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1437 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1439 wxVariantList
& list2
= current
->GetList();
1440 wxVariantList::const_iterator node2
;
1442 for ( node2
= list2
.begin(); node2
!= list2
.end(); node2
++ )
1444 wxVariant
*attr
= (wxVariant
*)*node2
;
1445 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1450 // ERROR: No such property: 'propName'
1456 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1461 if ( !numSpecialEntries
)
1468 m_pPropGrid
->Thaw();
1470 if ( this == m_pPropGrid
->GetState() )
1472 m_selected
->UpdateControl(m_pPropGrid
->GetEditorControl());
1478 // -----------------------------------------------------------------------
1479 // wxPropertyGridPageState property adding and removal
1480 // -----------------------------------------------------------------------
1482 int wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1483 wxPGProperty
* scheduledParent
)
1485 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1487 // This will allow better behavior.
1488 if ( scheduledParent
== m_properties
)
1489 scheduledParent
= (wxPGProperty
*) NULL
;
1491 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1493 wxASSERT_MSG( property
->GetBaseName().length(),
1494 "Property's children must have unique, non-empty names within their scope" );
1497 property
->m_parentState
= this;
1499 if ( property
->IsCategory() )
1502 // Parent of a category must be either root or another category
1503 // (otherwise Bad Things might happen).
1504 wxASSERT_MSG( scheduledParent
== NULL
||
1505 scheduledParent
== m_properties
||
1506 scheduledParent
->IsCategory(),
1507 wxT("Parent of a category must be either root or another category."));
1509 // If we already have category with same name, delete given property
1510 // and use it instead as most recent caption item.
1511 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1514 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1515 if ( pwc
->IsCategory() ) // Must be a category.
1518 m_currentCategory
= pwc
;
1519 return 2; // Tells the caller what we did.
1525 // Warn for identical names in debug mode.
1526 if ( BaseGetPropertyByName(property
->GetName()) &&
1527 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1529 wxLogError(wxT("wxPropertyGrid: Warning - item with name \"%s\" already exists."),
1530 property
->GetName().c_str());
1531 wxPGGlobalVars
->m_warnings
++;
1535 // Make sure nothing is selected.
1536 if ( propGrid
&& propGrid
->m_selected
)
1538 bool selRes
= propGrid
->ClearSelection();
1539 wxPG_CHECK_MSG_DBG( selRes
,
1541 wxT("failed to deselect a property (editor probably had invalid value)") );
1544 if ( scheduledParent
)
1546 // Use parent's colours.
1547 property
->m_bgColIndex
= scheduledParent
->m_bgColIndex
;
1548 property
->m_fgColIndex
= scheduledParent
->m_fgColIndex
;
1550 // Fix no parent does not yet have parenting flag yet, set one now
1551 if ( !scheduledParent
->HasFlag(wxPG_PROP_PARENTAL_FLAGS
) )
1552 scheduledParent
->SetParentalType(wxPG_PROP_MISC_PARENT
);
1553 //scheduledParent->SetFlag(wxPG_PROP_MISC_PARENT);
1556 // If in hideable adding mode, or if assigned parent is hideable, then
1557 // make this one hideable.
1559 ( scheduledParent
&& (scheduledParent
->m_flags
& wxPG_PROP_HIDDEN
) ) ||
1560 ( propGrid
&& (propGrid
->m_iFlags
& wxPG_FL_ADDING_HIDEABLES
) )
1562 property
->SetFlag( wxPG_PROP_HIDDEN
);
1564 // Set custom image flag.
1565 int custImgHeight
= property
->OnMeasureImage().y
;
1566 if ( custImgHeight
< 0 /*|| custImgHeight > 1*/ )
1568 property
->m_flags
|= wxPG_PROP_CUSTOMIMAGE
;
1571 if ( propGrid
&& (propGrid
->GetWindowStyleFlag() & wxPG_LIMITED_EDITING
) )
1572 property
->m_flags
|= wxPG_PROP_NOEDITOR
;
1574 if ( !property
->IsCategory() )
1576 // This is not a category.
1578 //wxASSERT_MSG( property->GetEditorClass(), wxT("Editor class not initialized!") );
1582 unsigned char depth
= 1;
1583 if ( scheduledParent
)
1585 depth
= scheduledParent
->m_depth
;
1586 if ( !scheduledParent
->IsCategory() )
1589 property
->m_depth
= depth
;
1590 unsigned char greyDepth
= depth
;
1592 if ( scheduledParent
)
1594 wxPropertyCategory
* pc
;
1596 if ( scheduledParent
->IsCategory() || scheduledParent
->IsRoot() )
1597 pc
= (wxPropertyCategory
*)scheduledParent
;
1599 // This conditional compile is necessary to
1600 // bypass some compiler bug.
1601 pc
= GetPropertyCategory(scheduledParent
);
1604 greyDepth
= pc
->GetDepth();
1606 greyDepth
= scheduledParent
->m_depthBgCol
;
1609 property
->m_depthBgCol
= greyDepth
;
1611 // Prepare children pre-added children
1612 if ( property
->GetChildCount() )
1614 property
->SetParentalType(wxPG_PROP_AGGREGATE
);
1616 property
->SetExpanded(false); // Properties with children are not expanded by default.
1617 if ( propGrid
&& propGrid
->GetWindowStyleFlag() & wxPG_HIDE_MARGIN
)
1618 property
->SetExpanded(true); // ...unless it cannot be expanded.
1620 property
->PrepareSubProperties();
1625 if ( propGrid
&& (propGrid
->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES
) )
1626 property
->SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED
, true);
1632 // This is a category.
1635 unsigned char depth
= 1;
1636 if ( scheduledParent
)
1638 depth
= scheduledParent
->m_depth
+ 1;
1640 property
->m_depth
= depth
;
1641 property
->m_depthBgCol
= depth
;
1643 m_currentCategory
= (wxPropertyCategory
*)property
;
1645 wxPropertyCategory
* pc
= (wxPropertyCategory
*)property
;
1647 // Calculate text extent for caption item.
1649 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1655 // -----------------------------------------------------------------------
1657 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1659 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1660 if ( property
->IsCategory() )
1661 cur_cat
= (wxPropertyCategory
*) NULL
;
1663 return DoInsert( cur_cat
, -1, property
);
1666 // -----------------------------------------------------------------------
1668 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1671 parent
= m_properties
;
1673 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1675 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1677 int parenting
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1679 // This type of invalid parenting value indicates we should exit now, returning
1680 // id of most recent category.
1681 if ( parenting
> 1 )
1682 return m_currentCategory
;
1684 // Note that item must be added into current mode later.
1686 // If parent is wxParentProperty, just stick it in...
1687 // If parent is root (m_properties), then...
1688 // In categoric mode: Add as last item in m_abcArray (if not category).
1689 // Add to given index in m_regularArray.
1690 // In non-cat mode: Add as last item in m_regularArray.
1691 // Add to given index in m_abcArray.
1692 // If parent is category, then...
1693 // 1) Add to given category in given index.
1694 // 2) Add as last item in m_abcArray.
1696 if ( !parent
->IsCategory() && !parent
->IsRoot() )
1698 // Parent is wxParentingProperty: Just stick it in...
1699 parent
->AddChild2( property
, index
);
1703 // Parent is Category or Root.
1705 if ( m_properties
== &m_regularArray
)
1709 // Only add non-categories to m_abcArray.
1710 if ( m_abcArray
&& parenting
<= 0 )
1711 m_abcArray
->AddChild2( property
, -1, false );
1713 // Add to current mode.
1714 parent
->AddChild2( property
, index
);
1719 // Non-categorized mode.
1721 if ( parent
!= m_properties
)
1722 // Parent is category.
1723 parent
->AddChild2( property
, index
, false );
1726 m_regularArray
.AddChild2( property
, -1, false );
1728 // Add to current mode (no categories).
1729 if ( parenting
<= 0 )
1730 m_abcArray
->AddChild2( property
, index
);
1735 if ( property
->IsCategory() )
1737 // This is a category caption item.
1739 // Last caption is not the bottom one (this info required by append)
1740 m_lastCaptionBottomnest
= 0;
1743 // Only add name to hashmap if parent is root or category
1744 if ( (parent
->IsCategory() || parent
->IsRoot()) && property
->m_name
.length() )
1745 m_dictName
[property
->m_name
] = (void*) property
;
1747 VirtualHeightChanged();
1749 property
->UpdateParentValues();
1756 // -----------------------------------------------------------------------
1758 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
)
1760 wxCHECK_RET( item
->GetParent(),
1761 wxT("this property was already deleted") );
1763 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1764 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1767 unsigned int indinparent
= item
->GetIndexInParent();
1769 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1771 wxCHECK_RET( !item
->GetParent()->HasFlag(wxPG_PROP_AGGREGATE
),
1772 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1774 if ( item
->IsCategory() )
1776 // deleting a category
1778 // erase category entries from the hash table
1779 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1781 wxPGProperty
* sp
= pwc
->Item( i
);
1782 if ( sp
->GetBaseName().Len() ) m_dictName
.erase(sp
->GetBaseName());
1785 if ( pwc
== m_currentCategory
)
1786 m_currentCategory
= (wxPropertyCategory
*) NULL
;
1790 // Remove children from non-categorized array.
1791 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1793 wxPGProperty
* p
= pwc
->Item( i
);
1794 wxASSERT( p
!= NULL
);
1795 if ( !p
->IsCategory() )
1796 m_abcArray
->m_children
.Remove( p
);
1799 if ( IsInNonCatMode() )
1800 m_abcArray
->FixIndexesOfChildren();
1804 if ( !IsInNonCatMode() )
1806 // categorized mode - non-categorized array
1808 // Remove from non-cat array, but only if parent is in it
1809 if ( !item
->IsCategory() && item
->GetParent()->IsCategory() )
1813 m_abcArray
->m_children
.Remove( item
);
1817 // categorized mode - categorized array
1818 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1819 item
->m_parent
->FixIndexesOfChildren(/*indinparent*/);
1823 // non-categorized mode - categorized array
1825 // We need to find location of item.
1826 wxPGProperty
* cat_parent
= &m_regularArray
;
1827 int cat_index
= m_regularArray
.GetChildCount();
1829 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1831 wxPGProperty
* p
= m_regularArray
.Item(i
);
1832 if ( p
== item
) { cat_index
= i
; break; }
1833 if ( p
->IsCategory() )
1835 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1836 if ( subind
!= wxNOT_FOUND
)
1838 cat_parent
= ((wxPGProperty
*)p
);
1844 cat_parent
->m_children
.RemoveAt(cat_index
);
1846 // non-categorized mode - non-categorized array
1847 if ( !item
->IsCategory() )
1849 wxASSERT( item
->m_parent
== m_abcArray
);
1850 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1851 item
->m_parent
->FixIndexesOfChildren(indinparent
);
1855 if ( item
->GetBaseName().Len() ) m_dictName
.erase(item
->GetBaseName());
1857 // We can actually delete it now
1860 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1862 VirtualHeightChanged();
1865 // -----------------------------------------------------------------------
1867 #endif // wxUSE_PROPGRID