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"
37 // This define is necessary to prevent macro clearing
38 #define __wxPG_SOURCE_FILE__
40 #include <wx/propgrid/propgridpagestate.h>
41 #include <wx/propgrid/propgrid.h>
42 #include <wx/propgrid/editors.h>
44 #define wxPG_DEFAULT_SPLITTERX 110
47 // -----------------------------------------------------------------------
48 // wxPropertyGridIterator
49 // -----------------------------------------------------------------------
51 void wxPropertyGridIteratorBase
::Init( wxPropertyGridPageState
* state
, int flags
, wxPGProperty
* property
, int dir
)
53 wxASSERT( dir
== 1 || dir
== -1 );
56 m_baseParent
= state
->DoGetRoot();
57 if ( !property
&& m_baseParent
->GetChildCount() )
58 property
= m_baseParent
->Item(0);
60 m_property
= property
;
62 wxPG_ITERATOR_CREATE_MASKS(flags
, m_itemExMask
, m_parentExMask
)
64 // Need to skip first?
65 if ( property
&& (property
->GetFlags() & m_itemExMask
) )
74 void wxPropertyGridIteratorBase
::Init( wxPropertyGridPageState
* state
, int flags
, int startPos
, int dir
)
76 wxPGProperty
* property
;
78 if ( startPos
== wxTOP
)
84 else if ( startPos
== wxBOTTOM
)
86 property
= state
->GetLastItem(flags
);
92 wxASSERT_MSG( false, wxT("Only supported stating positions are wxTOP and wxBOTTOM") );
96 Init( state
, flags
, property
, dir
);
99 void wxPropertyGridIteratorBase
::Assign( const wxPropertyGridIteratorBase
& it
)
101 m_property
= it
.m_property
;
102 m_state
= it
.m_state
;
103 m_baseParent
= it
.m_baseParent
;
104 m_itemExMask
= it
.m_itemExMask
;
105 m_parentExMask
= it
.m_parentExMask
;
108 void wxPropertyGridIteratorBase
::Prev()
110 wxPGProperty
* property
= m_property
;
111 wxASSERT( 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
;
156 wxASSERT( property
);
158 if ( property
->GetChildCount() &&
159 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) &&
163 property
= property
->Item(0);
167 wxPGProperty
* parent
= property
->GetParent();
169 unsigned int index
= property
->GetIndexInParent() + 1;
171 if ( index
< parent
->GetChildCount() )
174 property
= parent
->Item(index
);
178 // Next sibling of parent
179 if ( parent
== m_baseParent
)
192 m_property
= property
;
194 // If property does not match our criteria, skip it
195 if ( property
->GetFlags() & m_itemExMask
)
199 // -----------------------------------------------------------------------
200 // wxPropertyGridPageState
201 // -----------------------------------------------------------------------
203 wxPropertyGridPageState
::wxPropertyGridPageState()
205 m_pPropGrid
= (wxPropertyGrid
*) NULL
;
206 m_regularArray
.SetParentState(this);
207 m_properties
= &m_regularArray
;
208 m_abcArray
= (wxPGRootProperty
*) NULL
;
209 m_currentCategory
= (wxPropertyCategory
*) NULL
;
210 m_selected
= (wxPGProperty
*) 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
;
222 // -----------------------------------------------------------------------
224 wxPropertyGridPageState
::~wxPropertyGridPageState()
229 // -----------------------------------------------------------------------
231 void wxPropertyGridPageState
::InitNonCatMode()
235 m_abcArray
= new wxPGRootProperty();
236 m_abcArray
->SetParentState(this);
237 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
240 // Must be called when state::m_properties still points to regularArray.
241 wxPGProperty
* oldProperties
= m_properties
;
243 // Must use temp value in state::m_properties for item iteration loop
244 // to run as expected.
245 m_properties
= &m_regularArray
;
247 if ( m_properties
->GetChildCount() )
250 wxPropertyGridIterator
it( this, wxPG_ITERATE_DEFAULT
|wxPG_ITERATE_CATEGORIES
);
252 for ( ; !it
.AtEnd(); it
.Next() )
254 wxPGProperty
* p
= it
.GetProperty();
255 wxPGProperty
* parent
= p
->GetParent();
256 if ( p
->HasFlag(wxPG_PROP_MISC_PARENT
) &&
257 ( parent
== m_properties
|| (parent
->IsCategory() || parent
->IsRoot()) ) )
259 m_abcArray
->AddChild2( p
);
260 p
->m_parent
= &m_regularArray
;
265 m_properties
= oldProperties
;
268 // -----------------------------------------------------------------------
270 void wxPropertyGridPageState
::DoClear()
272 m_regularArray
.Empty();
278 m_currentCategory
= (wxPropertyCategory
*) NULL
;
279 m_lastCaptionBottomnest
= 1;
285 m_selected
= (wxPGProperty
*) NULL
;
288 // -----------------------------------------------------------------------
290 void wxPropertyGridPageState
::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
292 wxPropertyGrid
* propGrid
= GetGrid();
294 VirtualHeightChanged();
296 // Recalculate caption text extents.
299 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
301 wxPGProperty
* p
=m_regularArray
.Item(i
);
303 if ( p
->IsCategory() )
304 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
308 // -----------------------------------------------------------------------
310 void wxPropertyGridPageState
::SetVirtualWidth( int width
)
312 wxASSERT( width
>= 0 );
313 wxPropertyGrid
* pg
= GetGrid();
314 int gw
= pg
->GetClientSize().x
;
321 // -----------------------------------------------------------------------
323 void wxPropertyGridPageState
::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
325 wxPropertyGrid
* pg
= GetGrid();
327 if ( pg
->HasVirtualWidth() )
329 if ( m_width
< newWidth
)
330 SetVirtualWidth( newWidth
);
332 CheckColumnWidths(widthChange
);
336 SetVirtualWidth( newWidth
);
338 // This should be done before splitter auto centering
339 // NOTE: Splitter auto-centering is done in this function.
342 CheckColumnWidths(widthChange
);
344 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
345 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
347 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
349 // If too long, don't set splitter
350 if ( timeSinceCreation
< 3000 )
352 if ( m_properties
->GetChildCount() || timeSinceCreation
> 750 )
354 SetSplitterLeft( false );
358 DoSetSplitterPosition( newWidth
/ 2 );
359 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
366 // -----------------------------------------------------------------------
367 // wxPropertyGridPageState item iteration methods
368 // -----------------------------------------------------------------------
370 wxPGProperty
* wxPropertyGridPageState
::GetLastItem( int flags
)
372 if ( !m_properties
->GetChildCount() )
373 return (wxPGProperty
*) NULL
;
375 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
377 // First, get last child of last parent
378 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
379 while ( pwc
->GetChildCount() &&
380 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
381 pwc
= (wxPGProperty
*) pwc
->Last();
383 // Then, if it doesn't fit our criteria, back up until we find something that does
384 if ( pwc
->GetFlags() & itemExMask
)
386 wxPropertyGridIterator
it( this, flags
, pwc
);
387 for ( ; !it
.AtEnd(); it
.Prev() )
389 pwc
= (wxPGProperty
*) it
.GetProperty();
395 wxPropertyCategory
* wxPropertyGridPageState
::GetPropertyCategory( const wxPGProperty
* p
) const
397 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
398 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
401 parent
= grandparent
;
402 grandparent
= (wxPGProperty
*)parent
->GetParent();
403 if ( parent
->IsCategory() && grandparent
)
404 return (wxPropertyCategory
*)parent
;
405 } while ( grandparent
);
407 return (wxPropertyCategory
*) NULL
;
410 // -----------------------------------------------------------------------
411 // wxPropertyGridPageState GetPropertyXXX methods
412 // -----------------------------------------------------------------------
414 wxPGProperty
* wxPropertyGridPageState
::GetPropertyByLabel( const wxString
& label
,
415 wxPGProperty
* parent
) const
420 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
422 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
424 wxPGProperty
* p
= parent
->Item(i
);
425 if ( p
->m_label
== label
)
427 // Check children recursively.
428 if ( p
->GetChildCount() )
430 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
439 // -----------------------------------------------------------------------
441 wxPGProperty
* wxPropertyGridPageState
::BaseGetPropertyByName( const wxString
& name
) const
443 wxPGHashMapS2P
::const_iterator it
;
444 it
= m_dictName
.find(name
);
445 if ( it
!= m_dictName
.end() )
446 return (wxPGProperty
*) it
->second
;
447 return (wxPGProperty
*) NULL
;
450 // -----------------------------------------------------------------------
451 // wxPropertyGridPageState global operations
452 // -----------------------------------------------------------------------
454 // -----------------------------------------------------------------------
455 // Item iteration macros
456 // NB: Nowadays only needed for alphabetic/categoric mode switching.
457 // -----------------------------------------------------------------------
459 #define II_INVALID_I 0x00FFFFFF
461 #define ITEM_ITERATION_VARIABLES \
462 wxPGProperty* parent; \
466 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
467 parent = m_properties; \
470 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
471 parent = startparent; \
472 i = (unsigned int)startindex; \
473 if ( parent == (wxPGProperty*) NULL ) \
475 parent = state->m_properties; \
479 #define ITEM_ITERATION_LOOP_BEGIN \
482 iMax = parent->GetChildCount(); \
485 wxPGProperty* p = parent->Item(i);
487 #define ITEM_ITERATION_LOOP_END \
488 if ( p->GetChildCount() ) \
491 parent = (wxPGProperty*)p; \
492 iMax = parent->GetChildCount(); \
497 i = parent->m_arrIndex + 1; \
498 parent = parent->m_parent; \
500 while ( parent != NULL );
502 bool wxPropertyGridPageState
::EnableCategories( bool enable
)
505 // NB: We can't use wxPropertyGridIterator in this
506 // function, since it depends on m_arrIndexes,
507 // which, among other things, is being fixed here.
509 ITEM_ITERATION_VARIABLES
517 if ( !IsInNonCatMode() )
520 m_properties
= &m_regularArray
;
522 // fix parents, indexes, and depths
523 ITEM_ITERATION_INIT_FROM_THE_TOP
525 ITEM_ITERATION_LOOP_BEGIN
529 p
->m_parent
= parent
;
531 // If parent was category, and this is not,
532 // then the depth stays the same.
533 if ( parent
->IsCategory() &&
535 p
->m_depth
= parent
->m_depth
;
537 p
->m_depth
= parent
->m_depth
+ 1;
539 ITEM_ITERATION_LOOP_END
545 // Disable categories
548 if ( IsInNonCatMode() )
551 // Create array, if necessary.
555 m_properties
= m_abcArray
;
557 // fix parents, indexes, and depths
558 ITEM_ITERATION_INIT_FROM_THE_TOP
560 ITEM_ITERATION_LOOP_BEGIN
564 p
->m_parent
= parent
;
566 p
->m_depth
= parent
->m_depth
+ 1;
568 ITEM_ITERATION_LOOP_END
571 VirtualHeightChanged();
573 if ( m_pPropGrid
->GetState() == this )
574 m_pPropGrid
->RecalculateVirtualSize();
579 // -----------------------------------------------------------------------
581 static int wxPG_SortFunc(void **p1
, void **p2
)
583 wxPGProperty
*pp1
= *((wxPGProperty
**)p1
);
584 wxPGProperty
*pp2
= *((wxPGProperty
**)p2
);
585 return pp1
->GetLabel().compare( pp2
->GetLabel() );
588 void wxPropertyGridPageState
::SortChildren( wxPGProperty
* p
)
591 p
= (wxPGProperty
*)m_properties
;
593 if ( !p
->GetChildCount() )
596 wxPGProperty
* pwc
= (wxPGProperty
*)p
;
598 // Can only sort items with children
599 if ( pwc
->GetChildCount() < 1 )
602 pwc
->m_children
.Sort( wxPG_SortFunc
);
605 pwc
->FixIndexesOfChildren();
609 // -----------------------------------------------------------------------
611 void wxPropertyGridPageState
::Sort()
613 SortChildren( m_properties
);
615 // Sort categories as well
616 if ( !IsInNonCatMode() )
619 for ( i
=0;i
<m_properties
->GetChildCount();i
++)
621 wxPGProperty
* p
= m_properties
->Item(i
);
622 if ( p
->IsCategory() )
628 // -----------------------------------------------------------------------
629 // wxPropertyGridPageState splitter, column and hittest functions
630 // -----------------------------------------------------------------------
632 wxPGProperty
* wxPropertyGridPageState
::DoGetItemAtY( int y
) const
636 return (wxPGProperty
*) NULL
;
639 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
642 // -----------------------------------------------------------------------
644 wxPropertyGridHitTestResult wxPropertyGridPageState
::HitTest( const wxPoint
&pt
) const
646 wxPropertyGridHitTestResult result
;
647 result
.column
= HitTestH( pt
.x
, &result
.splitter
, &result
.splitterHitOffset
);
648 result
.property
= DoGetItemAtY( pt
.y
);
652 // -----------------------------------------------------------------------
654 // Used by SetSplitterLeft() and DotFitColumns()
655 int wxPropertyGridPageState
::GetColumnFitWidth(wxClientDC
& dc
,
660 wxPropertyGrid
* pg
= m_pPropGrid
;
665 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
667 wxPGProperty
* p
= pwc
->Item(i
);
668 if ( !p
->IsCategory() )
670 dc
.GetTextExtent( p
->GetColumnText(col
), &w
, &h
);
672 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
675 // TODO: Add bitmap support.
677 w
+= (wxPG_XBEFORETEXT
*2);
683 if ( p
->GetChildCount() &&
684 ( subProps
|| p
->IsCategory() ) )
686 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
696 int wxPropertyGridPageState
::DoGetSplitterPosition( int splitterColumn
) const
698 int n
= GetGrid()->m_marginWidth
;
700 for ( i
=0; i
<=splitterColumn
; i
++ )
705 int wxPropertyGridPageState
::GetColumnMinWidth( int WXUNUSED(column
) ) const
707 return wxPG_DRAG_MARGIN
;
710 void wxPropertyGridPageState
::PropagateColSizeDec( int column
, int decrease
, int dir
)
712 int origWidth
= m_colWidths
[column
];
713 m_colWidths
[column
] -= decrease
;
714 int min
= GetColumnMinWidth(column
);
716 if ( m_colWidths
[column
] < min
)
718 more
= decrease
- (origWidth
- min
);
719 m_colWidths
[column
] = min
;
723 // FIXME: Causes erratic splitter changing, so as a workaround
724 // disabled if two or less columns.
726 if ( m_colWidths
.size() <= 2 )
730 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
731 PropagateColSizeDec( column
, more
, dir
);
734 void wxPropertyGridPageState
::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
736 wxPropertyGrid
* pg
= GetGrid();
738 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
740 if ( !pg
->HasVirtualWidth() )
746 otherColumn
= splitterColumn
+ 1;
747 if ( otherColumn
== (int)m_colWidths
.size() )
749 m_colWidths
[splitterColumn
] += adjust
;
750 PropagateColSizeDec( otherColumn
, adjust
, 1 );
754 otherColumn
= splitterColumn
+ 1;
755 if ( otherColumn
== (int)m_colWidths
.size() )
757 m_colWidths
[otherColumn
] -= adjust
;
758 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
763 m_colWidths
[splitterColumn
] += adjust
;
766 if ( splitterColumn
== 0 )
767 m_fSplitterX
= (double) newXPos
;
769 if ( !fromAutoCenter
)
771 // Don't allow initial splitter auto-positioning after this.
772 if ( pg
->GetState() == this )
773 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
779 // Moves splitter so that all labels are visible, but just.
780 void wxPropertyGridPageState
::SetSplitterLeft( bool subProps
)
782 wxPropertyGrid
* pg
= GetGrid();
784 dc
.SetFont(pg
->m_font
);
786 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
790 maxW
+= pg
->m_marginWidth
;
791 DoSetSplitterPosition( maxW
);
794 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
797 wxSize wxPropertyGridPageState
::DoFitColumns( bool WXUNUSED(allowGridResize
) )
799 wxPropertyGrid
* pg
= GetGrid();
801 dc
.SetFont(pg
->m_font
);
803 int marginWidth
= pg
->m_marginWidth
;
804 int accWid
= marginWidth
;
805 int maxColWidth
= 500;
807 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
809 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
810 int colMinWidth
= GetColumnMinWidth(col
);
811 if ( fitWid
< colMinWidth
)
812 fitWid
= colMinWidth
;
813 else if ( fitWid
> maxColWidth
)
814 fitWid
= maxColWidth
;
816 m_colWidths
[col
] = fitWid
;
821 // Expand last one to fill the width
822 int remaining
= m_width
- accWid
;
823 m_colWidths
[GetColumnCount()-1] += remaining
;
825 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
827 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
828 m_fSplitterX
= (double) firstSplitterX
;
830 // Don't allow initial splitter auto-positioning after this.
831 if ( pg
->GetState() == this )
833 pg
->SetSplitterPosition(firstSplitterX
, false);
838 pg
->GetVirtualSize(&x
, &y
);
840 return wxSize(accWid
, y
);
843 void wxPropertyGridPageState
::CheckColumnWidths( int widthChange
)
848 wxPropertyGrid
* pg
= GetGrid();
851 const bool debug
= false;
855 unsigned int lastColumn
= m_colWidths
.size() - 1;
857 int clientWidth
= pg
->GetClientSize().x
;
860 // Column to reduce, if needed. Take last one that exceeds minimum width.
861 // Except if auto splitter centering is used, in which case use widest.
863 int highestColWidth
= 0;
865 bool minimizedCols
= false;
869 wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width
, clientWidth
);
874 for ( i
=0; i
<m_colWidths
.size(); i
++ )
876 int min
= GetColumnMinWidth(i
);
877 if ( m_colWidths
[i
] <= min
)
879 m_colWidths
[i
] = min
;
880 minimizedCols
= true;
884 if ( pg
->HasFlag(wxPG_SPLITTER_AUTO_CENTER
) )
886 if ( m_colWidths
[i
] >= highestColWidth
)
888 highestColWidth
= m_colWidths
[i
];
899 int colsWidth
= pg
->m_marginWidth
;
900 for ( i
=0; i
<m_colWidths
.size(); i
++ )
901 colsWidth
+= m_colWidths
[i
];
905 wxLogDebug(wxT(" HasVirtualWidth: %i colsWidth: %i"),(int)pg
->HasVirtualWidth(),colsWidth
);
908 // Then mode-based requirement
909 if ( !pg
->HasVirtualWidth() )
911 int widthHigher
= width
- colsWidth
;
913 // Adapt colsWidth to width
914 if ( colsWidth
< width
)
919 wxLogDebug(wxT(" Adjust last column to %i"), m_colWidths
[lastColumn
] + widthHigher
);
921 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
923 else if ( colsWidth
> width
)
926 if ( reduceCol
!= -1 )
930 wxLogDebug(wxT(" Reduce column %i (by %i)"), reduceCol
, -widthHigher
);
932 // Reduce widest column, and recheck
933 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
940 // Only check colsWidth against clientWidth
941 if ( colsWidth
< clientWidth
)
943 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
948 // If width changed, recalculate virtual size
949 if ( pg
->GetState() == this )
950 pg
->RecalculateVirtualSize();
955 for ( i
=0; i
<m_colWidths
.size(); i
++ )
956 wxLogDebug(wxT("col%i: %i"),i
,m_colWidths
[i
]);
959 // Auto center splitter
960 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
961 m_colWidths
.size() == 2 )
963 float centerX
= (float)(pg
->m_width
/2);
966 if ( m_fSplitterX
< 0.0 )
970 else if ( widthChange
)
972 //float centerX = float(pg->GetSize().x) * 0.5;
975 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
976 float deviation
= fabs(centerX
- splitterX
);
978 // If deviating from center, adjust towards it
979 if ( deviation
> 20.0 )
981 if ( splitterX
> centerX
)
989 // No width change, just keep sure we keep splitter position intact
990 splitterX
= m_fSplitterX
;
991 float deviation
= fabs(centerX
- splitterX
);
992 if ( deviation
> 50.0 )
998 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1000 m_fSplitterX
= splitterX
; // needed to retain accuracy
1004 void wxPropertyGridPageState
::SetColumnCount( int colCount
)
1006 wxASSERT( colCount
>= 2 );
1007 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1008 if ( m_colWidths
.size() > (unsigned int)colCount
)
1009 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1011 if ( m_pPropGrid
->GetState() == this )
1012 m_pPropGrid
->RecalculateVirtualSize();
1014 CheckColumnWidths();
1017 // Returns column index, -1 for margin
1018 int wxPropertyGridPageState
::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1020 int cx
= GetGrid()->m_marginWidth
;
1022 int prevSplitter
= -1;
1027 if ( col
>= (int)m_colWidths
.size() )
1033 cx
+= m_colWidths
[col
];
1036 // Near prev. splitter
1039 int diff
= x
- prevSplitter
;
1040 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1042 *pSplitterHit
= col
- 1;
1043 *pSplitterHitOffset
= diff
;
1048 // Near next splitter
1049 int nextSplitter
= cx
;
1050 if ( col
< (int)(m_colWidths
.size()-1) )
1052 int diff
= x
- nextSplitter
;
1053 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1055 *pSplitterHit
= col
;
1056 *pSplitterHitOffset
= diff
;
1065 // -----------------------------------------------------------------------
1066 // wxPropertyGridPageState property value setting and getting
1067 // -----------------------------------------------------------------------
1069 bool wxPropertyGridPageState
::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1073 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
;
1075 wxVariant variant
= p
->GetValueRef();
1078 if ( p
->GetMaxLength() <= 0 )
1079 res
= p
->StringToValue( variant
, value
, flags
);
1081 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1085 p
->SetValue(variant
);
1086 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1087 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1095 // -----------------------------------------------------------------------
1097 bool wxPropertyGridPageState
::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1102 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1103 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1110 // -----------------------------------------------------------------------
1112 bool wxPropertyGridPageState
::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1116 // wnd_primary has to be given so the control can be updated as well.
1118 DoSetPropertyValue(p
, v
);
1124 // -----------------------------------------------------------------------
1126 void wxPropertyGridPageState
::DoSetPropertyValueUnspecified( wxPGProperty
* p
)
1128 wxCHECK_RET( p
, wxT("invalid property id") );
1130 if ( !p
->IsValueUnspecified() )
1132 // Value should be set first - editor class methods may need it
1133 p
->m_value
.MakeNull();
1135 wxASSERT( m_pPropGrid
);
1137 if ( m_pPropGrid
->GetState() == this )
1139 if ( m_pPropGrid
->m_selected
== p
&& m_pPropGrid
->m_wndEditor
)
1141 p
->GetEditorClass()->SetValueToUnspecified(p
, m_pPropGrid
->GetEditorControl());
1146 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1147 DoSetPropertyValueUnspecified( p
->Item(i
) );
1151 // -----------------------------------------------------------------------
1152 // wxPropertyGridPageState property operations
1153 // -----------------------------------------------------------------------
1155 bool wxPropertyGridPageState
::DoCollapse( wxPGProperty
* p
)
1157 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1159 if ( !p
->GetChildCount() ) return false;
1161 if ( !p
->IsExpanded() ) return false;
1163 p
->SetExpanded(false);
1165 VirtualHeightChanged();
1170 // -----------------------------------------------------------------------
1172 bool wxPropertyGridPageState
::DoExpand( wxPGProperty
* p
)
1174 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1176 if ( !p
->GetChildCount() ) return false;
1178 if ( p
->IsExpanded() ) return false;
1180 p
->SetExpanded(true);
1182 VirtualHeightChanged();
1187 // -----------------------------------------------------------------------
1189 bool wxPropertyGridPageState
::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1191 if ( this == m_pPropGrid
->GetState() )
1192 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1198 // -----------------------------------------------------------------------
1200 bool wxPropertyGridPageState
::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1203 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1205 p
->SetFlag( wxPG_PROP_HIDDEN
);
1207 if ( flags
& wxPG_RECURSE
)
1210 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1211 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1214 VirtualHeightChanged();
1219 // -----------------------------------------------------------------------
1221 bool wxPropertyGridPageState
::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1227 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1232 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1236 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1241 p
->m_flags
|= wxPG_PROP_DISABLED
;
1245 // Apply same to sub-properties as well
1247 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1248 DoEnableProperty( p
->Item(i
), enable
);
1255 // -----------------------------------------------------------------------
1256 // wxPropertyGridPageState wxVariant related routines
1257 // -----------------------------------------------------------------------
1259 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1260 // Never includes sub-properties (unless they are parented by wxParentProperty).
1261 wxVariant wxPropertyGridPageState
::DoGetPropertyValues( const wxString
& listname
,
1262 wxPGProperty
* baseparent
,
1265 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1267 // Root is the default base-parent.
1271 wxVariantList tempList
;
1272 wxVariant
v( tempList
, listname
);
1274 if ( pwc
->GetChildCount() )
1276 if ( flags
& wxPG_KEEP_STRUCTURE
)
1278 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1281 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1283 wxPGProperty
* p
= pwc
->Item(i
);
1284 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1286 wxVariant variant
= p
->GetValue();
1287 variant
.SetName( p
->GetBaseName() );
1288 v
.Append( variant
);
1292 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1294 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1295 v
.Append( p
->GetAttributesAsList() );
1300 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1301 it
.SetBaseParent( pwc
);
1303 for ( ; !it
.AtEnd(); it
.Next() )
1305 const wxPGProperty
* p
= it
.GetProperty();
1307 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1308 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1310 wxVariant variant
= p
->GetValue();
1311 variant
.SetName( p
->GetName() );
1312 v
.Append( variant
);
1313 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1314 v
.Append( p
->GetAttributesAsList() );
1323 // -----------------------------------------------------------------------
1325 void wxPropertyGridPageState
::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1327 unsigned char origFrozen
= 1;
1329 if ( m_pPropGrid
->GetState() == this )
1331 origFrozen
= m_pPropGrid
->m_frozen
;
1332 if ( !origFrozen
) m_pPropGrid
->Freeze();
1335 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1337 if ( !use_category
)
1338 use_category
= (wxPropertyCategory
*)m_properties
;
1340 // Let's iterate over the list of variants.
1341 wxVariantList
::const_iterator node
;
1342 int numSpecialEntries
= 0;
1345 // Second pass for special entries
1346 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1348 wxVariant
*current
= (wxVariant
*)*node
;
1350 // Make sure it is wxVariant.
1351 wxASSERT( current
);
1352 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1354 const wxString
& name
= current
->GetName();
1355 if ( name
.length() > 0 )
1358 // '@' signified a special entry
1359 if ( name
[0] == wxS('@') )
1361 numSpecialEntries
++;
1365 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1368 wxPGProperty
* p
= foundProp
;
1370 // If it was a list, we still have to go through it.
1371 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1373 DoSetPropertyValues( current
->GetList(),
1374 p
->IsCategory()?p
:((wxPGProperty
*)NULL
)
1380 if ( wxStrcmp(current
->GetType(), p
->GetValue().GetType()) != 0)
1382 wxLogDebug(wxT("wxPropertyGridPageState::DoSetPropertyValues Warning: Setting value of property \"%s\" from variant"),
1383 p
->GetName().c_str());
1387 p
->SetValue(*current
);
1393 if ( current
->GetType() != wxS("list") )
1399 // Yes, it is; create a sub category and append contents there.
1400 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1401 DoSetPropertyValues( current
->GetList(), newCat
);
1408 if ( numSpecialEntries
)
1410 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1412 wxVariant
*current
= (wxVariant
*)*node
;
1414 const wxString
& name
= current
->GetName();
1415 if ( name
.length() > 0 )
1418 // '@' signified a special entry
1419 if ( name
[0] == wxS('@') )
1421 numSpecialEntries
--;
1423 size_t pos2
= name
.rfind(wxS('@'));
1424 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1426 wxString propName
= name
.substr(1, pos2
-1);
1427 wxString entryType
= name
.substr(pos2
+1, wxString
::npos
);
1429 if ( entryType
== wxS("attr") )
1432 // List of attributes
1433 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1436 wxASSERT( current
->GetType() == wxPG_VARIANT_TYPE_LIST
);
1438 wxVariantList
& list2
= current
->GetList();
1439 wxVariantList
::const_iterator node2
;
1441 for ( node2
= list2
.begin(); node2
!= list2
.end(); node2
++ )
1443 wxVariant
*attr
= (wxVariant
*)*node2
;
1444 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1449 // ERROR: No such property: 'propName'
1455 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1460 if ( !numSpecialEntries
)
1467 m_pPropGrid
->Thaw();
1469 if ( this == m_pPropGrid
->GetState() )
1471 m_selected
->UpdateControl(m_pPropGrid
->GetEditorControl());
1477 // -----------------------------------------------------------------------
1478 // wxPropertyGridPageState property adding and removal
1479 // -----------------------------------------------------------------------
1481 int wxPropertyGridPageState
::PrepareToAddItem( wxPGProperty
* property
,
1482 wxPGProperty
* scheduledParent
)
1484 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1486 // This will allow better behavior.
1487 if ( scheduledParent
== m_properties
)
1488 scheduledParent
= (wxPGProperty
*) NULL
;
1490 if ( scheduledParent
&& !scheduledParent
->IsCategory() )
1492 wxASSERT_MSG( property
->GetBaseName().length(),
1493 "Property's children must have unique, non-empty names within their scope" );
1496 property
->m_parentState
= this;
1498 if ( property
->IsCategory() )
1501 // Parent of a category must be either root or another category
1502 // (otherwise Bad Things might happen).
1503 wxASSERT_MSG( scheduledParent
== NULL
||
1504 scheduledParent
== m_properties
||
1505 scheduledParent
->IsCategory(),
1506 wxT("Parent of a category must be either root or another category."));
1508 // If we already have category with same name, delete given property
1509 // and use it instead as most recent caption item.
1510 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1513 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1514 if ( pwc
->IsCategory() ) // Must be a category.
1517 m_currentCategory
= pwc
;
1518 return 2; // Tells the caller what we did.
1524 // Warn for identical names in debug mode.
1525 if ( BaseGetPropertyByName(property
->GetName()) &&
1526 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1528 wxLogError(wxT("wxPropertyGrid: Warning - item with name \"%s\" already exists."),
1529 property
->GetName().c_str());
1530 wxPGGlobalVars
->m_warnings
++;
1534 // Make sure nothing is selected.
1535 if ( propGrid
&& propGrid
->m_selected
)
1537 bool selRes
= propGrid
->ClearSelection();
1538 wxPG_CHECK_MSG_DBG( selRes
,
1540 wxT("failed to deselect a property (editor probably had invalid value)") );
1543 if ( scheduledParent
)
1545 // Use parent's colours.
1546 property
->m_bgColIndex
= scheduledParent
->m_bgColIndex
;
1547 property
->m_fgColIndex
= scheduledParent
->m_fgColIndex
;
1549 // Fix no parent does not yet have parenting flag yet, set one now
1550 if ( !scheduledParent
->HasFlag(wxPG_PROP_PARENTAL_FLAGS
) )
1551 scheduledParent
->SetParentalType(wxPG_PROP_MISC_PARENT
);
1552 //scheduledParent->SetFlag(wxPG_PROP_MISC_PARENT);
1555 // If in hideable adding mode, or if assigned parent is hideable, then
1556 // make this one hideable.
1558 ( scheduledParent
&& (scheduledParent
->m_flags
& wxPG_PROP_HIDDEN
) ) ||
1559 ( propGrid
&& (propGrid
->m_iFlags
& wxPG_FL_ADDING_HIDEABLES
) )
1561 property
->SetFlag( wxPG_PROP_HIDDEN
);
1563 // Set custom image flag.
1564 int custImgHeight
= property
->OnMeasureImage().y
;
1565 if ( custImgHeight
< 0 /*|| custImgHeight > 1*/ )
1567 property
->m_flags
|= wxPG_PROP_CUSTOMIMAGE
;
1570 if ( propGrid
&& (propGrid
->GetWindowStyleFlag() & wxPG_LIMITED_EDITING
) )
1571 property
->m_flags
|= wxPG_PROP_NOEDITOR
;
1573 if ( !property
->IsCategory() )
1575 // This is not a category.
1577 //wxASSERT_MSG( property->GetEditorClass(), wxT("Editor class not initialized!") );
1581 unsigned char depth
= 1;
1582 if ( scheduledParent
)
1584 depth
= scheduledParent
->m_depth
;
1585 if ( !scheduledParent
->IsCategory() )
1588 property
->m_depth
= depth
;
1589 unsigned char greyDepth
= depth
;
1591 if ( scheduledParent
)
1593 wxPropertyCategory
* pc
;
1595 if ( scheduledParent
->IsCategory() || scheduledParent
->IsRoot() )
1596 pc
= (wxPropertyCategory
*)scheduledParent
;
1598 // This conditional compile is necessary to
1599 // bypass some compiler bug.
1600 pc
= GetPropertyCategory(scheduledParent
);
1603 greyDepth
= pc
->GetDepth();
1605 greyDepth
= scheduledParent
->m_depthBgCol
;
1608 property
->m_depthBgCol
= greyDepth
;
1610 // Prepare children pre-added children
1611 if ( property
->GetChildCount() )
1613 property
->SetParentalType(wxPG_PROP_AGGREGATE
);
1615 property
->SetExpanded(false); // Properties with children are not expanded by default.
1616 if ( propGrid
&& propGrid
->GetWindowStyleFlag() & wxPG_HIDE_MARGIN
)
1617 property
->SetExpanded(true); // ...unless it cannot be expanded.
1619 property
->PrepareSubProperties();
1624 if ( propGrid
&& (propGrid
->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES
) )
1625 property
->SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED
, true);
1631 // This is a category.
1634 unsigned char depth
= 1;
1635 if ( scheduledParent
)
1637 depth
= scheduledParent
->m_depth
+ 1;
1639 property
->m_depth
= depth
;
1640 property
->m_depthBgCol
= depth
;
1642 m_currentCategory
= (wxPropertyCategory
*)property
;
1644 wxPropertyCategory
* pc
= (wxPropertyCategory
*)property
;
1646 // Calculate text extent for caption item.
1648 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1654 // -----------------------------------------------------------------------
1656 wxPGProperty
* wxPropertyGridPageState
::DoAppend( wxPGProperty
* property
)
1658 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1659 if ( property
->IsCategory() )
1660 cur_cat
= (wxPropertyCategory
*) NULL
;
1662 return DoInsert( cur_cat
, -1, property
);
1665 // -----------------------------------------------------------------------
1667 wxPGProperty
* wxPropertyGridPageState
::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1670 parent
= m_properties
;
1672 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1674 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1676 int parenting
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1678 // This type of invalid parenting value indicates we should exit now, returning
1679 // id of most recent category.
1680 if ( parenting
> 1 )
1681 return m_currentCategory
;
1683 // Note that item must be added into current mode later.
1685 // If parent is wxParentProperty, just stick it in...
1686 // If parent is root (m_properties), then...
1687 // In categoric mode: Add as last item in m_abcArray (if not category).
1688 // Add to given index in m_regularArray.
1689 // In non-cat mode: Add as last item in m_regularArray.
1690 // Add to given index in m_abcArray.
1691 // If parent is category, then...
1692 // 1) Add to given category in given index.
1693 // 2) Add as last item in m_abcArray.
1695 if ( !parent
->IsCategory() && !parent
->IsRoot() )
1697 // Parent is wxParentingProperty: Just stick it in...
1698 parent
->AddChild2( property
, index
);
1702 // Parent is Category or Root.
1704 if ( m_properties
== &m_regularArray
)
1708 // Only add non-categories to m_abcArray.
1709 if ( m_abcArray
&& parenting
<= 0 )
1710 m_abcArray
->AddChild2( property
, -1, false );
1712 // Add to current mode.
1713 parent
->AddChild2( property
, index
);
1718 // Non-categorized mode.
1720 if ( parent
!= m_properties
)
1721 // Parent is category.
1722 parent
->AddChild2( property
, index
, false );
1725 m_regularArray
.AddChild2( property
, -1, false );
1727 // Add to current mode (no categories).
1728 if ( parenting
<= 0 )
1729 m_abcArray
->AddChild2( property
, index
);
1734 if ( property
->IsCategory() )
1736 // This is a category caption item.
1738 // Last caption is not the bottom one (this info required by append)
1739 m_lastCaptionBottomnest
= 0;
1742 // Only add name to hashmap if parent is root or category
1743 if ( (parent
->IsCategory() || parent
->IsRoot()) && property
->m_name
.length() )
1744 m_dictName
[property
->m_name
] = (void*) property
;
1746 VirtualHeightChanged();
1748 property
->UpdateParentValues();
1755 // -----------------------------------------------------------------------
1757 void wxPropertyGridPageState
::DoDelete( wxPGProperty
* item
)
1759 wxCHECK_RET( item
->GetParent(),
1760 wxT("this property was already deleted") );
1762 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1763 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1766 unsigned int indinparent
= item
->GetIndexInParent();
1768 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1770 wxCHECK_RET( !item
->GetParent()->HasFlag(wxPG_PROP_AGGREGATE
),
1771 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1773 if ( item
->IsCategory() )
1775 // deleting a category
1777 // erase category entries from the hash table
1778 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1780 wxPGProperty
* sp
= pwc
->Item( i
);
1781 if ( sp
->GetBaseName().Len() ) m_dictName
.erase(sp
->GetBaseName());
1784 if ( pwc
== m_currentCategory
)
1785 m_currentCategory
= (wxPropertyCategory
*) NULL
;
1789 // Remove children from non-categorized array.
1790 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1792 wxPGProperty
* p
= pwc
->Item( i
);
1793 wxASSERT( p
!= NULL
);
1794 if ( !p
->IsCategory() )
1795 m_abcArray
->m_children
.Remove( p
);
1798 if ( IsInNonCatMode() )
1799 m_abcArray
->FixIndexesOfChildren();
1803 if ( !IsInNonCatMode() )
1805 // categorized mode - non-categorized array
1807 // Remove from non-cat array, but only if parent is in it
1808 if ( !item
->IsCategory() && item
->GetParent()->IsCategory() )
1812 m_abcArray
->m_children
.Remove( item
);
1816 // categorized mode - categorized array
1817 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1818 item
->m_parent
->FixIndexesOfChildren(/*indinparent*/);
1822 // non-categorized mode - categorized array
1824 // We need to find location of item.
1825 wxPGProperty
* cat_parent
= &m_regularArray
;
1826 int cat_index
= m_regularArray
.GetChildCount();
1828 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1830 wxPGProperty
* p
= m_regularArray
.Item(i
);
1831 if ( p
== item
) { cat_index
= i
; break; }
1832 if ( p
->IsCategory() )
1834 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1835 if ( subind
!= wxNOT_FOUND
)
1837 cat_parent
= ((wxPGProperty
*)p
);
1843 cat_parent
->m_children
.RemoveAt(cat_index
);
1845 // non-categorized mode - non-categorized array
1846 if ( !item
->IsCategory() )
1848 wxASSERT( item
->m_parent
== m_abcArray
);
1849 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1850 item
->m_parent
->FixIndexesOfChildren(indinparent
);
1854 if ( item
->GetBaseName().Len() ) m_dictName
.erase(item
->GetBaseName());
1856 // We can actually delete it now
1859 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1861 VirtualHeightChanged();
1864 // -----------------------------------------------------------------------
1866 #endif // wxUSE_PROPGRID