Fully conform to the documented statement according to which names of properties with non-root, non-category parent are not stored in the per-page hash map.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-12-20 16:01:13 +00:00
parent 91c818f829
commit 267400868a

View File

@@ -453,8 +453,15 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p,
{ {
wxCHECK_RET( p, wxT("invalid property id") ); wxCHECK_RET( p, wxT("invalid property id") );
if ( p->GetBaseName().Len() ) m_dictName.erase( p->GetBaseName() ); wxPGProperty* parent = p->GetParent();
if ( newName.Len() ) m_dictName[newName] = (void*) p;
if ( parent->IsCategory() || parent->IsRoot() )
{
if ( p->GetBaseName().length() )
m_dictName.erase( p->GetBaseName() );
if ( newName.length() )
m_dictName[newName] = (void*) p;
}
p->DoSetName(newName); p->DoSetName(newName);
} }
@@ -1676,7 +1683,8 @@ 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 ( (parent->IsCategory() || parent->IsRoot()) && property->m_name.length() ) if ( property->m_name.length() &&
(parent->IsCategory() || parent->IsRoot()) )
m_dictName[property->m_name] = (void*) property; m_dictName[property->m_name] = (void*) property;
VirtualHeightChanged(); VirtualHeightChanged();
@@ -1771,7 +1779,9 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
} }
} }
if ( item->GetBaseName().Len() ) m_dictName.erase(item->GetBaseName()); if ( item->GetBaseName().length() &&
(parent->IsCategory() || parent->IsRoot()) )
m_dictName.erase(item->GetBaseName());
// We can actually delete it now // We can actually delete it now
if ( doDelete ) if ( doDelete )