Invalidate wxPG property and its sub-properties names prior deferred deletion.
If deleted property is a category property then all its sub-properties have to be renamed prior deleting. See #16617. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -704,6 +704,16 @@ protected:
|
|||||||
/** Mark sub-properties as being deleted */
|
/** Mark sub-properties as being deleted */
|
||||||
void DoMarkChildrenAsDeleted(wxPGProperty* p, bool recursive);
|
void DoMarkChildrenAsDeleted(wxPGProperty* p, bool recursive);
|
||||||
|
|
||||||
|
/** Rename the property
|
||||||
|
so it won't remain in the way of the user code.
|
||||||
|
*/
|
||||||
|
void DoInvalidatePropertyName(wxPGProperty* p);
|
||||||
|
|
||||||
|
/** Rename sub-properties
|
||||||
|
so it won't remain in the way of the user code.
|
||||||
|
*/
|
||||||
|
void DoInvalidateChildrenNames(wxPGProperty* p, bool recursive);
|
||||||
|
|
||||||
/** If visible, then this is pointer to wxPropertyGrid.
|
/** If visible, then this is pointer to wxPropertyGrid.
|
||||||
This shall *never* be NULL to indicate that this state is not visible.
|
This shall *never* be NULL to indicate that this state is not visible.
|
||||||
*/
|
*/
|
||||||
|
@@ -1897,6 +1897,35 @@ void wxPropertyGridPageState::DoMarkChildrenAsDeleted(wxPGProperty* p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPropertyGridPageState::DoInvalidatePropertyName(wxPGProperty* p)
|
||||||
|
{
|
||||||
|
// Let's trust that no sane property uses prefix like
|
||||||
|
// this. It would be anyway fairly inconvenient (in
|
||||||
|
// current code) to check whether a new name is used
|
||||||
|
// by another property with parent (due to the child
|
||||||
|
// name notation).
|
||||||
|
wxString newName = wxT("_&/_%$") + p->GetBaseName();
|
||||||
|
DoSetPropertyName(p, newName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxPropertyGridPageState::DoInvalidateChildrenNames(wxPGProperty* p,
|
||||||
|
bool recursive)
|
||||||
|
{
|
||||||
|
if (p->IsCategory())
|
||||||
|
{
|
||||||
|
for( unsigned int i = 0; i < p->GetChildCount(); i++ )
|
||||||
|
{
|
||||||
|
wxPGProperty* child = p->Item(i);
|
||||||
|
DoInvalidatePropertyName(child);
|
||||||
|
|
||||||
|
if ( recursive )
|
||||||
|
{
|
||||||
|
DoInvalidateChildrenNames(child, recursive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
|
void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( item->GetParent(),
|
wxCHECK_RET( item->GetParent(),
|
||||||
@@ -1953,16 +1982,10 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
|
|||||||
pg->m_removedProperties.push_back(item);
|
pg->m_removedProperties.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rename the property so it won't remain in the way
|
// Rename the property and its children so it won't remain in the way
|
||||||
// of the user code.
|
// of the user code.
|
||||||
|
DoInvalidatePropertyName(item);
|
||||||
// Let's trust that no sane property uses prefix like
|
DoInvalidateChildrenNames(item, true);
|
||||||
// this. It would be anyway fairly inconvenient (in
|
|
||||||
// current code) to check whether a new name is used
|
|
||||||
// by another property with parent (due to the child
|
|
||||||
// name notation).
|
|
||||||
wxString newName = wxS("_&/_%$") + item->GetBaseName();
|
|
||||||
DoSetPropertyName(item, newName);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user