Fixed broken 'hidden categories' mode (aka. alphabetic mode); Added distinct names and labels for the two root properties (to help with debugging); Refactored wxPropertyGridState::DoInsert()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58543 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2358,7 +2358,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/** Constructor. */
|
/** Constructor. */
|
||||||
wxPGRootProperty();
|
wxPGRootProperty( const wxString& name = wxS("<Root>") );
|
||||||
virtual ~wxPGRootProperty();
|
virtual ~wxPGRootProperty();
|
||||||
|
|
||||||
virtual bool StringToValue( wxVariant&, const wxString&, int ) const
|
virtual bool StringToValue( wxVariant&, const wxString&, int ) const
|
||||||
|
@@ -569,9 +569,6 @@ public:
|
|||||||
|
|
||||||
bool IsInNonCatMode() const { return (bool)(m_properties == m_abcArray); }
|
bool IsInNonCatMode() const { return (bool)(m_properties == m_abcArray); }
|
||||||
|
|
||||||
/** Only inits arrays, doesn't migrate things or such. */
|
|
||||||
void InitNonCatMode ();
|
|
||||||
|
|
||||||
void DoLimitPropertyEditing( wxPGProperty* p, bool limit = true )
|
void DoLimitPropertyEditing( wxPGProperty* p, bool limit = true )
|
||||||
{
|
{
|
||||||
p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
|
p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
|
||||||
@@ -707,6 +704,10 @@ protected:
|
|||||||
unsigned char m_anyModified;
|
unsigned char m_anyModified;
|
||||||
|
|
||||||
unsigned char m_vhCalcPending;
|
unsigned char m_vhCalcPending;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Only inits arrays, doesn't migrate things or such. */
|
||||||
|
void InitNonCatMode();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef SWIG
|
#endif // #ifndef SWIG
|
||||||
|
@@ -2430,11 +2430,14 @@ WX_PG_IMPLEMENT_PROPERTY_CLASS_PLAIN(wxPGRootProperty,none,TextCtrl)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxPGRootProperty, wxPGProperty)
|
IMPLEMENT_DYNAMIC_CLASS(wxPGRootProperty, wxPGProperty)
|
||||||
|
|
||||||
|
|
||||||
wxPGRootProperty::wxPGRootProperty()
|
wxPGRootProperty::wxPGRootProperty( const wxString& name )
|
||||||
: wxPGProperty()
|
: wxPGProperty()
|
||||||
{
|
{
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
m_name = wxS("<root>");
|
m_name = name;
|
||||||
|
m_label = m_name;
|
||||||
|
#else
|
||||||
|
wxUnusedVar(name);
|
||||||
#endif
|
#endif
|
||||||
SetParentalType(0);
|
SetParentalType(0);
|
||||||
m_depth = 0;
|
m_depth = 0;
|
||||||
|
@@ -231,7 +231,7 @@ void wxPropertyGridPageState::InitNonCatMode()
|
|||||||
{
|
{
|
||||||
if ( !m_abcArray )
|
if ( !m_abcArray )
|
||||||
{
|
{
|
||||||
m_abcArray = new wxPGRootProperty();
|
m_abcArray = new wxPGRootProperty(wxS("<Root_NonCat>"));
|
||||||
m_abcArray->SetParentState(this);
|
m_abcArray->SetParentState(this);
|
||||||
m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
|
m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
|
||||||
}
|
}
|
||||||
@@ -683,17 +683,9 @@ void wxPropertyGridPageState::DoSort( int flags )
|
|||||||
{
|
{
|
||||||
DoSortChildren( m_properties, flags | wxPG_RECURSE );
|
DoSortChildren( m_properties, flags | wxPG_RECURSE );
|
||||||
|
|
||||||
// Sort categories as well (but we need not do it recursively)
|
// We used to sort categories as well here also if in non-categorized
|
||||||
if ( IsInNonCatMode() )
|
// mode, but doing would naturally cause child indices to become
|
||||||
{
|
// corrupted.
|
||||||
size_t i;
|
|
||||||
for ( i=0;i<m_regularArray.GetChildCount();i++)
|
|
||||||
{
|
|
||||||
wxPGProperty* p = m_regularArray.Item(i);
|
|
||||||
if ( p->IsCategory() )
|
|
||||||
DoSortChildren( p, 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -1644,6 +1636,9 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
|
|||||||
if ( !res )
|
if ( !res )
|
||||||
return m_currentCategory;
|
return m_currentCategory;
|
||||||
|
|
||||||
|
bool parentIsRoot = parent->IsRoot();
|
||||||
|
bool parentIsCategory = parent->IsCategory();
|
||||||
|
|
||||||
// Note that item must be added into current mode later.
|
// Note that item must be added into current mode later.
|
||||||
|
|
||||||
// If parent is wxParentProperty, just stick it in...
|
// If parent is wxParentProperty, just stick it in...
|
||||||
@@ -1656,42 +1651,34 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
|
|||||||
// 1) Add to given category in given index.
|
// 1) Add to given category in given index.
|
||||||
// 2) Add as last item in m_abcArray.
|
// 2) Add as last item in m_abcArray.
|
||||||
|
|
||||||
if ( !parent->IsCategory() && !parent->IsRoot() )
|
if ( m_properties == &m_regularArray )
|
||||||
{
|
{
|
||||||
// Parent is wxParentingProperty: Just stick it in...
|
// We are currently in Categorized mode
|
||||||
parent->AddChild2( property, index );
|
|
||||||
|
// Only add non-categories to m_abcArray.
|
||||||
|
if ( m_abcArray && !property->IsCategory() &&
|
||||||
|
(parentIsCategory || parentIsRoot) )
|
||||||
|
{
|
||||||
|
m_abcArray->AddChild2( property, -1, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to current mode.
|
||||||
|
parent->AddChild2( property, index, true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Parent is Category or Root.
|
// We are currently in Non-categorized/Alphabetic mode
|
||||||
|
|
||||||
if ( m_properties == &m_regularArray )
|
if ( parentIsCategory )
|
||||||
{
|
// Parent is category.
|
||||||
// Categorized mode
|
parent->AddChild2( property, index, false );
|
||||||
|
else if ( parentIsRoot )
|
||||||
|
// Parent is root.
|
||||||
|
m_regularArray.AddChild2( property, -1, false );
|
||||||
|
|
||||||
// Only add non-categories to m_abcArray.
|
// Add to current mode
|
||||||
if ( m_abcArray && !property->IsCategory() )
|
if ( !property->IsCategory() )
|
||||||
m_abcArray->AddChild2( property, -1, false );
|
m_abcArray->AddChild2( property, index, true );
|
||||||
|
|
||||||
// Add to current mode.
|
|
||||||
parent->AddChild2( property, index );
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Non-categorized mode.
|
|
||||||
|
|
||||||
if ( parent != m_properties )
|
|
||||||
// Parent is category.
|
|
||||||
parent->AddChild2( property, index, false );
|
|
||||||
else
|
|
||||||
// Parent is root.
|
|
||||||
m_regularArray.AddChild2( property, -1, false );
|
|
||||||
|
|
||||||
// Add to current mode (no categories).
|
|
||||||
if ( !property->IsCategory() )
|
|
||||||
m_abcArray->AddChild2( property, index );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// category stuff
|
// category stuff
|
||||||
@@ -1705,7 +1692,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
|
|||||||
|
|
||||||
// Only add name to hashmap if parent is root or category
|
// Only add name to hashmap if parent is root or category
|
||||||
if ( property->m_name.length() &&
|
if ( property->m_name.length() &&
|
||||||
(parent->IsCategory() || parent->IsRoot()) )
|
(parentIsCategory || parentIsRoot) )
|
||||||
m_dictName[property->m_name] = (void*) property;
|
m_dictName[property->m_name] = (void*) property;
|
||||||
|
|
||||||
VirtualHeightChanged();
|
VirtualHeightChanged();
|
||||||
|
Reference in New Issue
Block a user