# wxVarHScrollHelper Class Reference
[Miscellaneous Windows]

`#include <wx/vscroll.h>`

Inheritance diagram for wxVarHScrollHelper:
[legend]

## Detailed Description

This class provides functions wrapping the wxVarScrollHelperBase class, targeted for horizontal-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 wxHScrolledWindow rather than from here directly.

##

Library: wxCore

Category: Miscellaneous Windows

See also:
  wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow

## Public Member Functions
| wxVarHScrollHelper (wxWindow *winToScroll)
| Constructor taking the target window to be scrolled by this helper class.
size_t | GetColumnCount () const
| Returns the number of columns the target window contains.
size_t | GetVisibleColumnsBegin () const
| Returns the index of the first visible column based on the scroll position.
size_t | GetVisibleColumnsEnd () const
| Returns the index of the last visible column based on the scroll position.
bool | IsColumnVisible (size_t column) const
| Returns true if the given column is currently visible (even if only partially visible) or false otherwise.
virtual void | RefreshColumn (size_t column)
| Triggers a refresh for just the given column's area of the window if it's visible.
virtual void | RefreshColumns (size_t from, size_t to)
| Triggers a refresh for the area between the specified range of columns given (inclusively).
virtual bool | ScrollColumnPages (int pages)
| Scroll by the specified number of pages which may be positive (to scroll right) or negative (to scroll left).
virtual bool | ScrollColumns (int columns)
| Scroll by the specified number of columns which may be positive (to scroll right) or negative (to scroll left).
bool | ScrollToColumn (size_t column)
| Scroll to the specified column.
void | SetColumnCount (size_t columnCount)
| Set the number of columns the window contains.
## Protected Member Functions
virtual wxCoord | EstimateTotalWidth () 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 void | OnGetColumnsWidthHint (size_t columnMin, size_t columnMax) const
| This function doesn't have to be overridden but it may be useful to do so if calculating the columns' 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 | OnGetColumnWidth (size_t column) const =0
| This function must be overridden in the derived class, and should return the width of the given column in pixels.

List of all members.

## Constructor & Destructor Documentation

wxVarHScrollHelper::wxVarHScrollHelper | ( | 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 wxVarHScrollHelper::EstimateTotalWidth | ( |  | ) | 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 wxVarHScrollHelper::GetColumnCount | ( |  | ) | const

Returns the number of columns the target window contains.

See also:
  SetColumnCount()

size_t wxVarHScrollHelper::GetVisibleColumnsBegin | ( |  | ) | const

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

size_t wxVarHScrollHelper::GetVisibleColumnsEnd | ( |  | ) | const

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

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

bool wxVarHScrollHelper::IsColumnVisible | ( | size_t | column | ) | const

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

virtual void wxVarHScrollHelper::OnGetColumnsWidthHint | ( | size_t | columnMin,
|  | size_t | columnMax |
| ) |  |  | const`[protected, virtual]`

This function doesn't have to be overridden but it may be useful to do so if calculating the columns' 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.

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

Finally, note that columnMin is inclusive, while columnMax is exclusive.

virtual wxCoord wxVarHScrollHelper::OnGetColumnWidth | ( | size_t | column | ) | const`[protected, pure virtual]`

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

virtual void wxVarHScrollHelper::RefreshColumn | ( | size_t | column | ) | `[virtual]`

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

virtual void wxVarHScrollHelper::RefreshColumns | ( | size_t | from,
|  | size_t | to |
| ) |  |  | `[virtual]`

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

virtual bool wxVarHScrollHelper::ScrollColumnPages | ( | int | pages | ) | `[virtual]`

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

virtual bool wxVarHScrollHelper::ScrollColumns | ( | int | columns | ) | `[virtual]`

Scroll by the specified number of columns which may be positive (to scroll right) or negative (to scroll left).

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

bool wxVarHScrollHelper::ScrollToColumn | ( | size_t | column | ) |

Scroll to the specified column.

It will become the first visible column in the window.

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

void wxVarHScrollHelper::SetColumnCount | ( | size_t | columnCount | ) |

Set the number of columns the window contains.

The derived class must provide the widths for all columns with indices up to the one given here in it's OnGetColumnWidth() implementation.

See also:
  GetColumnCount()

|  | [ top ]