Add wxListBox::GetTopItem() and GetCountPerPage()

Implement these methods for all the major ports, add them to the widgets
sample and documentation.

Closes #17189.
This commit is contained in:
Andreas Falkenhahn
2016-02-06 18:32:13 +01:00
committed by Vadim Zeitlin
parent 256f644861
commit 6a01623a80
13 changed files with 135 additions and 2 deletions

View File

@@ -253,6 +253,22 @@ void wxListBox::EnsureVisible(int n)
DoSetFirstItem(n - countVisible + 1);
}
int wxListBox::GetTopItem() const
{
return SendMessage(GetHwnd(), LB_GETTOPINDEX, 0, 0);
}
int wxListBox::GetCountPerPage() const
{
const LRESULT lineHeight = SendMessage(GetHwnd(), LB_GETITEMHEIGHT, 0, 0);
if ( lineHeight == LB_ERR || lineHeight == 0 )
return -1;
const RECT r = wxGetClientRect(GetHwnd());
return (r.bottom - r.top) / lineHeight;
}
void wxListBox::DoSetFirstItem(int N)
{
wxCHECK_RET( IsValid(N),