// we're initially empty
m_rowsMax =
m_columnsMax =
- m_rowsFirst =
+ m_rowsFirst =
m_columnsFirst = 0;
// these should always be strictly positive
// and our estimate for their total height and width
m_heightTotal = EstimateTotalHeight();
m_widthTotal = EstimateTotalWidth();
-
+
// recalculate the scrollbars parameters
if(m_rowsFirst >= rowCount)
- m_rowsFirst = rowCount-1;
+ m_rowsFirst = (rowCount > 0) ? rowCount - 1 : 0;
if(m_columnsFirst >= columnCount)
- m_columnsFirst = columnCount-1;
-
+ m_columnsFirst = (columnCount > 0) ? columnCount - 1 : 0;
+
+#if 0
+ // checks disabled due to size_t type of members
+ // but leave them here if anyone would want to do some debugging
if(m_rowsFirst < 0)
m_rowsFirst = 0;
-
+
if(m_columnsFirst < 0)
m_columnsFirst = 0;
+#endif
ScrollToRowColumn(m_rowsFirst, m_columnsFirst);
}
rect.height = OnGetRowHeight(row);
rect.width = OnGetColumnWidth(column);
- for ( size_t n = GetVisibleRowsBegin(); n < row; n++ )
+ size_t n;
+
+ for ( n = GetVisibleRowsBegin(); n < row; n++ )
{
rect.y += OnGetRowHeight(n);
}
- for ( size_t n = GetVisibleColumnsBegin(); n < column; n++ )
+ for ( n = GetVisibleColumnsBegin(); n < column; n++ )
{
rect.x += OnGetColumnWidth(n);
}
// calculate the rect occupied by these lines on screen
wxRect rect;
- for ( size_t nBefore = GetVisibleRowsBegin();
+ size_t nBefore, nBetween;
+
+ for ( nBefore = GetVisibleRowsBegin();
nBefore < fromRow;
nBefore++ )
{
rect.y += OnGetRowHeight(nBefore);
}
- for ( size_t nBetween = fromRow; nBetween <= toRow; nBetween++ )
+ for ( nBetween = fromRow; nBetween <= toRow; nBetween++ )
{
rect.height += OnGetRowHeight(nBetween);
}
- for ( size_t nBefore = GetVisibleColumnsBegin();
+ for ( nBefore = GetVisibleColumnsBegin();
nBefore < fromColumn;
nBefore++ )
{
rect.x += OnGetColumnWidth(nBefore);
}
- for ( size_t nBetween = fromColumn; nBetween <= toColumn; nBetween++ )
+ for ( nBetween = fromColumn; nBetween <= toColumn; nBetween++ )
{
rect.width += OnGetColumnWidth(nBetween);
}
// virtual size and scrolled position of the window.
int x, y, w, h;
-
+
y = -GetRowsHeight(0, GetVisibleRowsBegin());
x = -GetColumnsWidth(0, GetVisibleColumnsBegin());
GetVirtualSize(&w, &h);
- GetSizer()->SetDimension(0, y, w, h);
+ GetSizer()->SetDimension(x, y, w, h);
return true;
}
if ( y < 0 )
hit.y = row;
}
-
+
for ( size_t column = GetVisibleColumnsBegin();
column <= columnMax;
column++ )
size_t lineFirstLast = FindFirstFromBottom(m_rowsMax - 1, true);
if ( row > lineFirstLast )
row = lineFirstLast;
-
+
// anything to do?
if ( row == m_rowsFirst )
{
// finally, scroll the actual window contents vertically
if(m_physicalScrolling)
ScrollWindow(0, GetRowsHeight(GetVisibleRowsBegin(), lineFirstOld));
-
+
return true;
}
ScrollToRow(rowsFirstNew);
}
-
+
#ifdef __WXMAC__
Update();
}
#endif
-