- int w, h;
- GetClientSize(&w, &h);
-
- // Recalculate scroll bar range and position
- if (m_xScrollLines > 0)
- {
- int nMaxWidth = m_xScrollLines*m_xScrollPixelsPerLine;
- int newRange = (int) ( ((nMaxWidth)/(float)m_xScrollPixelsPerLine) + 0.5 );
- if (newRange < 0)
- newRange = 0;
-
- m_xScrollPosition = wxMin(newRange, m_xScrollPosition);
-
- // Calculate page size i.e. number of scroll units you get on the
- // current client window
- int noPagePositions = (int) ( (w/(float)m_xScrollPixelsPerLine) + 0.5 );
- if (noPagePositions < 1)
- noPagePositions = 1;
-
- SetScrollbar(wxHORIZONTAL, m_xScrollPosition, noPagePositions, newRange);
- SetScrollPageSize(wxHORIZONTAL, noPagePositions);
- }
- // Robert Roebling
- else
- {
- m_xScrollPosition = 0;
- SetScrollbar (wxHORIZONTAL, 0, 0, 0, FALSE);
- }
-
- if (m_yScrollLines > 0)
- {
- int nMaxHeight = m_yScrollLines*m_yScrollPixelsPerLine;
- int newRange = (int) ( ((nMaxHeight)/(float)m_yScrollPixelsPerLine) + 0.5 );
- if (newRange < 0)
- newRange = 0;
-
- m_yScrollPosition = wxMin(newRange, m_yScrollPosition);
-
- // Calculate page size i.e. number of scroll units you get on the
- // current client window
- int noPagePositions = (int) ( (h/(float)m_yScrollPixelsPerLine) + 0.5 );
- if (noPagePositions < 1)
- noPagePositions = 1;
-
- SetScrollbar(wxVERTICAL, m_yScrollPosition, noPagePositions, newRange);
- SetScrollPageSize(wxVERTICAL, noPagePositions);
- }
- else
- {
- m_yScrollPosition = 0;
- SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE); // Robert Roebling
- }
-
-}