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"
48 #include "wx/stopwatch.h"
51 // This define is necessary to prevent macro clearing
52 #define __wxPG_SOURCE_FILE__
54 #include <wx/propgrid/propgridpagestate.h>
55 #include <wx/propgrid/propgrid.h>
56 #include <wx/propgrid/editors.h>
59 #define wxPG_DEFAULT_SPLITTERX 110
62 // -----------------------------------------------------------------------
63 // wxPropertyGridIterator
64 // -----------------------------------------------------------------------
66 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, wxPGProperty
* property
, int dir
)
68 wxASSERT( dir
== 1 || dir
== -1 );
71 m_baseParent
= state
->DoGetRoot();
72 if ( !property
&& m_baseParent
->GetChildCount() )
73 property
= m_baseParent
->Item(0);
75 m_property
= property
;
77 wxPG_ITERATOR_CREATE_MASKS(flags
, m_itemExMask
, m_parentExMask
)
79 // Need to skip first?
80 if ( property
&& (property
->GetFlags() & m_itemExMask
) )
89 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState
* state
, int flags
, int startPos
, int dir
)
91 wxPGProperty
* property
;
93 if ( startPos
== wxTOP
)
99 else if ( startPos
== wxBOTTOM
)
101 property
= state
->GetLastItem(flags
);
107 wxASSERT_MSG( false, wxT("Only supported stating positions are wxTOP and wxBOTTOM") );
111 Init( state
, flags
, property
, dir
);
114 void wxPropertyGridIteratorBase::Assign( const wxPropertyGridIteratorBase
& it
)
116 m_property
= it
.m_property
;
117 m_state
= it
.m_state
;
118 m_baseParent
= it
.m_baseParent
;
119 m_itemExMask
= it
.m_itemExMask
;
120 m_parentExMask
= it
.m_parentExMask
;
123 void wxPropertyGridIteratorBase::Prev()
125 wxPGProperty
* property
= m_property
;
126 wxASSERT( property
);
128 wxPGProperty
* parent
= property
->GetParent();
130 unsigned int index
= property
->GetIndexInParent();
137 property
= parent
->Item(index
);
139 // Go to last children?
140 if ( property
->GetChildCount() &&
141 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) )
144 property
= property
->Last();
150 if ( parent
== m_baseParent
)
161 m_property
= property
;
163 // If property does not match our criteria, skip it
164 if ( property
->GetFlags() & m_itemExMask
)
168 void wxPropertyGridIteratorBase::Next( bool iterateChildren
)
170 wxPGProperty
* property
= m_property
;
171 wxASSERT( property
);
173 if ( property
->GetChildCount() &&
174 wxPG_ITERATOR_PARENTEXMASK_TEST(property
, m_parentExMask
) &&
178 property
= property
->Item(0);
182 wxPGProperty
* parent
= property
->GetParent();
184 unsigned int index
= property
->GetIndexInParent() + 1;
186 if ( index
< parent
->GetChildCount() )
189 property
= parent
->Item(index
);
193 // Next sibling of parent
194 if ( parent
== m_baseParent
)
207 m_property
= property
;
209 // If property does not match our criteria, skip it
210 if ( property
->GetFlags() & m_itemExMask
)
214 // -----------------------------------------------------------------------
215 // wxPropertyGridPageState
216 // -----------------------------------------------------------------------
218 wxPropertyGridPageState::wxPropertyGridPageState()
220 m_pPropGrid
= (wxPropertyGrid
*) NULL
;
221 m_regularArray
.SetParentState(this);
222 m_properties
= &m_regularArray
;
223 m_abcArray
= (wxPGRootProperty
*) NULL
;
224 m_currentCategory
= (wxPropertyCategory
*) NULL
;
225 m_selected
= (wxPGProperty
*) NULL
;
228 m_lastCaptionBottomnest
= 1;
232 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
233 m_colWidths
.push_back( wxPG_DEFAULT_SPLITTERX
);
234 m_fSplitterX
= wxPG_DEFAULT_SPLITTERX
;
237 // -----------------------------------------------------------------------
239 wxPropertyGridPageState::~wxPropertyGridPageState()
244 // -----------------------------------------------------------------------
246 void wxPropertyGridPageState::InitNonCatMode()
250 m_abcArray
= new wxPGRootProperty();
251 m_abcArray
->SetParentState(this);
252 m_abcArray
->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES
);
255 // Must be called when state::m_properties still points to regularArray.
256 wxPGProperty
* oldProperties
= m_properties
;
258 // Must use temp value in state::m_properties for item iteration loop
259 // to run as expected.
260 m_properties
= &m_regularArray
;
262 if ( m_properties
->GetChildCount() )
265 wxPropertyGridIterator
it( this, wxPG_ITERATE_DEFAULT
|wxPG_ITERATE_CATEGORIES
);
267 for ( ; !it
.AtEnd(); it
.Next() )
269 wxPGProperty
* p
= it
.GetProperty();
270 wxPGProperty
* parent
= p
->GetParent();
271 if ( p
->HasFlag(wxPG_PROP_MISC_PARENT
) &&
272 ( parent
== m_properties
|| (parent
->IsCategory() || parent
->IsRoot()) ) )
274 m_abcArray
->AddChild2( p
);
275 p
->m_parent
= &m_regularArray
;
280 m_properties
= oldProperties
;
283 // -----------------------------------------------------------------------
285 void wxPropertyGridPageState::DoClear()
287 m_regularArray
.Empty();
293 m_currentCategory
= (wxPropertyCategory
*) NULL
;
294 m_lastCaptionBottomnest
= 1;
300 m_selected
= (wxPGProperty
*) NULL
;
303 // -----------------------------------------------------------------------
305 void wxPropertyGridPageState::CalculateFontAndBitmapStuff( int WXUNUSED(vspacing
) )
307 wxPropertyGrid
* propGrid
= GetGrid();
309 VirtualHeightChanged();
311 // Recalculate caption text extents.
314 for ( i
=0;i
<m_regularArray
.GetChildCount();i
++ )
316 wxPGProperty
* p
=m_regularArray
.Item(i
);
318 if ( p
->IsCategory() )
319 ((wxPropertyCategory
*)p
)->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
323 // -----------------------------------------------------------------------
325 void wxPropertyGridPageState::SetVirtualWidth( int width
)
327 wxASSERT( width
>= 0 );
328 wxPropertyGrid
* pg
= GetGrid();
329 int gw
= pg
->GetClientSize().x
;
336 // -----------------------------------------------------------------------
338 void wxPropertyGridPageState::OnClientWidthChange( int newWidth
, int widthChange
, bool fromOnResize
)
340 wxPropertyGrid
* pg
= GetGrid();
342 if ( pg
->HasVirtualWidth() )
344 if ( m_width
< newWidth
)
345 SetVirtualWidth( newWidth
);
347 CheckColumnWidths(widthChange
);
351 SetVirtualWidth( newWidth
);
353 // This should be done before splitter auto centering
354 // NOTE: Splitter auto-centering is done in this function.
357 CheckColumnWidths(widthChange
);
359 if ( !(GetGrid()->GetInternalFlags() & wxPG_FL_SPLITTER_PRE_SET
) &&
360 (GetGrid()->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) )
362 long timeSinceCreation
= (::wxGetLocalTimeMillis() - GetGrid()->m_timeCreated
).ToLong();
364 // If too long, don't set splitter
365 if ( timeSinceCreation
< 3000 )
367 if ( m_properties
->GetChildCount() || timeSinceCreation
> 750 )
369 SetSplitterLeft( false );
373 DoSetSplitterPosition( newWidth
/ 2 );
374 GetGrid()->ClearInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
381 // -----------------------------------------------------------------------
382 // wxPropertyGridPageState item iteration methods
383 // -----------------------------------------------------------------------
385 wxPGProperty
* wxPropertyGridPageState::GetLastItem( int flags
)
387 if ( !m_properties
->GetChildCount() )
388 return (wxPGProperty
*) NULL
;
390 wxPG_ITERATOR_CREATE_MASKS(flags
, int itemExMask
, int parentExMask
)
392 // First, get last child of last parent
393 wxPGProperty
* pwc
= (wxPGProperty
*)m_properties
->Last();
394 while ( pwc
->GetChildCount() &&
395 wxPG_ITERATOR_PARENTEXMASK_TEST(pwc
, parentExMask
) )
396 pwc
= (wxPGProperty
*) pwc
->Last();
398 // Then, if it doesn't fit our criteria, back up until we find something that does
399 if ( pwc
->GetFlags() & itemExMask
)
401 wxPropertyGridIterator
it( this, flags
, pwc
);
402 for ( ; !it
.AtEnd(); it
.Prev() );
403 pwc
= (wxPGProperty
*) it
.GetProperty();
409 wxPropertyCategory
* wxPropertyGridPageState::GetPropertyCategory( const wxPGProperty
* p
) const
411 const wxPGProperty
* parent
= (const wxPGProperty
*)p
;
412 const wxPGProperty
* grandparent
= (const wxPGProperty
*)parent
->GetParent();
415 parent
= grandparent
;
416 grandparent
= (wxPGProperty
*)parent
->GetParent();
417 if ( parent
->IsCategory() && grandparent
)
418 return (wxPropertyCategory
*)parent
;
419 } while ( grandparent
);
421 return (wxPropertyCategory
*) NULL
;
424 // -----------------------------------------------------------------------
425 // wxPropertyGridPageState GetPropertyXXX methods
426 // -----------------------------------------------------------------------
428 wxPGProperty
* wxPropertyGridPageState::GetPropertyByLabel( const wxString
& label
,
429 wxPGProperty
* parent
) const
434 if ( !parent
) parent
= (wxPGProperty
*) &m_regularArray
;
436 for ( i
=0; i
<parent
->GetChildCount(); i
++ )
438 wxPGProperty
* p
= parent
->Item(i
);
439 if ( p
->m_label
== label
)
441 // Check children recursively.
442 if ( p
->GetChildCount() )
444 p
= GetPropertyByLabel(label
,(wxPGProperty
*)p
);
453 // -----------------------------------------------------------------------
455 wxPGProperty
* wxPropertyGridPageState::BaseGetPropertyByName( const wxString
& name
) const
457 wxPGHashMapS2P::const_iterator it
;
458 it
= m_dictName
.find(name
);
459 if ( it
!= m_dictName
.end() )
460 return (wxPGProperty
*) it
->second
;
461 return (wxPGProperty
*) NULL
;
464 // -----------------------------------------------------------------------
465 // wxPropertyGridPageState global operations
466 // -----------------------------------------------------------------------
468 // -----------------------------------------------------------------------
469 // Item iteration macros
470 // NB: Nowadays only needed for alphabetic/categoric mode switching.
471 // -----------------------------------------------------------------------
473 #define II_INVALID_I 0x00FFFFFF
475 #define ITEM_ITERATION_VARIABLES \
476 wxPGProperty* parent; \
480 #define ITEM_ITERATION_INIT_FROM_THE_TOP \
481 parent = m_properties; \
484 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
485 parent = startparent; \
486 i = (unsigned int)startindex; \
487 if ( parent == (wxPGProperty*) NULL ) \
489 parent = state->m_properties; \
493 #define ITEM_ITERATION_LOOP_BEGIN \
496 iMax = parent->GetChildCount(); \
499 wxPGProperty* p = parent->Item(i);
501 #define ITEM_ITERATION_LOOP_END \
502 if ( p->GetChildCount() ) \
505 parent = (wxPGProperty*)p; \
506 iMax = parent->GetChildCount(); \
511 i = parent->m_arrIndex + 1; \
512 parent = parent->m_parent; \
514 while ( parent != NULL );
516 bool wxPropertyGridPageState::EnableCategories( bool enable
)
519 // NB: We can't use wxPropertyGridIterator in this
520 // function, since it depends on m_arrIndexes,
521 // which, among other things, is being fixed here.
523 ITEM_ITERATION_VARIABLES
531 if ( !IsInNonCatMode() )
534 m_properties
= &m_regularArray
;
536 // fix parents, indexes, and depths
537 ITEM_ITERATION_INIT_FROM_THE_TOP
539 ITEM_ITERATION_LOOP_BEGIN
543 p
->m_parent
= parent
;
545 // If parent was category, and this is not,
546 // then the depth stays the same.
547 if ( parent
->IsCategory() &&
549 p
->m_depth
= parent
->m_depth
;
551 p
->m_depth
= parent
->m_depth
+ 1;
553 ITEM_ITERATION_LOOP_END
559 // Disable categories
562 if ( IsInNonCatMode() )
565 // Create array, if necessary.
569 m_properties
= m_abcArray
;
571 // fix parents, indexes, and depths
572 ITEM_ITERATION_INIT_FROM_THE_TOP
574 ITEM_ITERATION_LOOP_BEGIN
578 p
->m_parent
= parent
;
580 p
->m_depth
= parent
->m_depth
+ 1;
582 ITEM_ITERATION_LOOP_END
585 VirtualHeightChanged();
587 if ( m_pPropGrid
->GetState() == this )
588 m_pPropGrid
->RecalculateVirtualSize();
593 // -----------------------------------------------------------------------
595 static int wxPG_SortFunc(void **p1
, void **p2
)
597 wxPGProperty
*pp1
= *((wxPGProperty
**)p1
);
598 wxPGProperty
*pp2
= *((wxPGProperty
**)p2
);
599 return pp1
->GetLabel().compare( pp2
->GetLabel() );
602 void wxPropertyGridPageState::SortChildren( wxPGProperty
* p
)
605 p
= (wxPGProperty
*)m_properties
;
607 if ( !p
->GetChildCount() )
610 wxPGProperty
* pwc
= (wxPGProperty
*)p
;
612 // Can only sort items with children
613 if ( pwc
->GetChildCount() < 1 )
616 pwc
->m_children
.Sort( wxPG_SortFunc
);
619 pwc
->FixIndexesOfChildren();
623 // -----------------------------------------------------------------------
625 void wxPropertyGridPageState::Sort()
627 SortChildren( m_properties
);
629 // Sort categories as well
630 if ( !IsInNonCatMode() )
633 for ( i
=0;i
<m_properties
->GetChildCount();i
++)
635 wxPGProperty
* p
= m_properties
->Item(i
);
636 if ( p
->IsCategory() )
642 // -----------------------------------------------------------------------
643 // wxPropertyGridPageState splitter, column and hittest functions
644 // -----------------------------------------------------------------------
646 wxPGProperty
* wxPropertyGridPageState::DoGetItemAtY( int y
) const
650 return (wxPGProperty
*) NULL
;
653 return m_properties
->GetItemAtY(y
, GetGrid()->m_lineHeight
, &a
);
656 // -----------------------------------------------------------------------
658 wxPropertyGridHitTestResult
wxPropertyGridPageState::HitTest( const wxPoint
&pt
) const
660 wxPropertyGridHitTestResult result
;
661 result
.column
= HitTestH( pt
.x
, &result
.splitter
, &result
.splitterHitOffset
);
662 result
.property
= DoGetItemAtY( pt
.y
);
666 // -----------------------------------------------------------------------
668 // Used by SetSplitterLeft() and DotFitColumns()
669 int wxPropertyGridPageState::GetColumnFitWidth(wxClientDC
& dc
,
674 wxPropertyGrid
* pg
= m_pPropGrid
;
679 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
681 wxPGProperty
* p
= pwc
->Item(i
);
682 if ( !p
->IsCategory() )
684 dc
.GetTextExtent( p
->GetColumnText(col
), &w
, &h
);
686 w
+= ( ((int)p
->m_depth
-1) * pg
->m_subgroup_extramargin
);
689 // TODO: Add bitmap support.
691 w
+= (wxPG_XBEFORETEXT
*2);
697 if ( p
->GetChildCount() &&
698 ( subProps
|| p
->IsCategory() ) )
700 w
= GetColumnFitWidth( dc
, p
, col
, subProps
);
710 int wxPropertyGridPageState::DoGetSplitterPosition( int splitterColumn
) const
712 int n
= GetGrid()->m_marginWidth
;
714 for ( i
=0; i
<=splitterColumn
; i
++ )
719 int wxPropertyGridPageState::GetColumnMinWidth( int WXUNUSED(column
) ) const
721 return wxPG_DRAG_MARGIN
;
724 void wxPropertyGridPageState::PropagateColSizeDec( int column
, int decrease
, int dir
)
726 int origWidth
= m_colWidths
[column
];
727 m_colWidths
[column
] -= decrease
;
728 int min
= GetColumnMinWidth(column
);
730 if ( m_colWidths
[column
] < min
)
732 more
= decrease
- (origWidth
- min
);
733 m_colWidths
[column
] = min
;
737 // FIXME: Causes erratic splitter changing, so as a workaround
738 // disabled if two or less columns.
740 if ( m_colWidths
.size() <= 2 )
744 if ( more
&& column
< (int)m_colWidths
.size() && column
>= 0 )
745 PropagateColSizeDec( column
, more
, dir
);
748 void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos
, int splitterColumn
, bool WXUNUSED(allPages
), bool fromAutoCenter
)
750 wxPropertyGrid
* pg
= GetGrid();
752 int adjust
= newXPos
- DoGetSplitterPosition(splitterColumn
);
754 if ( !pg
->HasVirtualWidth() )
760 otherColumn
= splitterColumn
+ 1;
761 if ( otherColumn
== (int)m_colWidths
.size() )
763 m_colWidths
[splitterColumn
] += adjust
;
764 PropagateColSizeDec( otherColumn
, adjust
, 1 );
768 otherColumn
= splitterColumn
+ 1;
769 if ( otherColumn
== (int)m_colWidths
.size() )
771 m_colWidths
[otherColumn
] -= adjust
;
772 PropagateColSizeDec( splitterColumn
, -adjust
, -1 );
777 m_colWidths
[splitterColumn
] += adjust
;
780 if ( splitterColumn
== 0 )
781 m_fSplitterX
= (double) newXPos
;
783 if ( !fromAutoCenter
)
785 // Don't allow initial splitter auto-positioning after this.
786 if ( pg
->GetState() == this )
787 pg
->SetInternalFlag(wxPG_FL_SPLITTER_PRE_SET
);
793 // Moves splitter so that all labels are visible, but just.
794 void wxPropertyGridPageState::SetSplitterLeft( bool subProps
)
796 wxPropertyGrid
* pg
= GetGrid();
798 dc
.SetFont(pg
->m_font
);
800 int maxW
= GetColumnFitWidth(dc
, m_properties
, 0, subProps
);
804 maxW
+= pg
->m_marginWidth
;
805 DoSetSplitterPosition( maxW
);
808 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
811 wxSize
wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize
) )
813 wxPropertyGrid
* pg
= GetGrid();
815 dc
.SetFont(pg
->m_font
);
817 int marginWidth
= pg
->m_marginWidth
;
818 int accWid
= marginWidth
;
819 int maxColWidth
= 500;
821 for ( unsigned int col
=0; col
< GetColumnCount(); col
++ )
823 int fitWid
= GetColumnFitWidth(dc
, m_properties
, col
, true);
824 int colMinWidth
= GetColumnMinWidth(col
);
825 if ( fitWid
< colMinWidth
)
826 fitWid
= colMinWidth
;
827 else if ( fitWid
> maxColWidth
)
828 fitWid
= maxColWidth
;
830 m_colWidths
[col
] = fitWid
;
835 // Expand last one to fill the width
836 int remaining
= m_width
- accWid
;
837 m_colWidths
[GetColumnCount()-1] += remaining
;
839 pg
->SetInternalFlag(wxPG_FL_DONT_CENTER_SPLITTER
);
841 int firstSplitterX
= marginWidth
+ m_colWidths
[0];
842 m_fSplitterX
= (double) firstSplitterX
;
844 // Don't allow initial splitter auto-positioning after this.
845 if ( pg
->GetState() == this )
847 pg
->SetSplitterPosition(firstSplitterX
, false);
852 pg
->GetVirtualSize(&x
, &y
);
854 return wxSize(accWid
, y
);
857 void wxPropertyGridPageState::CheckColumnWidths( int widthChange
)
862 wxPropertyGrid
* pg
= GetGrid();
865 const bool debug
= false;
869 unsigned int lastColumn
= m_colWidths
.size() - 1;
871 int clientWidth
= pg
->GetClientSize().x
;
874 // Column to reduce, if needed. Take last one that exceeds minimum width.
875 // Except if auto splitter centering is used, in which case use widest.
877 int highestColWidth
= 0;
879 bool minimizedCols
= false;
883 wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width
, clientWidth
);
888 for ( i
=0; i
<m_colWidths
.size(); i
++ )
890 int min
= GetColumnMinWidth(i
);
891 if ( m_colWidths
[i
] <= min
)
893 m_colWidths
[i
] = min
;
894 minimizedCols
= true;
898 if ( pg
->HasFlag(wxPG_SPLITTER_AUTO_CENTER
) )
900 if ( m_colWidths
[i
] >= highestColWidth
)
902 highestColWidth
= m_colWidths
[i
];
913 int colsWidth
= pg
->m_marginWidth
;
914 for ( i
=0; i
<m_colWidths
.size(); i
++ )
915 colsWidth
+= m_colWidths
[i
];
919 wxLogDebug(wxT(" HasVirtualWidth: %i colsWidth: %i"),(int)pg
->HasVirtualWidth(),colsWidth
);
922 // Then mode-based requirement
923 if ( !pg
->HasVirtualWidth() )
925 int widthHigher
= width
- colsWidth
;
927 // Adapt colsWidth to width
928 if ( colsWidth
< width
)
933 wxLogDebug(wxT(" Adjust last column to %i"), m_colWidths
[lastColumn
] + widthHigher
);
935 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + widthHigher
;
937 else if ( colsWidth
> width
)
940 if ( reduceCol
!= -1 )
944 wxLogDebug(wxT(" Reduce column %i (by %i)"), reduceCol
, -widthHigher
);
946 // Reduce widest column, and recheck
947 m_colWidths
[reduceCol
] = m_colWidths
[reduceCol
] + widthHigher
;
954 // Only check colsWidth against clientWidth
955 if ( colsWidth
< clientWidth
)
957 m_colWidths
[lastColumn
] = m_colWidths
[lastColumn
] + (clientWidth
-colsWidth
);
962 // If width changed, recalculate virtual size
963 if ( pg
->GetState() == this )
964 pg
->RecalculateVirtualSize();
969 for ( i
=0; i
<m_colWidths
.size(); i
++ )
970 wxLogDebug(wxT("col%i: %i"),i
,m_colWidths
[i
]);
973 // Auto center splitter
974 if ( !(pg
->GetInternalFlags() & wxPG_FL_DONT_CENTER_SPLITTER
) &&
975 m_colWidths
.size() == 2 )
977 float centerX
= (float)(pg
->m_width
/2);
980 if ( m_fSplitterX
< 0.0 )
984 else if ( widthChange
)
986 //float centerX = float(pg->GetSize().x) * 0.5;
989 splitterX
= m_fSplitterX
+ (float(widthChange
) * 0.5);
990 float deviation
= fabs(centerX
- splitterX
);
992 // If deviating from center, adjust towards it
993 if ( deviation
> 20.0 )
995 if ( splitterX
> centerX
)
1003 // No width change, just keep sure we keep splitter position intact
1004 splitterX
= m_fSplitterX
;
1005 float deviation
= fabs(centerX
- splitterX
);
1006 if ( deviation
> 50.0 )
1008 splitterX
= centerX
;
1012 DoSetSplitterPosition((int)splitterX
, 0, false, true);
1014 m_fSplitterX
= splitterX
; // needed to retain accuracy
1018 void wxPropertyGridPageState::SetColumnCount( int colCount
)
1020 wxASSERT( colCount
>= 2 );
1021 m_colWidths
.SetCount( colCount
, wxPG_DRAG_MARGIN
);
1022 if ( m_colWidths
.size() > (unsigned int)colCount
)
1023 m_colWidths
.RemoveAt( m_colWidths
.size(), m_colWidths
.size() - colCount
);
1025 if ( m_pPropGrid
->GetState() == this )
1026 m_pPropGrid
->RecalculateVirtualSize();
1028 CheckColumnWidths();
1031 // Returns column index, -1 for margin
1032 int wxPropertyGridPageState::HitTestH( int x
, int* pSplitterHit
, int* pSplitterHitOffset
) const
1034 int cx
= GetGrid()->m_marginWidth
;
1036 int prevSplitter
= -1;
1041 if ( col
>= (int)m_colWidths
.size() )
1047 cx
+= m_colWidths
[col
];
1050 // Near prev. splitter
1053 int diff
= x
- prevSplitter
;
1054 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1056 *pSplitterHit
= col
- 1;
1057 *pSplitterHitOffset
= diff
;
1062 // Near next splitter
1063 int nextSplitter
= cx
;
1064 if ( col
< (int)(m_colWidths
.size()-1) )
1066 int diff
= x
- nextSplitter
;
1067 if ( abs(diff
) < wxPG_SPLITTERX_DETECTMARGIN1
)
1069 *pSplitterHit
= col
;
1070 *pSplitterHitOffset
= diff
;
1079 // -----------------------------------------------------------------------
1080 // wxPropertyGridPageState property value setting and getting
1081 // -----------------------------------------------------------------------
1083 bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty
* p
, const wxString
& value
)
1087 int flags
= wxPG_REPORT_ERROR
|wxPG_FULL_VALUE
;
1089 wxVariant variant
= p
->GetValueRef();
1092 if ( p
->GetMaxLength() <= 0 )
1093 res
= p
->StringToValue( variant
, value
, flags
);
1095 res
= p
->StringToValue( variant
, value
.Mid(0,p
->GetMaxLength()), flags
);
1099 p
->SetValue(variant
);
1100 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1101 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1109 // -----------------------------------------------------------------------
1111 bool wxPropertyGridPageState::DoSetPropertyValue( wxPGProperty
* p
, wxVariant
& value
)
1116 if ( m_selected
==p
&& this==m_pPropGrid
->GetState() )
1117 p
->UpdateControl(m_pPropGrid
->GetEditorControl());
1124 // -----------------------------------------------------------------------
1126 bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty
* p
, wxObject
* value
)
1130 // wnd_primary has to be given so the control can be updated as well.
1132 DoSetPropertyValue(p
, v
);
1138 // -----------------------------------------------------------------------
1140 void wxPropertyGridPageState::DoSetPropertyValueUnspecified( wxPGProperty
* p
)
1142 wxCHECK_RET( p
, wxT("invalid property id") );
1144 if ( !p
->IsValueUnspecified() )
1146 // Value should be set first - editor class methods may need it
1147 p
->m_value
.MakeNull();
1149 wxASSERT( m_pPropGrid
);
1151 if ( m_pPropGrid
->GetState() == this )
1153 if ( m_pPropGrid
->m_selected
== p
&& m_pPropGrid
->m_wndEditor
)
1155 p
->GetEditorClass()->SetValueToUnspecified(p
, m_pPropGrid
->GetEditorControl());
1160 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1161 DoSetPropertyValueUnspecified( p
->Item(i
) );
1165 // -----------------------------------------------------------------------
1166 // wxPropertyGridPageState property operations
1167 // -----------------------------------------------------------------------
1169 bool wxPropertyGridPageState::DoCollapse( wxPGProperty
* p
)
1171 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1173 if ( !p
->GetChildCount() ) return false;
1175 if ( !p
->IsExpanded() ) return false;
1177 p
->SetExpanded(false);
1179 VirtualHeightChanged();
1184 // -----------------------------------------------------------------------
1186 bool wxPropertyGridPageState::DoExpand( wxPGProperty
* p
)
1188 wxCHECK_MSG( p
, false, wxT("invalid property id") );
1190 if ( !p
->GetChildCount() ) return false;
1192 if ( p
->IsExpanded() ) return false;
1194 p
->SetExpanded(true);
1196 VirtualHeightChanged();
1201 // -----------------------------------------------------------------------
1203 bool wxPropertyGridPageState::DoSelectProperty( wxPGProperty
* p
, unsigned int flags
)
1205 if ( this == m_pPropGrid
->GetState() )
1206 return m_pPropGrid
->DoSelectProperty( p
, flags
);
1212 // -----------------------------------------------------------------------
1214 bool wxPropertyGridPageState::DoHideProperty( wxPGProperty
* p
, bool hide
, int flags
)
1217 p
->ClearFlag( wxPG_PROP_HIDDEN
);
1219 p
->SetFlag( wxPG_PROP_HIDDEN
);
1221 if ( flags
& wxPG_RECURSE
)
1224 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1225 DoHideProperty(p
->Item(i
), hide
, flags
| wxPG_RECURSE_STARTS
);
1228 VirtualHeightChanged();
1233 // -----------------------------------------------------------------------
1235 bool wxPropertyGridPageState::DoEnableProperty( wxPGProperty
* p
, bool enable
)
1241 if ( !(p
->m_flags
& wxPG_PROP_DISABLED
) )
1246 p
->m_flags
&= ~(wxPG_PROP_DISABLED
);
1250 if ( p
->m_flags
& wxPG_PROP_DISABLED
)
1255 p
->m_flags
|= wxPG_PROP_DISABLED
;
1259 // Apply same to sub-properties as well
1261 for ( i
= 0; i
< p
->GetChildCount(); i
++ )
1262 DoEnableProperty( p
->Item(i
), enable
);
1269 // -----------------------------------------------------------------------
1270 // wxPropertyGridPageState wxVariant related routines
1271 // -----------------------------------------------------------------------
1273 // Returns list of wxVariant objects (non-categories and non-sub-properties only).
1274 // Never includes sub-properties (unless they are parented by wxParentProperty).
1275 wxVariant
wxPropertyGridPageState::DoGetPropertyValues( const wxString
& listname
,
1276 wxPGProperty
* baseparent
,
1279 wxPGProperty
* pwc
= (wxPGProperty
*) baseparent
;
1281 // Root is the default base-parent.
1285 wxVariantList tempList
;
1286 wxVariant
v( tempList
, listname
);
1288 if ( pwc
->GetChildCount() )
1290 if ( flags
& wxPG_KEEP_STRUCTURE
)
1292 wxASSERT( !pwc
->HasFlag(wxPG_PROP_AGGREGATE
) );
1295 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1297 wxPGProperty
* p
= pwc
->Item(i
);
1298 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1300 wxVariant variant
= p
->GetValue();
1301 variant
.SetName( p
->GetBaseName() );
1302 v
.Append( variant
);
1306 v
.Append( DoGetPropertyValues(p
->m_name
,p
,flags
|wxPG_KEEP_STRUCTURE
) );
1308 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1309 v
.Append( p
->GetAttributesAsList() );
1314 wxPropertyGridConstIterator
it( this, wxPG_ITERATE_DEFAULT
, pwc
->Item(0) );
1315 it
.SetBaseParent( pwc
);
1317 for ( ; !it
.AtEnd(); it
.Next() )
1319 const wxPGProperty
* p
= it
.GetProperty();
1321 // Use a trick to ignore wxParentProperty itself, but not its sub-properties.
1322 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
1324 wxVariant variant
= p
->GetValue();
1325 variant
.SetName( p
->GetName() );
1326 v
.Append( variant
);
1327 if ( (flags
& wxPG_INC_ATTRIBUTES
) && p
->m_attributes
.GetCount() )
1328 v
.Append( p
->GetAttributesAsList() );
1337 // -----------------------------------------------------------------------
1339 void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList
& list
, wxPGProperty
* defaultCategory
)
1341 unsigned char origFrozen
= 1;
1343 if ( m_pPropGrid
->GetState() == this )
1345 origFrozen
= m_pPropGrid
->m_frozen
;
1346 if ( !origFrozen
) m_pPropGrid
->Freeze();
1349 wxPropertyCategory
* use_category
= (wxPropertyCategory
*)defaultCategory
;
1351 if ( !use_category
)
1352 use_category
= (wxPropertyCategory
*)m_properties
;
1354 // Let's iterate over the list of variants.
1355 wxVariantList::const_iterator node
;
1356 int numSpecialEntries
= 0;
1359 // Second pass for special entries
1360 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1362 wxVariant
*current
= (wxVariant
*)*node
;
1364 // Make sure it is wxVariant.
1365 wxASSERT( current
);
1366 wxASSERT( wxStrcmp(current
->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
1368 const wxString
& name
= current
->GetName();
1369 if ( name
.length() > 0 )
1372 // '@' signified a special entry
1373 if ( name
[0] == wxS('@') )
1375 numSpecialEntries
++;
1379 wxPGProperty
* foundProp
= BaseGetPropertyByName(name
);
1382 wxPGProperty
* p
= foundProp
;
1384 // If it was a list, we still have to go through it.
1385 if ( wxStrcmp(current
->GetType(), wxS("list")) == 0 )
1387 DoSetPropertyValues( current
->GetList(),
1388 p
->IsCategory()?p
:((wxPGProperty
*)NULL
)
1394 if ( wxStrcmp(current
->GetType(), p
->GetValue().GetType()) != 0)
1396 wxLogDebug(wxT("wxPropertyGridPageState::DoSetPropertyValues Warning: Setting value of property \"%s\" from variant"),
1397 p
->GetName().c_str());
1401 p
->SetValue(*current
);
1407 if ( current
->GetType() != wxS("list") )
1413 // Yes, it is; create a sub category and append contents there.
1414 wxPGProperty
* newCat
= DoInsert(use_category
,-1,new wxPropertyCategory(current
->GetName(),wxPG_LABEL
));
1415 DoSetPropertyValues( current
->GetList(), newCat
);
1422 if ( numSpecialEntries
)
1424 for ( node
= list
.begin(); node
!= list
.end(); node
++ )
1426 wxVariant
*current
= (wxVariant
*)*node
;
1428 const wxString
& name
= current
->GetName();
1429 if ( name
.length() > 0 )
1432 // '@' signified a special entry
1433 if ( name
[0] == wxS('@') )
1435 numSpecialEntries
--;
1437 size_t pos2
= name
.rfind(wxS('@'));
1438 if ( pos2
> 0 && pos2
< (name
.size()-1) )
1440 wxString propName
= name
.substr(1, pos2
-1);
1441 wxString entryType
= name
.substr(pos2
+1, wxString::npos
);
1443 if ( entryType
== wxS("attr") )
1446 // List of attributes
1447 wxPGProperty
* foundProp
= BaseGetPropertyByName(propName
);
1450 wxASSERT( wxPGIsVariantType(*current
, list
) );
1452 wxVariantList
& list2
= current
->GetList();
1453 wxVariantList::const_iterator node2
;
1455 for ( node2
= list2
.begin(); node2
!= list2
.end(); node2
++ )
1457 wxVariant
*attr
= (wxVariant
*)*node2
;
1458 foundProp
->SetAttribute( attr
->GetName(), *attr
);
1463 // ERROR: No such property: 'propName'
1469 // ERROR: Special entry requires name of format @<propname>@<entrytype>
1474 if ( !numSpecialEntries
)
1481 m_pPropGrid
->Thaw();
1483 if ( this == m_pPropGrid
->GetState() )
1485 m_selected
->UpdateControl(m_pPropGrid
->GetEditorControl());
1491 // -----------------------------------------------------------------------
1492 // wxPropertyGridPageState property adding and removal
1493 // -----------------------------------------------------------------------
1495 int wxPropertyGridPageState::PrepareToAddItem( wxPGProperty
* property
,
1496 wxPGProperty
* scheduledParent
)
1498 wxPropertyGrid
* propGrid
= m_pPropGrid
;
1500 // This will allow better behavior.
1501 if ( scheduledParent
== m_properties
)
1502 scheduledParent
= (wxPGProperty
*) NULL
;
1504 property
->m_parentState
= this;
1506 if ( property
->IsCategory() )
1509 // Parent of a category must be either root or another category
1510 // (otherwise Bad Things might happen).
1511 wxASSERT_MSG( scheduledParent
== NULL
||
1512 scheduledParent
== m_properties
||
1513 scheduledParent
->IsCategory(),
1514 wxT("Parent of a category must be either root or another category."));
1516 // If we already have category with same name, delete given property
1517 // and use it instead as most recent caption item.
1518 wxPGProperty
* found_id
= BaseGetPropertyByName( property
->GetBaseName() );
1521 wxPropertyCategory
* pwc
= (wxPropertyCategory
*) found_id
;
1522 if ( pwc
->IsCategory() ) // Must be a category.
1525 m_currentCategory
= pwc
;
1526 return 2; // Tells the caller what we did.
1532 // Warn for identical names in debug mode.
1533 if ( BaseGetPropertyByName(property
->GetName()) &&
1534 (!scheduledParent
|| scheduledParent
->IsCategory()) )
1536 wxLogError(wxT("wxPropertyGrid: Warning - item with name \"%s\" already exists."),
1537 property
->GetName().c_str());
1538 wxPGGlobalVars
->m_warnings
++;
1542 // Make sure nothing is selected.
1543 if ( propGrid
&& propGrid
->m_selected
)
1545 bool selRes
= propGrid
->ClearSelection();
1546 wxPG_CHECK_MSG_DBG( selRes
,
1548 wxT("failed to deselect a property (editor probably had invalid value)") );
1551 if ( scheduledParent
)
1553 // Use parent's colours.
1554 property
->m_bgColIndex
= scheduledParent
->m_bgColIndex
;
1555 property
->m_fgColIndex
= scheduledParent
->m_fgColIndex
;
1557 // Fix no parent does not yet have parenting flag yet, set one now
1558 if ( !scheduledParent
->HasFlag(wxPG_PROP_PARENTAL_FLAGS
) )
1559 scheduledParent
->SetParentalType(wxPG_PROP_MISC_PARENT
);
1560 //scheduledParent->SetFlag(wxPG_PROP_MISC_PARENT);
1563 // If in hideable adding mode, or if assigned parent is hideable, then
1564 // make this one hideable.
1566 ( scheduledParent
&& (scheduledParent
->m_flags
& wxPG_PROP_HIDDEN
) ) ||
1567 ( propGrid
&& (propGrid
->m_iFlags
& wxPG_FL_ADDING_HIDEABLES
) )
1569 property
->SetFlag( wxPG_PROP_HIDDEN
);
1571 // Set custom image flag.
1572 int custImgHeight
= property
->OnMeasureImage().y
;
1573 if ( custImgHeight
< 0 /*|| custImgHeight > 1*/ )
1575 property
->m_flags
|= wxPG_PROP_CUSTOMIMAGE
;
1578 if ( propGrid
&& (propGrid
->GetWindowStyleFlag() & wxPG_LIMITED_EDITING
) )
1579 property
->m_flags
|= wxPG_PROP_NOEDITOR
;
1581 if ( !property
->IsCategory() )
1583 // This is not a category.
1585 //wxASSERT_MSG( property->GetEditorClass(), wxT("Editor class not initialized!") );
1589 unsigned char depth
= 1;
1590 if ( scheduledParent
)
1592 depth
= scheduledParent
->m_depth
;
1593 if ( !scheduledParent
->IsCategory() )
1596 property
->m_depth
= depth
;
1597 unsigned char greyDepth
= depth
;
1599 if ( scheduledParent
)
1601 wxPropertyCategory
* pc
;
1603 if ( scheduledParent
->IsCategory() || scheduledParent
->IsRoot() )
1604 pc
= (wxPropertyCategory
*)scheduledParent
;
1606 // This conditional compile is necessary to
1607 // bypass some compiler bug.
1608 pc
= GetPropertyCategory(scheduledParent
);
1611 greyDepth
= pc
->GetDepth();
1613 greyDepth
= scheduledParent
->m_depthBgCol
;
1616 property
->m_depthBgCol
= greyDepth
;
1618 // Prepare children pre-added children
1619 if ( property
->GetChildCount() )
1621 property
->SetParentalType(wxPG_PROP_AGGREGATE
);
1623 property
->SetExpanded(false); // Properties with children are not expanded by default.
1624 if ( propGrid
&& propGrid
->GetWindowStyleFlag() & wxPG_HIDE_MARGIN
)
1625 property
->SetExpanded(true); // ...unless it cannot be expanded.
1627 property
->PrepareSubProperties();
1632 if ( propGrid
&& (propGrid
->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES
) )
1633 property
->SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED
, true);
1639 // This is a category.
1642 unsigned char depth
= 1;
1643 if ( scheduledParent
)
1645 depth
= scheduledParent
->m_depth
+ 1;
1647 property
->m_depth
= depth
;
1648 property
->m_depthBgCol
= depth
;
1650 m_currentCategory
= (wxPropertyCategory
*)property
;
1652 wxPropertyCategory
* pc
= (wxPropertyCategory
*)property
;
1654 // Calculate text extent for caption item.
1656 pc
->CalculateTextExtent(propGrid
, propGrid
->GetCaptionFont());
1662 // -----------------------------------------------------------------------
1664 wxPGProperty
* wxPropertyGridPageState::DoAppend( wxPGProperty
* property
)
1666 wxPropertyCategory
* cur_cat
= m_currentCategory
;
1667 if ( property
->IsCategory() )
1668 cur_cat
= (wxPropertyCategory
*) NULL
;
1670 return DoInsert( cur_cat
, -1, property
);
1673 // -----------------------------------------------------------------------
1675 wxPGProperty
* wxPropertyGridPageState::DoInsert( wxPGProperty
* parent
, int index
, wxPGProperty
* property
)
1678 parent
= m_properties
;
1680 wxCHECK_MSG( !parent
->HasFlag(wxPG_PROP_AGGREGATE
),
1682 wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
1684 int parenting
= PrepareToAddItem( property
, (wxPropertyCategory
*)parent
);
1686 // This type of invalid parenting value indicates we should exit now, returning
1687 // id of most recent category.
1688 if ( parenting
> 1 )
1689 return m_currentCategory
;
1691 // Note that item must be added into current mode later.
1693 // If parent is wxParentProperty, just stick it in...
1694 // If parent is root (m_properties), then...
1695 // In categoric mode: Add as last item in m_abcArray (if not category).
1696 // Add to given index in m_regularArray.
1697 // In non-cat mode: Add as last item in m_regularArray.
1698 // Add to given index in m_abcArray.
1699 // If parent is category, then...
1700 // 1) Add to given category in given index.
1701 // 2) Add as last item in m_abcArray.
1703 if ( !parent
->IsCategory() && !parent
->IsRoot() )
1705 // Parent is wxParentingProperty: Just stick it in...
1706 parent
->AddChild2( property
, index
);
1710 // Parent is Category or Root.
1712 if ( m_properties
== &m_regularArray
)
1716 // Only add non-categories to m_abcArray.
1717 if ( m_abcArray
&& parenting
<= 0 )
1718 m_abcArray
->AddChild2( property
, -1, false );
1720 // Add to current mode.
1721 parent
->AddChild2( property
, index
);
1726 // Non-categorized mode.
1728 if ( parent
!= m_properties
)
1729 // Parent is category.
1730 parent
->AddChild2( property
, index
, false );
1733 m_regularArray
.AddChild2( property
, -1, false );
1735 // Add to current mode (no categories).
1736 if ( parenting
<= 0 )
1737 m_abcArray
->AddChild2( property
, index
);
1742 if ( property
->IsCategory() )
1744 // This is a category caption item.
1746 // Last caption is not the bottom one (this info required by append)
1747 m_lastCaptionBottomnest
= 0;
1750 // Only add name to hashmap if parent is root or category
1751 if ( (parent
->IsCategory() || parent
->IsRoot()) && property
->m_name
.length() )
1752 m_dictName
[property
->m_name
] = (void*) property
;
1754 VirtualHeightChanged();
1756 property
->UpdateParentValues();
1763 // -----------------------------------------------------------------------
1765 void wxPropertyGridPageState::DoDelete( wxPGProperty
* item
)
1767 wxCHECK_RET( item
->GetParent(),
1768 wxT("this property was already deleted") );
1770 wxCHECK_RET( item
!= &m_regularArray
&& item
!= m_abcArray
,
1771 wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
1774 unsigned int indinparent
= item
->GetIndexInParent();
1776 wxPGProperty
* pwc
= (wxPGProperty
*)item
;
1778 wxCHECK_RET( !item
->GetParent()->HasFlag(wxPG_PROP_AGGREGATE
),
1779 wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
1781 if ( item
->IsCategory() )
1783 // deleting a category
1785 // erase category entries from the hash table
1786 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1788 wxPGProperty
* sp
= pwc
->Item( i
);
1789 if ( sp
->GetBaseName().Len() ) m_dictName
.erase(sp
->GetBaseName());
1792 if ( pwc
== m_currentCategory
)
1793 m_currentCategory
= (wxPropertyCategory
*) NULL
;
1797 // Remove children from non-categorized array.
1798 for ( i
=0; i
<pwc
->GetChildCount(); i
++ )
1800 wxPGProperty
* p
= pwc
->Item( i
);
1801 wxASSERT( p
!= NULL
);
1802 if ( !p
->IsCategory() )
1803 m_abcArray
->m_children
.Remove( p
);
1806 if ( IsInNonCatMode() )
1807 m_abcArray
->FixIndexesOfChildren();
1811 if ( !IsInNonCatMode() )
1813 // categorized mode - non-categorized array
1815 // Remove from non-cat array, but only if parent is in it
1816 if ( !item
->IsCategory() && item
->GetParent()->IsCategory() )
1820 m_abcArray
->m_children
.Remove( item
);
1824 // categorized mode - categorized array
1825 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1826 item
->m_parent
->FixIndexesOfChildren(/*indinparent*/);
1830 // non-categorized mode - categorized array
1832 // We need to find location of item.
1833 wxPGProperty
* cat_parent
= &m_regularArray
;
1834 int cat_index
= m_regularArray
.GetChildCount();
1836 for ( i
= 0; i
< m_regularArray
.GetChildCount(); i
++ )
1838 wxPGProperty
* p
= m_regularArray
.Item(i
);
1839 if ( p
== item
) { cat_index
= i
; break; }
1840 if ( p
->IsCategory() )
1842 int subind
= ((wxPGProperty
*)p
)->Index(item
);
1843 if ( subind
!= wxNOT_FOUND
)
1845 cat_parent
= ((wxPGProperty
*)p
);
1851 cat_parent
->m_children
.RemoveAt(cat_index
);
1853 // non-categorized mode - non-categorized array
1854 if ( !item
->IsCategory() )
1856 wxASSERT( item
->m_parent
== m_abcArray
);
1857 item
->m_parent
->m_children
.RemoveAt(indinparent
);
1858 item
->m_parent
->FixIndexesOfChildren(indinparent
);
1862 if ( item
->GetBaseName().Len() ) m_dictName
.erase(item
->GetBaseName());
1864 // We can actually delete it now
1867 m_itemsAdded
= 1; // Not a logical assignment (but required nonetheless).
1869 VirtualHeightChanged();
1872 // -----------------------------------------------------------------------