Fixed searching the elements in wxArrayPGProperty.
Use dedicated Index() function to search elements in wxArray instead of calling custom function.
This commit is contained in:
@@ -321,19 +321,6 @@ WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxObject*, wxArrayPGObject,
|
|||||||
wxBaseArrayPtrVoid,
|
wxBaseArrayPtrVoid,
|
||||||
class WXDLLIMPEXP_PROPGRID);
|
class WXDLLIMPEXP_PROPGRID);
|
||||||
|
|
||||||
// Utility to find if specific item is in a vector. Returns index to
|
|
||||||
// the item, or wxNOT_FOUND if not present.
|
|
||||||
template<typename CONTAINER, typename T>
|
|
||||||
int wxPGFindInVector( CONTAINER vector, const T& item )
|
|
||||||
{
|
|
||||||
for ( unsigned int i=0; i<vector.size(); i++ )
|
|
||||||
{
|
|
||||||
if ( vector[i] == item )
|
|
||||||
return (int) i;
|
|
||||||
}
|
|
||||||
return wxNOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
enum wxPG_GETPROPERTYVALUES_FLAGS
|
enum wxPG_GETPROPERTYVALUES_FLAGS
|
||||||
|
@@ -747,7 +747,7 @@ wxPropertyGrid* wxPGProperty::GetGrid() const
|
|||||||
|
|
||||||
int wxPGProperty::Index( const wxPGProperty* p ) const
|
int wxPGProperty::Index( const wxPGProperty* p ) const
|
||||||
{
|
{
|
||||||
return wxPGFindInVector(m_children, p);
|
return m_children.Index(const_cast<wxPGProperty*>(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
|
bool wxPGProperty::ValidateValue( wxVariant& WXUNUSED(value), wxPGValidationInfo& WXUNUSED(validationInfo) ) const
|
||||||
|
@@ -5621,6 +5621,21 @@ void wxPropertyGrid::ClearActionTriggers( int action )
|
|||||||
while ( didSomething );
|
while ( didSomething );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_3_0
|
||||||
|
// Utility to find if specific item is in a vector. Returns index to
|
||||||
|
// the item, or wxNOT_FOUND if not present.
|
||||||
|
template<typename CONTAINER, typename T>
|
||||||
|
int wxPGFindInVector( CONTAINER vector, const T& item )
|
||||||
|
{
|
||||||
|
for ( unsigned int i=0; i<vector.size(); i++ )
|
||||||
|
{
|
||||||
|
if ( vector[i] == item )
|
||||||
|
return (int) i;
|
||||||
|
}
|
||||||
|
return wxNOT_FOUND;
|
||||||
|
}
|
||||||
|
#endif // WXWIN_COMPATIBILITY_3_0
|
||||||
|
|
||||||
void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@@ -1355,10 +1355,7 @@ bool wxPropertyGridPageState::DoSetPropertyValueWxObjectPtr( wxPGProperty* p, wx
|
|||||||
|
|
||||||
bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty* prop ) const
|
bool wxPropertyGridPageState::DoIsPropertySelected( wxPGProperty* prop ) const
|
||||||
{
|
{
|
||||||
if ( wxPGFindInVector(m_selection, prop) != wxNOT_FOUND )
|
return m_selection.Index(prop) != wxNOT_FOUND;
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user