Version: 3.1.0
wxVarHVScrollHelper Class Reference

#include <wx/vscroll.h>

+ Inheritance diagram for wxVarHVScrollHelper:

Detailed Description

This class provides functions wrapping the wxVarHScrollHelper and wxVarVScrollHelper classes, targeted for scrolling a window in both axis.

Since this class is also the join class of the horizontal and vertical scrolling functionality, it also addresses some wrappers that help avoid the need to specify class scope in your wxHVScrolledWindow derived class when using wxVarScrollHelperBase functionality.

Like all three of it's scroll helper base classes, 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 wxHVScrolledWindow rather than from here directly.

Library:  wxCore
Category:  Miscellaneous Windows
See Also
wxHScrolledWindow, wxHVScrolledWindow, wxVScrolledWindow

Public Member Functions

 wxVarHVScrollHelper (wxWindow *winToScroll)
 Constructor taking the target window to be scrolled by this helper class.
 
void EnablePhysicalScrolling (bool vscrolling=true, bool hscrolling=true)
 With physical scrolling on (when this is true), the device origin is changed properly when a wxPaintDC is prepared, children are actually moved and laid out properly, and the contents of the window (pixels) are actually moved.
 
wxSize GetRowColumnCount () const
 Returns the number of columns and rows the target window contains.
 
wxPosition GetVisibleBegin () const
 Returns the index of the first visible column and row based on the current scroll position.
 
wxPosition GetVisibleEnd () const
 Returns the index of the last visible column and row based on the scroll position.
 
void SetRowColumnCount (size_t rowCount, size_t columnCount)
 Set the number of rows and columns the target window will contain.
 
bool IsVisible (size_t row, size_t column) const
 Returns true if both the given row and column are currently visible (even if only partially visible) or false otherwise.
 
bool IsVisible (const wxPosition &pos) const
 Returns true if both the given row and column are currently visible (even if only partially visible) or false otherwise.
 
virtual void RefreshRowColumn (size_t row, size_t column)
 Triggers a refresh for just the area shared between the given row and column of the window if it is visible.
 
virtual void RefreshRowColumn (const wxPosition &pos)
 Triggers a refresh for just the area shared between the given row and column of the window if it is visible.
 
virtual void RefreshRowsColumns (size_t fromRow, size_t toRow, size_t fromColumn, size_t toColumn)
 Triggers a refresh for the visible area shared between all given rows and columns (inclusive) of the window.
 
virtual void RefreshRowsColumns (const wxPosition &from, const wxPosition &to)
 Triggers a refresh for the visible area shared between all given rows and columns (inclusive) of the window.
 
bool ScrollToRowColumn (size_t row, size_t column)
 Scroll to the specified row and column.
 
bool ScrollToRowColumn (const wxPosition &pos)
 Scroll to the specified row and column.
 
wxPosition VirtualHitTest (wxCoord x, wxCoord y) const
 Returns the virtual scroll unit under the device unit given accounting for scroll position or wxNOT_FOUND (for the row, column, or possibly both values) if none.
 
wxPosition VirtualHitTest (const wxPoint &pos) const
 Returns the virtual scroll unit under the device unit given accounting for scroll position or wxNOT_FOUND (for the row, column, or possibly both values) if none.
 
- Public Member Functions inherited from wxVarVScrollHelper
 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.
 
- Public Member Functions inherited from wxVarScrollHelperBase
 wxVarScrollHelperBase (wxWindow *winToScroll)
 Constructor taking the target window to be scrolled by this helper class.
 
virtual ~wxVarScrollHelperBase ()
 Virtual destructor for detaching scroll event handlers attached with this helper class.
 
int CalcScrolledPosition (int coord) const
 Translates the logical coordinate given to the current device coordinate.
 
int CalcUnscrolledPosition (int coord) const
 Translates the device coordinate given to the corresponding logical coordinate.
 
void EnablePhysicalScrolling (bool scrolling=true)
 With physical scrolling on (when this is true), the device origin is changed properly when a wxPaintDC is prepared, children are actually moved and laid out properly, and the contents of the window (pixels) are actually moved.
 
virtual int GetNonOrientationTargetSize () const =0
 This function needs to be overridden in the in the derived class to return the window size with respect to the opposing orientation.
 
virtual wxOrientation GetOrientation () const =0
 This function need to be overridden to return the orientation that this helper is working with, either wxHORIZONTAL or wxVERTICAL.
 
virtual int GetOrientationTargetSize () const =0
 This function needs to be overridden in the in the derived class to return the window size with respect to the orientation this helper is working with.
 
virtual wxWindowGetTargetWindow () const
 This function will return the target window this helper class is currently scrolling.
 
size_t GetVisibleBegin () const
 Returns the index of the first visible unit based on the scroll position.
 
size_t GetVisibleEnd () const
 Returns the index of the last visible unit based on the scroll position.
 
bool IsVisible (size_t unit) const
 Returns true if the given scroll unit is currently visible (even if only partially visible) or false otherwise.
 
virtual void RefreshAll ()
 Recalculate all parameters and repaint all units.
 
virtual void SetTargetWindow (wxWindow *target)
 Normally the window will scroll itself, but in some rare occasions you might want it to scroll (part of) another window (e.g.
 
virtual void UpdateScrollbar ()
 Update the thumb size shown by the scrollbar.
 
int VirtualHitTest (wxCoord coord) const
 Returns the virtual scroll unit under the device unit given accounting for scroll position or wxNOT_FOUND if none (i.e.
 
- Public Member Functions inherited from wxVarHScrollHelper
 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.
 

Additional Inherited Members

- Protected Member Functions inherited from wxVarVScrollHelper
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.
 
- Protected Member Functions inherited from wxVarHScrollHelper
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.
 

Constructor & Destructor Documentation

wxVarHVScrollHelper::wxVarHVScrollHelper ( 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

void wxVarHVScrollHelper::EnablePhysicalScrolling ( bool  vscrolling = true,
bool  hscrolling = true 
)

With physical scrolling on (when this is true), the device origin is changed properly when a wxPaintDC is prepared, children are actually moved and laid out properly, and the contents of the window (pixels) are actually moved.

When this is false, you are responsible for repainting any invalidated areas of the window yourself to account for the new scroll position.

Parameters
vscrollingSpecifies if physical scrolling should be turned on when scrolling vertically.
hscrollingSpecifies if physical scrolling should be turned on when scrolling horizontally.
wxSize wxVarHVScrollHelper::GetRowColumnCount ( ) const

Returns the number of columns and rows the target window contains.

See Also
SetRowColumnCount()
wxPosition wxVarHVScrollHelper::GetVisibleBegin ( ) const

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

wxPosition wxVarHVScrollHelper::GetVisibleEnd ( ) const

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

This includes any partially visible columns or rows.

bool wxVarHVScrollHelper::IsVisible ( size_t  row,
size_t  column 
) const

Returns true if both the given row and column are currently visible (even if only partially visible) or false otherwise.

bool wxVarHVScrollHelper::IsVisible ( const wxPosition pos) const

Returns true if both the given row and column are currently visible (even if only partially visible) or false otherwise.

virtual void wxVarHVScrollHelper::RefreshRowColumn ( size_t  row,
size_t  column 
)
virtual

Triggers a refresh for just the area shared between the given row and column of the window if it is visible.

virtual void wxVarHVScrollHelper::RefreshRowColumn ( const wxPosition pos)
virtual

Triggers a refresh for just the area shared between the given row and column of the window if it is visible.

virtual void wxVarHVScrollHelper::RefreshRowsColumns ( size_t  fromRow,
size_t  toRow,
size_t  fromColumn,
size_t  toColumn 
)
virtual

Triggers a refresh for the visible area shared between all given rows and columns (inclusive) of the window.

If the target window for both orientations is the same, the rectangle of cells is refreshed; if the target windows differ, the entire client size opposite the orientation direction is refreshed between the specified limits.

virtual void wxVarHVScrollHelper::RefreshRowsColumns ( const wxPosition from,
const wxPosition to 
)
virtual

Triggers a refresh for the visible area shared between all given rows and columns (inclusive) of the window.

If the target window for both orientations is the same, the rectangle of cells is refreshed; if the target windows differ, the entire client size opposite the orientation direction is refreshed between the specified limits.

bool wxVarHVScrollHelper::ScrollToRowColumn ( size_t  row,
size_t  column 
)

Scroll to the specified row and column.

It will become the first visible row and column in the window. Returns true if we scrolled the window, false if nothing was done.

bool wxVarHVScrollHelper::ScrollToRowColumn ( const wxPosition pos)

Scroll to the specified row and column.

It will become the first visible row and column in the window. Returns true if we scrolled the window, false if nothing was done.

void wxVarHVScrollHelper::SetRowColumnCount ( size_t  rowCount,
size_t  columnCount 
)

Set the number of rows and columns the target window will contain.

The derived class must provide the sizes for all rows and columns with indices up to the ones given here in it's OnGetRowHeight() and OnGetColumnWidth() implementations, respectively.

See Also
GetRowColumnCount()
wxPosition wxVarHVScrollHelper::VirtualHitTest ( wxCoord  x,
wxCoord  y 
) const

Returns the virtual scroll unit under the device unit given accounting for scroll position or wxNOT_FOUND (for the row, column, or possibly both values) if none.

wxPosition wxVarHVScrollHelper::VirtualHitTest ( const wxPoint pos) const

Returns the virtual scroll unit under the device unit given accounting for scroll position or wxNOT_FOUND (for the row, column, or possibly both values) if none.