Use getter functions to get access to some properties of wxPropertyGridPageState.

Use existing GetColumnCount(), GetColumnWidth() functions instead of getting direct access to corresponding member variables.
This commit is contained in:
Artur Wieczorek
2015-05-24 20:44:20 +02:00
parent b3ad8dae84
commit fec5f36139
3 changed files with 8 additions and 7 deletions

View File

@@ -994,7 +994,7 @@ public:
*/ */
unsigned int GetColumnCount() const unsigned int GetColumnCount() const
{ {
return (unsigned int) m_pState->m_colWidths.size(); return m_pState->GetColumnCount();
} }
/** Returns colour of empty space below properties. */ /** Returns colour of empty space below properties. */

View File

@@ -1770,7 +1770,7 @@ void wxPropertyGrid::CorrectEditorWidgetSizeX()
// Use fixed selColumn 1 for main editor widgets // Use fixed selColumn 1 for main editor widgets
int newSplitterx = m_pState->DoGetSplitterPosition(0); int newSplitterx = m_pState->DoGetSplitterPosition(0);
int newWidth = newSplitterx + m_pState->m_colWidths[1]; int newWidth = newSplitterx + m_pState->GetColumnWidth(1);
if ( m_wndEditor2 ) if ( m_wndEditor2 )
{ {

View File

@@ -1208,7 +1208,7 @@ wxSize wxPropertyGrid::DoGetBestSize() const
wxClientDC dc(const_cast<wxPropertyGrid *>(this)); wxClientDC dc(const_cast<wxPropertyGrid *>(this));
int width = m_marginWidth; int width = m_marginWidth;
for ( unsigned int i = 0; i < m_pState->m_colWidths.size(); i++ ) for ( unsigned int i = 0; i < m_pState->GetColumnCount(); i++ )
{ {
width += m_pState->GetColumnFitWidth(dc, m_pState->DoGetRoot(), i, true); width += m_pState->GetColumnFitWidth(dc, m_pState->DoGetRoot(), i, true);
} }
@@ -2174,6 +2174,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 wxArrayInt& colWidths = state->m_colWidths;
const unsigned int colCount = state->GetColumnCount();
// TODO: Only render columns that are within clipping region. // TODO: Only render columns that are within clipping region.
@@ -2269,7 +2270,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
unsigned int si; unsigned int si;
int sx = x; int sx = x;
for ( si=0; si<colWidths.size(); si++ ) for ( si = 0; si < colCount; si++ )
{ {
sx += colWidths[si]; sx += colWidths[si];
dc.DrawLine( sx, y, sx, y2 ); dc.DrawLine( sx, y, sx, y2 );
@@ -2407,14 +2408,14 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
// Calculate cellRect.x for the last cell // Calculate cellRect.x for the last cell
unsigned int ci = 0; unsigned int ci = 0;
int cellX = x + 1; int cellX = x + 1;
for ( ci=0; ci<colWidths.size(); ci++ ) for ( ci = 0; ci < colCount; ci++ )
cellX += colWidths[ci]; cellX += colWidths[ci];
cellRect.x = cellX; cellRect.x = cellX;
// Draw cells from back to front so that we can easily tell if the // Draw cells from back to front so that we can easily tell if the
// cell on the right was empty from text // cell on the right was empty from text
bool prevFilled = true; bool prevFilled = true;
ci = colWidths.size(); ci = colCount;
do do
{ {
ci--; ci--;
@@ -3753,7 +3754,7 @@ wxRect wxPropertyGrid::GetEditorWidgetRect( wxPGProperty* p, int column ) const
{ {
int itemy = p->GetY2(m_lineHeight); int itemy = p->GetY2(m_lineHeight);
int splitterX = m_pState->DoGetSplitterPosition(column-1); int splitterX = m_pState->DoGetSplitterPosition(column-1);
int colEnd = splitterX + m_pState->m_colWidths[column]; int colEnd = splitterX + m_pState->GetColumnWidth(column);
int imageOffset = 0; int imageOffset = 0;
int vx, vy; // Top left corner of client int vx, vy; // Top left corner of client