added GetVisibleBegin/End() to complement/replace GetFirst/LastVisibleLine() and use them in the code to fix problems when the control is empty and GetLastVisibleLine() returns (size_t)-1 (closes bug 1176561)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -118,14 +118,26 @@ public:
|
||||
size_t GetLineCount() const { return m_lineMax; }
|
||||
|
||||
// get the first currently visible line
|
||||
size_t GetFirstVisibleLine() const { return m_lineFirst; }
|
||||
size_t GetVisibleBegin() const { return m_lineFirst; }
|
||||
|
||||
// get the last currently visible line
|
||||
size_t GetLastVisibleLine() const { return m_lineFirst + m_nVisible - 1; }
|
||||
// get the first currently visible line
|
||||
size_t GetVisibleEnd() const { return m_lineFirst + m_nVisible; }
|
||||
|
||||
// is this line currently visible?
|
||||
bool IsVisible(size_t line) const
|
||||
{ return line >= m_lineFirst && line <= GetLastVisibleLine(); }
|
||||
{ return line >= GetVisibleBegin() && line < GetVisibleEnd(); }
|
||||
|
||||
|
||||
// this is the same as GetVisibleBegin(), exists to match
|
||||
// GetLastVisibleLine() and for backwards compatibility only
|
||||
size_t GetFirstVisibleLine() const { return m_lineFirst; }
|
||||
|
||||
// get the last currently visible line
|
||||
//
|
||||
// this function is unsafe as it returns (size_t)-1 (i.e. a huge positive
|
||||
// number) if the control is empty, use GetVisibleEnd() instead, this one
|
||||
// is kept for backwards compatibility
|
||||
size_t GetLastVisibleLine() const { return GetVisibleEnd() - 1; }
|
||||
|
||||
|
||||
protected:
|
||||
|
Reference in New Issue
Block a user