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"
21 #include "wx/object.h"
23 #include "wx/string.h"
26 #include "wx/window.h"
29 #include "wx/dcmemory.h"
30 #include "wx/button.h"
33 #include "wx/cursor.h"
34 #include "wx/dialog.h"
35 #include "wx/settings.h"
36 #include "wx/msgdlg.h"
37 #include "wx/choice.h"
38 #include "wx/stattext.h"
39 #include "wx/scrolwin.h"
40 #include "wx/dirdlg.h"
41 #include "wx/layout.h"
43 #include "wx/textdlg.h"
44 #include "wx/filedlg.h"
45 #include "wx/statusbr.h"
50 // This define is necessary to prevent macro clearing
51 #define __wxPG_SOURCE_FILE__
53 #include <wx/propgrid/propgridpagestate.h>
54 #include <wx/propgrid/propgrid.h>
55 #include <wx/propgrid/editors.h>
58 #define wxPG_DEFAULT_SPLITTERX 110
61 // -----------------------------------------------------------------------
62 // wxPropertyGridIterator
63 // -----------------------------------------------------------------------
65 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, wxPGProperty
* property
, int dir
)
67 wxASSERT( dir
== 1 || dir
== -1 );
70 m_baseParent
= state
->DoGetRoot();
71 if ( !property
&& m_baseParent
->GetChildCount() )
72 property
= m_baseParent
->Item(0);
74 m_property
= property
;
76 wxPG_ITERATOR_CREATE_MASKS(flags
, m_itemExMask
, m_parentExMask
)
78 // Need to skip first?
79 if ( property
&& (property
->GetFlags() & m_itemExMask
) )
88 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, int startPos
, int dir
)
90 wxPGProperty
* property
;
92 if ( startPos
== wxTOP
)
98 else if ( startPos
== wxBOTTOM
)
100 property
= state
->GetLastItem(flags
);
106 wxASSERT_MSG( false, wxT("Only supported stating positions are wxTOP and wxBOTTOM") );
110 Init( state
, flags
, property
, dir
);
113 void wxPropertyGridIteratorBase::Assign( const wxPropertyGridIteratorBase
& it
)
115 m_property
= it
.m_property
;
116 m_state
= it
.m_state
;
117 m_baseParent
= it
.m_baseParent
;
118 m_itemExMask
= it
.m_itemExMask
;
119 m_parentExMask
= it
.m_parentExMask
;
122 void wxPropertyGridIteratorBase::Prev()
124 wxPGProperty
* property
= m_property
;
125 wxASSERT( property
);
127 wxPGProperty
* parent
= property
->GetParent();
129 unsigned int index
= property
->GetIndexInParent();
136 property
= parent
->Item(index
);
138 // Go to last children?
139 if ( property
->GetChildCount() &&
140 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) )
143 property
= property
->Last();
149 if ( parent
== m_baseParent
)
160 m_property
= property
;
162 // If property does not match our criteria, skip it
163 if ( property
->GetFlags() & m_itemExMask
)
167 void wxPropertyGridIteratorBase::Next( bool iterateChildren
)
169 wxPGProperty
* property
= m_property
;
170 wxASSERT( property
);
172 if ( property
->GetChildCount() &&
173 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) &&
177 property
= property
->Item(0);
181 wxPGProperty
* parent
= property
->GetParent();
183 unsigned int index
= property
->GetIndexInParent() + 1;
185 if ( index
< parent
->GetChildCount() )
188 property
= parent
->Item(index
);
192 // Next sibling of parent
193 if ( parent
== m_baseParent
)
206 m_property
= property
;
208 // If property does not match our criteria, skip it
209 if ( property
->GetFlags() & m_itemExMask
)
213 // -----------------------------------------------------------------------
214 // wxPropertyGridPageState
215 // -----------------------------------------------------------------------
217 wxPropertyGridPageState::wxPropertyGridPageState()
219 m_pPropGrid
= (wxPropertyGrid
*) NULL
;
220 m_regularArray
.SetParentState(this);
221 m_properties
= &m_regularArray
;
222 m_abcArray
= (wxPGRootProperty
*) NULL
;
223 m_currentCategory
= (wxPropertyCategory
*) NULL
;
224 m_selected
= (wxPGProperty
*) NULL
;
227 m_lastCaptionBottomnest
= 1;
231 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
232 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
233 m_fSplitterX
= wxPG_DEFAULT_SPLITTERX
;
236 // -----------------------------------------------------------------------
238 wxPropertyGridPageState::~wxPropertyGridPageState()
243 // -----------------------------------------------------------------------
245 void wxPropertyGridPageState::InitNonCatMode()
249 m_abcArray
= new wxPGRootProperty();
250 m_abcArray
->SetParentState(this);
251 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
254 // Must be called when state::m_properties still points to regularArray.
255 wxPGProperty
* oldProperties
= m_properties
;
257 // Must use temp value in state::m_properties for item iteration loop
258 // to run as expected.
259 m_properties
= &m_regularArray
;
261 if ( m_properties
->GetChildCount() )
264 wxPropertyGridIterator
it( this, wxPG_ITERATE_DEFAULT
|wxPG_ITERATE_CATEGORIES
);
266 for ( ; !it
.AtEnd(); it
.Next() )
268 wxPGProperty
* p
= it
.GetProperty();
269 wxPGProperty
* parent
= p
->GetParent();
270 if ( p
->HasFlag(wxPG_PROP_MISC_PARENT
) &&
271 ( parent
== m_properties
|| (parent
->IsCategory() || parent
->IsRoot()) ) )
273 m_abcArray
->AddChild2( p
);
274 p
->m_parent
= &m_regularArray
;
279 m_properties
= oldProperties
;
282 // -----------------------------------------------------------------------
284 void wxPropertyGridPageState::DoClear()
286 m_regularArray
.Empty();
292 m_currentCategory
= (wxPropertyCategory
*) NULL
;
293 m_lastCaptionBottomnest
= 1;
299 m_selected
= (wxPGProperty
*) NULL
;
302 // -----------------------------------------------------------------------
304 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
306 wxPropertyGrid
* propGrid
= GetGrid();
308 VirtualHeightChanged();
310 // Recalculate caption text extents.
313 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
315 wxPGProperty
* p
=m_regularArray
.Item(i
);
317 if ( p
->IsCategory() )
318 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
322 // -----------------------------------------------------------------------
324 void wxPropertyGridPageState::SetVirtualWidth( int width
)
326 wxASSERT( width
>= 0 );
327 wxPropertyGrid
* pg
= GetGrid();
328 int gw
= pg
->GetClientSize().x
;
335 // -----------------------------------------------------------------------
337 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
339 wxPropertyGrid
* pg
= GetGrid();
341 if ( pg
->HasVirtualWidth() )
343 if ( m_width
< newWidth
)
344 SetVirtualWidth( newWidth
);
346 CheckColumnWidths(widthChange
);
350 SetVirtualWidth( newWidth
);
352 // This should be done before splitter auto centering
353 // NOTE: Splitter auto-centering is done in this function.
356 CheckColumnWidths(widthChange
);
358 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
359 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
361 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
363 // If too long, don't set splitter
364 if ( timeSinceCreation
< 3000 )
366 if ( m_properties
->GetChildCount() || timeSinceCreation
> 750 )
368 SetSplitterLeft( false );
372 DoSetSplitterPosition( newWidth
/ 2 );
373 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
380 // -----------------------------------------------------------------------
381 // wxPropertyGridPageState item iteration methods
382 // -----------------------------------------------------------------------
384 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
386 if ( !m_properties
->GetChildCount() )
387 return (wxPGProperty
*) NULL
;
389 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
391 // First, get last child of last parent
392 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
393 while ( pwc
->GetChildCount() &&
394 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
395 pwc
= (wxPGProperty
*) pwc
->Last();
397 // Then, if it doesn't fit our criteria, back up until we find something that does
398 if ( pwc
->GetFlags() & itemExMask
)
400 wxPropertyGridIterator
it( this, flags
, pwc
);
401 for ( ; !it
.AtEnd(); it
.Prev() );
402 pwc
= (wxPGProperty
*) it
.GetProperty();
408 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
410 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
411 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
414 parent
= grandparent
;
415 grandparent
= (wxPGProperty
*)parent
->GetParent();
416 if ( parent
->IsCategory() && grandparent
)
417 return (wxPropertyCategory
*)parent
;
418 } while ( grandparent
);
420 return (wxPropertyCategory
*) NULL
;
423 // -----------------------------------------------------------------------
424 // wxPropertyGridPageState GetPropertyXXX methods
425 // -----------------------------------------------------------------------
427 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
428 wxPGProperty
* parent
) const
433 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
435 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
437 wxPGProperty
* p
= parent
->Item(i
);
438 if ( p
->m_label
== label
)
440 // Check children recursively.
441 if ( p
->GetChildCount() )
443 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
452 // -----------------------------------------------------------------------
454 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
456 wxPGHashMapS2P::const_iterator it
;
457 it
= m_dictName
.find(name
);
458 if ( it
!= m_dictName
.end() )
459 return (wxPGProperty
*) it
->second
;
460 return (wxPGProperty
*) NULL
;
463 // -----------------------------------------------------------------------
464 // wxPropertyGridPageState global operations
465 // -----------------------------------------------------------------------
467 // -----------------------------------------------------------------------
468 // Item iteration macros
469 // NB: Nowadays only needed for alphabetic/categoric mode switching.
470 // -----------------------------------------------------------------------
472 #define II_INVALID_I 0x00FFFFFF
474 #define ITEM_ITERATION_VARIABLES \
475 wxPGProperty* parent; \
479 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
480 parent = m_properties; \
483 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
484 parent = startparent; \
485 i = (unsigned int)startindex; \
486 if ( parent == (wxPGProperty*) NULL ) \
488 parent = state->m_properties; \
492 #define ITEM_ITERATION_LOOP_BEGIN \
495 iMax = parent->GetChildCount(); \
498 wxPGProperty* p = parent->Item(i);
500 #define ITEM_ITERATION_LOOP_END \
501 if ( p->GetChildCount() ) \
504 parent = (wxPGProperty*)p; \
505 iMax = parent->GetChildCount(); \
510 i = parent->m_arrIndex + 1; \
511 parent = parent->m_parent; \
513 while ( parent != NULL );
515 bool wxPropertyGridPageState::EnableCategories( bool enable
)
518 // NB: We can't use wxPropertyGridIterator in this
519 // function, since it depends on m_arrIndexes,
520 // which, among other things, is being fixed here.
522 ITEM_ITERATION_VARIABLES
530 if ( !IsInNonCatMode() )
533 m_properties
= &m_regularArray
;
535 // fix parents, indexes, and depths
536 ITEM_ITERATION_INIT_FROM_THE_TOP
538 ITEM_ITERATION_LOOP_BEGIN
542 p
->m_parent
= parent
;
544 // If parent was category, and this is not,
545 // then the depth stays the same.
546 if ( parent
->IsCategory() &&
548 p
->m_depth
= parent
->m_depth
;
550 p
->m_depth
= parent
->m_depth
+ 1;
552 ITEM_ITERATION_LOOP_END
558 // Disable categories
561 if ( IsInNonCatMode() )
564 // Create array, if necessary.
568 m_properties
= m_abcArray
;
570 // fix parents, indexes, and depths
571 ITEM_ITERATION_INIT_FROM_THE_TOP
573 ITEM_ITERATION_LOOP_BEGIN
577 p
->m_parent
= parent
;
579 p
->m_depth
= parent
->m_depth
+ 1;
581 ITEM_ITERATION_LOOP_END
584 VirtualHeightChanged();
586 if ( m_pPropGrid
->GetState() == this )
587 m_pPropGrid
->RecalculateVirtualSize();
592 // -----------------------------------------------------------------------
594 static int wxPG_SortFunc(void **p1
, void **p2
)
596 wxPGProperty
*pp1
= *((wxPGProperty
**)p1
);
597 wxPGProperty
*pp2
= *((wxPGProperty
**)p2
);
598 return pp1
->GetLabel().compare( pp2
->GetLabel() );
601 void wxPropertyGridPageState::SortChildren( wxPGProperty
* p
)
604 p
= (wxPGProperty
*)m_properties
;
606 if ( !p
->GetChildCount() )
609 wxPGProperty
* pwc
= (wxPGProperty
*)p
;
611 // Can only sort items with children
612 if ( pwc
->GetChildCount() < 1 )
615 pwc
->m_children
.Sort( wxPG_SortFunc
);
618 pwc
->FixIndexesOfChildren();
622 // -----------------------------------------------------------------------
624 void wxPropertyGridPageState::Sort()
626 SortChildren( m_properties
);
628 // Sort categories as well
629 if ( !IsInNonCatMode() )
632 for ( i
=0;i
<m_properties
->GetChildCount();i
++)
634 wxPGProperty
* p
= m_properties
->Item(i
);
635 if ( p
->IsCategory() )
641 // -----------------------------------------------------------------------
642 // wxPropertyGridPageState splitter, column and hittest functions
643 // -----------------------------------------------------------------------
645 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
649 return (wxPGProperty
*) NULL
;
652 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
655 // -----------------------------------------------------------------------
657 wxPropertyGridHitTestResult
wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
659 wxPropertyGridHitTestResult result
;
660 result
.column
= HitTestH( pt
.x
, &result
.splitter
, &result
.splitterHitOffset
);
661 result
.property
= DoGetItemAtY( pt
.y
);
665 // -----------------------------------------------------------------------
667 // Used by SetSplitterLeft() and DotFitColumns()
668 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
673 wxPropertyGrid
* pg
= m_pPropGrid
;
678 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
680 wxPGProperty
* p
= pwc
->Item(i
);
681 if ( !p
->IsCategory() )
683 dc
.GetTextExtent( p
->GetColumnText(col
), &w
, &h
);
685 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
688 // TODO: Add bitmap support.
690 w
+= (wxPG_XBEFORETEXT
*2);
696 if ( p
->GetChildCount() &&
697 ( subProps
|| p
->IsCategory() ) )
699 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
709 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
711 int n
= GetGrid()->m_marginWidth
;
713 for ( i
=0; i
<=splitterColumn
; i
++ )
718 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
720 return wxPG_DRAG_MARGIN
;
723 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
725 int origWidth
= m_colWidths
[column
];
726 m_colWidths
[column
] -= decrease
;
727 int min
= GetColumnMinWidth(column
);
729 if ( m_colWidths
[column
] < min
)
731 more
= decrease
- (origWidth
- min
);
732 m_colWidths
[column
] = min
;
736 // FIXME: Causes erratic splitter changing, so as a workaround
737 // disabled if two or less columns.
739 if ( m_colWidths
.size() <= 2 )
743 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
744 PropagateColSizeDec( column
, more
, dir
);
747 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
749 wxPropertyGrid
* pg
= GetGrid();
751 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
753 if ( !pg
->HasVirtualWidth() )
759 otherColumn
= splitterColumn
+ 1;
760 if ( otherColumn
== (int)m_colWidths
.size() )
762 m_colWidths
[splitterColumn
] += adjust
;
763 PropagateColSizeDec( otherColumn
, adjust
, 1 );
767 otherColumn
= splitterColumn
+ 1;
768 if ( otherColumn
== (int)m_colWidths
.size() )
770 m_colWidths
[otherColumn
] -= adjust
;
771 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
776 m_colWidths
[splitterColumn
] += adjust
;
779 if ( splitterColumn
== 0 )
780 m_fSplitterX
= (double) newXPos
;
782 if ( !fromAutoCenter
)
784 // Don't allow initial splitter auto-positioning after this.
785 if ( pg
->GetState() == this )
786 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
792 // Moves splitter so that all labels are visible, but just.
793 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
795 wxPropertyGrid
* pg
= GetGrid();
797 dc
.SetFont(pg
->m_font
);
799 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
803 maxW
+= pg
->m_marginWidth
;
804 DoSetSplitterPosition( maxW
);
807 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
810 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
812 wxPropertyGrid
* pg
= GetGrid();
814 dc
.SetFont(pg
->m_font
);
816 int marginWidth
= pg
->m_marginWidth
;
817 int accWid
= marginWidth
;
818 int maxColWidth
= 500;
820 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
822 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
823 int colMinWidth
= GetColumnMinWidth(col
);
824 if ( fitWid
< colMinWidth
)
825 fitWid
= colMinWidth
;
826 else if ( fitWid
> maxColWidth
)
827 fitWid
= maxColWidth
;
829 m_colWidths
[col
] = fitWid
;
834 // Expand last one to fill the width
835 int remaining
= m_width
- accWid
;
836 m_colWidths
[GetColumnCount()-1] += remaining
;
838 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
840 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
841 m_fSplitterX
= (double) firstSplitterX
;
843 // Don't allow initial splitter auto-positioning after this.
844 if ( pg
->GetState() == this )
846 pg
->SetSplitterPosition(firstSplitterX
, false);
851 pg
->GetVirtualSize(&x
, &y
);
853 return wxSize(accWid
, y
);
856 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
861 wxPropertyGrid
* pg
= GetGrid();
864 const bool debug
= false;
868 unsigned int lastColumn
= m_colWidths
.size() - 1;
870 int clientWidth
= pg
->GetClientSize().x
;
873 // Column to reduce, if needed. Take last one that exceeds minimum width.
874 // Except if auto splitter centering is used, in which case use widest.
876 int highestColWidth
= 0;
878 bool minimizedCols
= false;
882 wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width
, clientWidth
);
887 for ( i
=0; i
<m_colWidths
.size(); i
++ )
889 int min
= GetColumnMinWidth(i
);
890 if ( m_colWidths
[i
] <= min
)
892 m_colWidths
[i
] = min
;
893 minimizedCols
= true;
897 if ( pg
->HasFlag(wxPG_SPLITTER_AUTO_CENTER
) )
899 if ( m_colWidths
[i
] >= highestColWidth
)
901 highestColWidth
= m_colWidths
[i
];
912 int colsWidth
= pg
->m_marginWidth
;
913 for ( i
=0; i
<m_colWidths
.size(); i
++ )
914 colsWidth
+= m_colWidths
[i
];
918 wxLogDebug(wxT(" HasVirtualWidth: %i colsWidth: %i"),(int)pg
->HasVirtualWidth(),colsWidth
);
921 // Then mode-based requirement
922 if ( !pg
->HasVirtualWidth() )
924 int widthHigher
= width
- colsWidth
;
926 // Adapt colsWidth to width
927 if ( colsWidth
< width
)
932 wxLogDebug(wxT(" Adjust last column to %i"), m_colWidths
[lastColumn
] + widthHigher
);
934 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
936 else if ( colsWidth
> width
)
939 if ( reduceCol
!= -1 )
943 wxLogDebug(wxT(" Reduce column %i (by %i)"), reduceCol
, -widthHigher
);
945 // Reduce widest column, and recheck
946 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
953 // Only check colsWidth against clientWidth
954 if ( colsWidth
< clientWidth
)
956 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
961 // If width changed, recalculate virtual size
962 if ( pg
->GetState() == this )
963 pg
->RecalculateVirtualSize();
968 for ( i
=0; i
<m_colWidths
.size(); i
++ )
969 wxLogDebug(wxT("col%i: %i"),i
,m_colWidths
[i
]);
972 // Auto center splitter
973 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
974 m_colWidths
.size() == 2 )
976 float centerX
= (float)(pg
->m_width
/2);
979 if ( m_fSplitterX
< 0.0 )
983 else if ( widthChange
)
985 //float centerX = float(pg->GetSize().x) * 0.5;
988 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
989 float deviation
= fabs(centerX
- splitterX
);
991 // If deviating from center, adjust towards it
992 if ( deviation
> 20.0 )
994 if ( splitterX
> centerX
)
1002 // No width change, just keep sure we keep splitter position intact
1003 splitterX
= m_fSplitterX
;
1004 float deviation
= fabs(centerX
- splitterX
);
1005 if ( deviation
> 50.0 )
1007 splitterX
= centerX
;
1011 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1013 m_fSplitterX
= splitterX
; // needed to retain accuracy
1017 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1019 wxASSERT( colCount
>= 2 );
1020 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1021 if ( m_colWidths
.size() > (unsigned int)colCount
)
1022 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1024 if ( m_pPropGrid
->GetState() == this )
1025 m_pPropGrid
->RecalculateVirtualSize();
1027 CheckColumnWidths();
1030 // Returns column index, -1 for margin
1031 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1033 int cx
= GetGrid()->m_marginWidth
;
1035 int prevSplitter
= -1;
1040 if ( col
>= (int)m_colWidths
.size() )
1046 cx
+= m_colWidths
[col
];
1049 // Near prev. splitter
1052 int diff
= x
- prevSplitter
;
1053 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1055 *pSplitterHit
= col
- 1;
1056 *pSplitterHitOffset
= diff
;
1061 // Near next splitter
1062 int nextSplitter
= cx
;
1063 if ( col
< (int)(m_colWidths
.size()-1) )
1065 int diff
= x
- nextSplitter
;
1066 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1068 *pSplitterHit
= col
;
1069 *pSplitterHitOffset
= diff
;
1078 // -----------------------------------------------------------------------
1079 // wxPropertyGridPageState property value setting and getting
1080 // -----------------------------------------------------------------------
1082 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1086 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
;
1088 wxVariant variant
= p
->GetValueRef();
1091 if ( p
->GetMaxLength() <= 0 )
1092 res
= p
->StringToValue( variant
, value
, flags
);
1094 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1098 p
->SetValue(variant
);
1099 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1100 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1108 // -----------------------------------------------------------------------
1110 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1115 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1116 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1123 // -----------------------------------------------------------------------
1125 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1129 // wnd_primary has to be given so the control can be updated as well.
1131 DoSetPropertyValue(p
, v
);
1137 // -----------------------------------------------------------------------
1139 void wxPropertyGridPageState::DoSetPropertyValueUnspecified( wxPGProperty
* p
)
1141 wxCHECK_RET( p
, wxT("invalid property id") );
1143 if ( !p
->IsValueUnspecified() )
1145 // Value should be set first - editor class methods may need it
1146 p
->m_value
.MakeNull();
1148 wxASSERT( m_pPropGrid
);
1150 if ( m_pPropGrid
->GetState() == this )
1152 if ( m_pPropGrid
->m_selected
== p
&& m_pPropGrid
->m_wndEditor
)
1154 p
->GetEditorClass()->SetValueToUnspecified(p
, m_pPropGrid
->GetEditorControl());
1159 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1160 DoSetPropertyValueUnspecified( p
->Item(i
) );
1164 // -----------------------------------------------------------------------
1165 // wxPropertyGridPageState property operations
1166 // -----------------------------------------------------------------------
1168 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1170 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1172 if ( !p
->GetChildCount() ) return false;
1174 if ( !p
->IsExpanded() ) return false;
1176 p
->SetExpanded(false);
1178 VirtualHeightChanged();
1183 // -----------------------------------------------------------------------
1185 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1187 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1189 if ( !p
->GetChildCount() ) return false;
1191 if ( p
->IsExpanded() ) return false;
1193 p
->SetExpanded(true);
1195 VirtualHeightChanged();
1200 // -----------------------------------------------------------------------
1202 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1204 if ( this == m_pPropGrid
->GetState() )
1205 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1211 // -----------------------------------------------------------------------
1213 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1216 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1218 p
->SetFlag( wxPG_PROP_HIDDEN
);
1220 if ( flags
& wxPG_RECURSE
)
1223 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1224 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1227 VirtualHeightChanged();
1232 // -----------------------------------------------------------------------
1234 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1240 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1245 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1249 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1254 p
->m_flags
|= wxPG_PROP_DISABLED
;
1258 // Apply same to sub-properties as well
1260 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1261 DoEnableProperty( p
->Item(i
), enable
);
1268 // -----------------------------------------------------------------------
1269 // wxPropertyGridPageState wxVariant related routines
1270 // -----------------------------------------------------------------------
1272 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1273 // Never includes sub-properties (unless they are parented by wxParentProperty).
1274 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1275 wxPGProperty
* baseparent
,
1278 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1280 // Root is the default base-parent.
1284 wxVariantList tempList
;
1285 wxVariant
v( tempList
, listname
);
1287 if ( pwc
->GetChildCount() )
1289 if ( flags
& wxPG_KEEP_STRUCTURE
)
1291 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1294 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1296 wxPGProperty
* p
= pwc
->Item(i
);
1297 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1299 wxVariant variant
= p
->GetValue();
1300 variant
.SetName( p
->GetBaseName() );
1301 v
.Append( variant
);
1305 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1307 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1308 v
.Append( p
->GetAttributesAsList() );
1313 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1314 it
.SetBaseParent( pwc
);
1316 for ( ; !it
.AtEnd(); it
.Next() )
1318 const wxPGProperty
* p
= it
.GetProperty();
1320 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1321 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1323 wxVariant variant
= p
->GetValue();
1324 variant
.SetName( p
->GetName() );
1325 v
.Append( variant
);
1326 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1327 v
.Append( p
->GetAttributesAsList() );
1336 // -----------------------------------------------------------------------
1338 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1340 unsigned char origFrozen
= 1;
1342 if ( m_pPropGrid
->GetState() == this )
1344 origFrozen
= m_pPropGrid
->m_frozen
;
1345 if ( !origFrozen
) m_pPropGrid
->Freeze();
1348 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1350 if ( !use_category
)
1351 use_category
= (wxPropertyCategory
*)m_properties
;
1353 // Let's iterate over the list of variants.
1354 wxVariantList::const_iterator node
;
1355 int numSpecialEntries
= 0;
1358 // Second pass for special entries
1359 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1361 wxVariant
*current
= (wxVariant
*)*node
;
1363 // Make sure it is wxVariant.
1364 wxASSERT( current
);
1365 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1367 const wxString
& name
= current
->GetName();
1368 if ( name
.length() > 0 )
1371 // '@' signified a special entry
1372 if ( name
[0] == wxS('@') )
1374 numSpecialEntries
++;
1378 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1381 wxPGProperty
* p
= foundProp
;
1383 // If it was a list, we still have to go through it.
1384 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1386 DoSetPropertyValues( current
->GetList(),
1387 p
->IsCategory()?p
:((wxPGProperty
*)NULL
)
1393 if ( wxStrcmp(current
->GetType(), p
->GetValue().GetType()) != 0)
1395 wxLogDebug(wxT("wxPropertyGridPageState::DoSetPropertyValues Warning: Setting value of property \"%s\" from variant"),
1396 p
->GetName().c_str());
1400 p
->SetValue(*current
);
1406 if ( current
->GetType() != wxS("list") )
1412 // Yes, it is; create a sub category and append contents there.
1413 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1414 DoSetPropertyValues( current
->GetList(), newCat
);
1421 if ( numSpecialEntries
)
1423 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1425 wxVariant
*current
= (wxVariant
*)*node
;
1427 const wxString
& name
= current
->GetName();
1428 if ( name
.length() > 0 )
1431 // '@' signified a special entry
1432 if ( name
[0] == wxS('@') )
1434 numSpecialEntries
--;
1436 size_t pos2
= name
.rfind(wxS('@'));
1437 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1439 wxString propName
= name
.substr(1, pos2
-1);
1440 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1442 if ( entryType
== wxS("attr") )
1445 // List of attributes
1446 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1449 wxASSERT( wxPGIsVariantType(*current
, list
) );
1451 wxVariantList
& list2
= current
->GetList();
1452 wxVariantList::const_iterator node2
;
1454 for ( node2
= list2
.begin(); node2
!= list2
.end(); node2
++ )
1456 wxVariant
*attr
= (wxVariant
*)*node2
;
1457 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1462 // ERROR: No such property: 'propName'
1468 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1473 if ( !numSpecialEntries
)
1480 m_pPropGrid
->Thaw();
1482 if ( this == m_pPropGrid
->GetState() )
1484 m_selected
->UpdateControl(m_pPropGrid
->GetEditorControl());
1490 // -----------------------------------------------------------------------
1491 // wxPropertyGridPageState property adding and removal
1492 // -----------------------------------------------------------------------
1494 int wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1495 wxPGProperty
* scheduledParent
)
1497 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1499 // This will allow better behavior.
1500 if ( scheduledParent
== m_properties
)
1501 scheduledParent
= (wxPGProperty
*) NULL
;
1503 property
->m_parentState
= this;
1505 if ( property
->IsCategory() )
1508 // Parent of a category must be either root or another category
1509 // (otherwise Bad Things might happen).
1510 wxASSERT_MSG( scheduledParent
== NULL
||
1511 scheduledParent
== m_properties
||
1512 scheduledParent
->IsCategory(),
1513 wxT("Parent of a category must be either root or another category."));
1515 // If we already have category with same name, delete given property
1516 // and use it instead as most recent caption item.
1517 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1520 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1521 if ( pwc
->IsCategory() ) // Must be a category.
1524 m_currentCategory
= pwc
;
1525 return 2; // Tells the caller what we did.
1531 // Warn for identical names in debug mode.
1532 if ( BaseGetPropertyByName(property
->GetName()) &&
1533 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1535 wxLogError(wxT("wxPropertyGrid: Warning - item with name \"%s\" already exists."),
1536 property
->GetName().c_str());
1537 wxPGGlobalVars
->m_warnings
++;
1541 // Make sure nothing is selected.
1542 if ( propGrid
&& propGrid
->m_selected
)
1544 bool selRes
= propGrid
->ClearSelection();
1545 wxPG_CHECK_MSG_DBG( selRes
,
1547 wxT("failed to deselect a property (editor probably had invalid value)") );
1550 if ( scheduledParent
)
1552 // Use parent's colours.
1553 property
->m_bgColIndex
= scheduledParent
->m_bgColIndex
;
1554 property
->m_fgColIndex
= scheduledParent
->m_fgColIndex
;
1556 // Fix no parent does not yet have parenting flag yet, set one now
1557 if ( !scheduledParent
->HasFlag(wxPG_PROP_PARENTAL_FLAGS
) )
1558 scheduledParent
->SetParentalType(wxPG_PROP_MISC_PARENT
);
1559 //scheduledParent->SetFlag(wxPG_PROP_MISC_PARENT);
1562 // If in hideable adding mode, or if assigned parent is hideable, then
1563 // make this one hideable.
1565 ( scheduledParent
&& (scheduledParent
->m_flags
& wxPG_PROP_HIDDEN
) ) ||
1566 ( propGrid
&& (propGrid
->m_iFlags
& wxPG_FL_ADDING_HIDEABLES
) )
1568 property
->SetFlag( wxPG_PROP_HIDDEN
);
1570 // Set custom image flag.
1571 int custImgHeight
= property
->OnMeasureImage().y
;
1572 if ( custImgHeight
< 0 /*|| custImgHeight > 1*/ )
1574 property
->m_flags
|= wxPG_PROP_CUSTOMIMAGE
;
1577 if ( propGrid
&& (propGrid
->GetWindowStyleFlag() & wxPG_LIMITED_EDITING
) )
1578 property
->m_flags
|= wxPG_PROP_NOEDITOR
;
1580 if ( !property
->IsCategory() )
1582 // This is not a category.
1584 //wxASSERT_MSG( property->GetEditorClass(), wxT("Editor class not initialized!") );
1588 unsigned char depth
= 1;
1589 if ( scheduledParent
)
1591 depth
= scheduledParent
->m_depth
;
1592 if ( !scheduledParent
->IsCategory() )
1595 property
->m_depth
= depth
;
1596 unsigned char greyDepth
= depth
;
1598 if ( scheduledParent
)
1600 wxPropertyCategory
* pc
;
1602 if ( scheduledParent
->IsCategory() || scheduledParent
->IsRoot() )
1603 pc
= (wxPropertyCategory
*)scheduledParent
;
1605 // This conditional compile is necessary to
1606 // bypass some compiler bug.
1607 pc
= GetPropertyCategory(scheduledParent
);
1610 greyDepth
= pc
->GetDepth();
1612 greyDepth
= scheduledParent
->m_depthBgCol
;
1615 property
->m_depthBgCol
= greyDepth
;
1617 // Prepare children pre-added children
1618 if ( property
->GetChildCount() )
1620 property
->SetParentalType(wxPG_PROP_AGGREGATE
);
1622 property
->SetExpanded(false); // Properties with children are not expanded by default.
1623 if ( propGrid
&& propGrid
->GetWindowStyleFlag() & wxPG_HIDE_MARGIN
)
1624 property
->SetExpanded(true); // ...unless it cannot be expanded.
1626 property
->PrepareSubProperties();
1631 if ( propGrid
&& (propGrid
->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES
) )
1632 property
->SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED
, true);
1638 // This is a category.
1641 unsigned char depth
= 1;
1642 if ( scheduledParent
)
1644 depth
= scheduledParent
->m_depth
+ 1;
1646 property
->m_depth
= depth
;
1647 property
->m_depthBgCol
= depth
;
1649 m_currentCategory
= (wxPropertyCategory
*)property
;
1651 wxPropertyCategory
* pc
= (wxPropertyCategory
*)property
;
1653 // Calculate text extent for caption item.
1655 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1661 // -----------------------------------------------------------------------
1663 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1665 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1666 if ( property
->IsCategory() )
1667 cur_cat
= (wxPropertyCategory
*) NULL
;
1669 return DoInsert( cur_cat
, -1, property
);
1672 // -----------------------------------------------------------------------
1674 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1677 parent
= m_properties
;
1679 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1681 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1683 int parenting
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1685 // This type of invalid parenting value indicates we should exit now, returning
1686 // id of most recent category.
1687 if ( parenting
> 1 )
1688 return m_currentCategory
;
1690 // Note that item must be added into current mode later.
1692 // If parent is wxParentProperty, just stick it in...
1693 // If parent is root (m_properties), then...
1694 // In categoric mode: Add as last item in m_abcArray (if not category).
1695 // Add to given index in m_regularArray.
1696 // In non-cat mode: Add as last item in m_regularArray.
1697 // Add to given index in m_abcArray.
1698 // If parent is category, then...
1699 // 1) Add to given category in given index.
1700 // 2) Add as last item in m_abcArray.
1702 if ( !parent
->IsCategory() && !parent
->IsRoot() )
1704 // Parent is wxParentingProperty: Just stick it in...
1705 parent
->AddChild2( property
, index
);
1709 // Parent is Category or Root.
1711 if ( m_properties
== &m_regularArray
)
1715 // Only add non-categories to m_abcArray.
1716 if ( m_abcArray
&& parenting
<= 0 )
1717 m_abcArray
->AddChild2( property
, -1, false );
1719 // Add to current mode.
1720 parent
->AddChild2( property
, index
);
1725 // Non-categorized mode.
1727 if ( parent
!= m_properties
)
1728 // Parent is category.
1729 parent
->AddChild2( property
, index
, false );
1732 m_regularArray
.AddChild2( property
, -1, false );
1734 // Add to current mode (no categories).
1735 if ( parenting
<= 0 )
1736 m_abcArray
->AddChild2( property
, index
);
1741 if ( property
->IsCategory() )
1743 // This is a category caption item.
1745 // Last caption is not the bottom one (this info required by append)
1746 m_lastCaptionBottomnest
= 0;
1749 // Only add name to hashmap if parent is root or category
1750 if ( (parent
->IsCategory() || parent
->IsRoot()) && property
->m_name
.length() )
1751 m_dictName
[property
->m_name
] = (void*) property
;
1753 VirtualHeightChanged();
1755 property
->UpdateParentValues();
1762 // -----------------------------------------------------------------------
1764 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
)
1766 wxCHECK_RET( item
->GetParent(),
1767 wxT("this property was already deleted") );
1769 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1770 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1773 unsigned int indinparent
= item
->GetIndexInParent();
1775 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1777 wxCHECK_RET( !item
->GetParent()->HasFlag(wxPG_PROP_AGGREGATE
),
1778 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1780 if ( item
->IsCategory() )
1782 // deleting a category
1784 // erase category entries from the hash table
1785 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1787 wxPGProperty
* sp
= pwc
->Item( i
);
1788 if ( sp
->GetBaseName().Len() ) m_dictName
.erase(sp
->GetBaseName());
1791 if ( pwc
== m_currentCategory
)
1792 m_currentCategory
= (wxPropertyCategory
*) NULL
;
1796 // Remove children from non-categorized array.
1797 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1799 wxPGProperty
* p
= pwc
->Item( i
);
1800 wxASSERT( p
!= NULL
);
1801 if ( !p
->IsCategory() )
1802 m_abcArray
->m_children
.Remove( p
);
1805 if ( IsInNonCatMode() )
1806 m_abcArray
->FixIndexesOfChildren();
1810 if ( !IsInNonCatMode() )
1812 // categorized mode - non-categorized array
1814 // Remove from non-cat array, but only if parent is in it
1815 if ( !item
->IsCategory() && item
->GetParent()->IsCategory() )
1819 m_abcArray
->m_children
.Remove( item
);
1823 // categorized mode - categorized array
1824 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1825 item
->m_parent
->FixIndexesOfChildren(/*indinparent*/);
1829 // non-categorized mode - categorized array
1831 // We need to find location of item.
1832 wxPGProperty
* cat_parent
= &m_regularArray
;
1833 int cat_index
= m_regularArray
.GetChildCount();
1835 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1837 wxPGProperty
* p
= m_regularArray
.Item(i
);
1838 if ( p
== item
) { cat_index
= i
; break; }
1839 if ( p
->IsCategory() )
1841 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1842 if ( subind
!= wxNOT_FOUND
)
1844 cat_parent
= ((wxPGProperty
*)p
);
1850 cat_parent
->m_children
.RemoveAt(cat_index
);
1852 // non-categorized mode - non-categorized array
1853 if ( !item
->IsCategory() )
1855 wxASSERT( item
->m_parent
== m_abcArray
);
1856 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1857 item
->m_parent
->FixIndexesOfChildren(indinparent
);
1861 if ( item
->GetBaseName().Len() ) m_dictName
.erase(item
->GetBaseName());
1863 // We can actually delete it now
1866 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1868 VirtualHeightChanged();
1871 // -----------------------------------------------------------------------