Use wxVector<int> instead of wxArrayInt
This commit is contained in:
@@ -642,13 +642,13 @@ protected:
|
|||||||
wxPGHashMapS2P m_dictName;
|
wxPGHashMapS2P m_dictName;
|
||||||
|
|
||||||
// List of column widths (first column does not include margin).
|
// List of column widths (first column does not include margin).
|
||||||
wxArrayInt m_colWidths;
|
wxVector<int> m_colWidths;
|
||||||
|
|
||||||
// List of indices of columns the user can edit by clicking it.
|
// List of indices of columns the user can edit by clicking it.
|
||||||
wxArrayInt m_editableColumns;
|
wxVector<int> m_editableColumns;
|
||||||
|
|
||||||
// Column proportions.
|
// Column proportions.
|
||||||
wxArrayInt m_columnProportions;
|
wxVector<int> m_columnProportions;
|
||||||
|
|
||||||
double m_fSplitterX;
|
double m_fSplitterX;
|
||||||
|
|
||||||
|
@@ -137,6 +137,22 @@ DeletedObjects gs_deletedEditorObjects;
|
|||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Utility to check if specific item is in a vector.
|
||||||
|
template<typename T>
|
||||||
|
static bool wxPGItemExistsInVector(const wxVector<T>& vector, const T& item)
|
||||||
|
{
|
||||||
|
#if wxUSE_STL
|
||||||
|
return std::find(vector.begin(), vector.end(), item) != vector.end();
|
||||||
|
#else
|
||||||
|
for ( wxVector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it )
|
||||||
|
{
|
||||||
|
if ( *it == item )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif // wxUSE_STL/!wxUSE_STL
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
@@ -802,7 +818,7 @@ bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop,
|
|||||||
// send event
|
// send event
|
||||||
DoClearSelection(false, wxPG_SEL_NO_REFRESH);
|
DoClearSelection(false, wxPG_SEL_NO_REFRESH);
|
||||||
|
|
||||||
if ( m_pState->m_editableColumns.Index(colIndex) == wxNOT_FOUND )
|
if ( !wxPGItemExistsInVector<int>(m_pState->m_editableColumns, colIndex) )
|
||||||
{
|
{
|
||||||
res = DoAddToSelection(prop, selFlags);
|
res = DoAddToSelection(prop, selFlags);
|
||||||
}
|
}
|
||||||
@@ -972,7 +988,7 @@ void wxPropertyGrid::MakeColumnEditable( unsigned int column,
|
|||||||
wxS("Set wxPG_PROP_READONLY property flag instead")
|
wxS("Set wxPG_PROP_READONLY property flag instead")
|
||||||
);
|
);
|
||||||
|
|
||||||
wxArrayInt& cols = m_pState->m_editableColumns;
|
wxVector<int>& cols = m_pState->m_editableColumns;
|
||||||
|
|
||||||
if ( editable )
|
if ( editable )
|
||||||
{
|
{
|
||||||
@@ -2145,7 +2161,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
|
|
||||||
const wxPGProperty* firstSelected = GetSelection();
|
const wxPGProperty* firstSelected = GetSelection();
|
||||||
const wxPropertyGridPageState* state = m_pState;
|
const wxPropertyGridPageState* state = m_pState;
|
||||||
const wxArrayInt& colWidths = state->m_colWidths;
|
const wxVector<int>& colWidths = state->m_colWidths;
|
||||||
const unsigned int colCount = state->GetColumnCount();
|
const unsigned int colCount = state->GetColumnCount();
|
||||||
|
|
||||||
// TODO: Only render columns that are within clipping region.
|
// TODO: Only render columns that are within clipping region.
|
||||||
@@ -5587,24 +5603,6 @@ void wxPropertyGrid::ClearActionTriggers( int action )
|
|||||||
while ( didSomething );
|
while ( didSomething );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_3_0
|
|
||||||
// Utility to check if specific item is in a vector.
|
|
||||||
template<typename T>
|
|
||||||
static bool wxPGItemExistsInVector(const wxVector<T>& vector, const T& item)
|
|
||||||
{
|
|
||||||
#if wxUSE_STL
|
|
||||||
return std::find(vector.begin(), vector.end(), item) != vector.end();
|
|
||||||
#else
|
|
||||||
for (wxVector<T>::const_iterator it = vector.begin(); it != vector.end(); ++it)
|
|
||||||
{
|
|
||||||
if ( *it == item )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
#endif // wxUSE_STL/!wxUSE_STL
|
|
||||||
}
|
|
||||||
#endif // WXWIN_COMPATIBILITY_3_0
|
|
||||||
|
|
||||||
void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@@ -1219,11 +1219,8 @@ void wxPropertyGridPageState::ResetColumnSizes( int setSplitterFlags )
|
|||||||
void wxPropertyGridPageState::SetColumnCount( int colCount )
|
void wxPropertyGridPageState::SetColumnCount( int colCount )
|
||||||
{
|
{
|
||||||
wxASSERT( colCount >= 2 );
|
wxASSERT( colCount >= 2 );
|
||||||
m_colWidths.SetCount( colCount, wxPG_DRAG_MARGIN );
|
m_colWidths.resize(colCount, wxPG_DRAG_MARGIN);
|
||||||
m_columnProportions.SetCount( colCount, 1 );
|
m_columnProportions.resize(colCount, 1);
|
||||||
if ( m_colWidths.size() > (unsigned int)colCount )
|
|
||||||
m_colWidths.RemoveAt( m_colWidths.size()-1,
|
|
||||||
m_colWidths.size() - colCount );
|
|
||||||
|
|
||||||
if ( m_pPropGrid->GetState() == this )
|
if ( m_pPropGrid->GetState() == this )
|
||||||
m_pPropGrid->RecalculateVirtualSize();
|
m_pPropGrid->RecalculateVirtualSize();
|
||||||
|
Reference in New Issue
Block a user