# wxVarVScrollHelper Class Reference
[Miscellaneous Windows]

`#include <wx/vscroll.h>`

Inheritance diagram for wxVarVScrollHelper:
[legend]

## Detailed Description

This class provides functions wrapping the wxVarScrollHelperBase class, targeted for vertical-specific scrolling.

Like wxVarScrollHelperBase, this class is mostly only useful to those classes built into wxWidgets deriving from here, and this documentation is mostly only provided for referencing the functions provided by this class. You will likely want to derive your window from wxVScrolledWindow rather than from here directly.

##

Library: wxCore

Category: Miscellaneous Windows

See also:
  wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow

## Public Member Functions
| wxVarVScrollHelper (wxWindow *winToScroll)
| Constructor taking the target window to be scrolled by this helper class.
size_t | GetRowCount () const
| Returns the number of rows the target window contains.
size_t | GetVisibleRowsBegin () const
| Returns the index of the first visible row based on the scroll position.
size_t | GetVisibleRowsEnd () const
| Returns the index of the last visible row based on the scroll position.
bool | IsRowVisible (size_t row) const
| Returns true if the given row is currently visible (even if only partially visible) or false otherwise.
virtual void | RefreshRow (size_t row)
| Triggers a refresh for just the given row's area of the window if it's visible.
virtual void | RefreshRows (size_t from, size_t to)
| Triggers a refresh for the area between the specified range of rows given (inclusively).
virtual bool | ScrollRowPages (int pages)
| Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up).
virtual bool | ScrollRows (int rows)
| Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up).
bool | ScrollToRow (size_t row)
| Scroll to the specified row.
void | SetRowCount (size_t rowCount)
| Set the number of rows the window contains.
## Protected Member Functions
virtual void | OnGetRowsHeightHint (size_t rowMin, size_t rowMax) const
| This function doesn't have to be overridden but it may be useful to do so if calculating the rows' sizes is a relatively expensive operation as it gives your code a chance to calculate several of them at once and cache the result if necessary.
virtual wxCoord | EstimateTotalHeight () const
| This class forwards calls from EstimateTotalSize() to this function so derived classes can override either just the height or the width estimation, or just estimate both differently if desired in any wxHVScrolledWindow derived class.
virtual wxCoord | OnGetRowHeight (size_t row) const =0
| This function must be overridden in the derived class, and should return the height of the given row in pixels.

List of all members.

## Constructor & Destructor Documentation

wxVarVScrollHelper::wxVarVScrollHelper | ( | wxWindow * | winToScroll | ) |

Constructor taking the target window to be scrolled by this helper class.

This will attach scroll event handlers to the target window to catch and handle scroll events appropriately.

## Member Function Documentation

virtual wxCoord wxVarVScrollHelper::EstimateTotalHeight | ( |  | ) | const`[protected, virtual]`

This class forwards calls from EstimateTotalSize() to this function so derived classes can override either just the height or the width estimation, or just estimate both differently if desired in any wxHVScrolledWindow derived class.

Note:
  This function will not be called if EstimateTotalSize() is overridden in your derived class.

size_t wxVarVScrollHelper::GetRowCount | ( |  | ) | const

Returns the number of rows the target window contains.

See also:
  SetRowCount()

size_t wxVarVScrollHelper::GetVisibleRowsBegin | ( |  | ) | const

Returns the index of the first visible row based on the scroll position.

size_t wxVarVScrollHelper::GetVisibleRowsEnd | ( |  | ) | const

Returns the index of the last visible row based on the scroll position.

This includes the last row even if it is only partially visible.

bool wxVarVScrollHelper::IsRowVisible | ( | size_t | row | ) | const

Returns true if the given row is currently visible (even if only partially visible) or false otherwise.

virtual wxCoord wxVarVScrollHelper::OnGetRowHeight | ( | size_t | row | ) | const`[protected, pure virtual]`

This function must be overridden in the derived class, and should return the height of the given row in pixels.

virtual void wxVarVScrollHelper::OnGetRowsHeightHint | ( | size_t | rowMin,
|  | size_t | rowMax |
| ) |  |  | const`[protected, virtual]`

This function doesn't have to be overridden but it may be useful to do so if calculating the rows' sizes is a relatively expensive operation as it gives your code a chance to calculate several of them at once and cache the result if necessary.

OnGetRowsHeightHint() is normally called just before OnGetRowHeight() but you shouldn't rely on the latter being called for all rows in the interval specified here. It is also possible that OnGetRowHeight() will be called for units outside of this interval, so this is really just a hint, not a promise.

Finally, note that rowMin is inclusive, while rowMax is exclusive.

virtual void wxVarVScrollHelper::RefreshRow | ( | size_t | row | ) | `[virtual]`

Triggers a refresh for just the given row's area of the window if it's visible.

virtual void wxVarVScrollHelper::RefreshRows | ( | size_t | from,
|  | size_t | to |
| ) |  |  | `[virtual]`

Triggers a refresh for the area between the specified range of rows given (inclusively).

virtual bool wxVarVScrollHelper::ScrollRowPages | ( | int | pages | ) | `[virtual]`

Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up).

virtual bool wxVarVScrollHelper::ScrollRows | ( | int | rows | ) | `[virtual]`

Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up).

Returns:
  true if the window was scrolled, false otherwise (for example, if we're trying to scroll down but we are already showing the last row).

bool wxVarVScrollHelper::ScrollToRow | ( | size_t | row | ) |

Scroll to the specified row.

It will become the first visible row in the window.

Returns:
  true if we scrolled the window, false if nothing was done.

void wxVarVScrollHelper::SetRowCount | ( | size_t | rowCount | ) |

Set the number of rows the window contains.

The derived class must provide the heights for all rows with indices up to the one given here in it's OnGetRowHeight() implementation.

See also:
  GetRowCount()

|  | [ top ]