Phoenix Logo

phoenix_title wx.VarVScrollHelper

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

Like wx.VarScrollHelperBase, 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 wx.VScrolledWindow rather than from here directly.


class_hierarchy Class Hierarchy

Inheritance diagram for class VarVScrollHelper:

method_summary Methods Summary

__init__ Constructor taking the target window to be scrolled by this helper class.
EstimateTotalHeight 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 wx.HVScrolledWindow derived class.
GetRowCount Returns the number of rows the target window contains.
GetVisibleRowsBegin Returns the index of the first visible row based on the scroll position.
GetVisibleRowsEnd Returns the index of the last visible row based on the scroll position.
IsRowVisible Returns True if the given row is currently visible (even if only partially visible) or False otherwise.
OnGetRowHeight This function must be overridden in the derived class, and should return the height of the given row in pixels.
OnGetRowsHeightHint 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.
RefreshRow Triggers a refresh for just the given row’s area of the window if it’s visible.
RefreshRows Triggers a refresh for the area between the specified range of rows given (inclusively).
ScrollRowPages Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up).
ScrollRows Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up).
ScrollToRow Scroll to the specified row.
SetRowCount Set the number of rows the window contains.

api Class API



class wx.VarVScrollHelper(VarScrollHelperBase)

Possible constructors:

VarVScrollHelper(winToScroll)

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


Methods



__init__(self, 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.

Parameters:winToScroll (wx.Window) –


EstimateTotalHeight(self)

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 wx.HVScrolledWindow derived class.

Return type:wx.Coord

Note

This function will not be called if EstimateTotalSize is overridden in your derived class.



GetRowCount(self)

Returns the number of rows the target window contains.

Return type:int

See also

SetRowCount



GetVisibleRowsBegin(self)

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

Return type:int


GetVisibleRowsEnd(self)

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.

Return type:int


IsRowVisible(self, row)

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

Parameters:row (int) –
Return type:bool


OnGetRowHeight(self, row)

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

Parameters:row (int) –
Return type:wx.Coord


OnGetRowsHeightHint(self, rowMin, rowMax)

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.

Parameters:
  • rowMin (int) –
  • rowMax (int) –


RefreshRow(self, row)

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

Parameters:row (int) –


RefreshRows(self, from_, to_)

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

Parameters:
  • from_ (int) –
  • to_ (int) –


ScrollRowPages(self, pages)

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

Parameters:pages (int) –
Return type:bool


ScrollRows(self, rows)

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

Parameters:rows (int) –
Return type:bool
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).


ScrollToRow(self, row)

Scroll to the specified row.

It will become the first visible row in the window.

Parameters:row (int) –
Return type:bool
Returns:True if we scrolled the window, False if nothing was done.


SetRowCount(self, 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.

Parameters:rowCount (int) –

See also

GetRowCount


Properties



RowCount

See GetRowCount and SetRowCount



VisibleRowsBegin

See GetVisibleRowsBegin



VisibleRowsEnd

See GetVisibleRowsEnd