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¶
Known Subclasses¶
wx.VScrolledWindow, wx.VarHVScrollHelper
Methods Summary¶
Constructor taking the target window to be scrolled by this helper class. |
|
This class forwards calls from |
|
Returns the number of rows the target window contains. |
|
Returns the index of the first visible row based on the scroll position. |
|
Returns the index of the last visible row based on the scroll position. |
|
Returns |
|
This function must be overridden in the derived class, and should return the height of the given row in pixels. |
|
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. |
|
Triggers a refresh for just the given row’s area of the window if it’s visible. |
|
Triggers a refresh for the area between the specified range of rows given (inclusively). |
|
Scroll by the specified number of pages which may be positive (to scroll down) or negative (to scroll up). |
|
Scroll by the specified number of rows which may be positive (to scroll down) or negative (to scroll up). |
|
Scroll to the specified row. |
|
Set the number of rows the window contains. |
Properties Summary¶
See |
|
Class API¶
- class wx.VarVScrollHelper(VarScrollHelperBase)¶
Possible constructors:
VarVScrollHelper(winToScroll) -> None
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)
- Return type:
None
- 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:
int
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
- 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) orFalse
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:
int
- 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 beforeOnGetRowHeight
but you shouldn’t rely on the latter being called for all rows in the interval specified here. It is also possible thatOnGetRowHeight
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)
- Return type:
None
- RefreshRow(self, row)¶
Triggers a refresh for just the given row’s area of the window if it’s visible.
- Parameters:
row (int)
- Return type:
None
- RefreshRows(self, from_, to_)¶
Triggers a refresh for the area between the specified range of rows given (inclusively).
- Parameters:
from_ (int)
to_ (int)
- Return type:
None
- 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)
- Return type:
None
See also
Properties¶
- RowCount¶
See
GetRowCount
andSetRowCount
- VisibleRowsBegin¶
- VisibleRowsEnd¶