Improve wxListBox::GetCountPerPage() in wxGTK and wxOSX
Provide native implementation of this function instead of using the ad hoc one in common code, which didn't really work -- so remove it completely now. Closes #17189.
This commit is contained in:
committed by
Vadim Zeitlin
parent
accf7ab117
commit
e77cb6f31f
@@ -34,15 +34,6 @@
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
// the spacing between the lines (in report mode)
|
||||
static const int LINE_SPACING = 0;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
static const int EXTRA_HEIGHT = 6;
|
||||
#else
|
||||
static const int EXTRA_HEIGHT = 4;
|
||||
#endif
|
||||
|
||||
extern WXDLLEXPORT_DATA(const char) wxListBoxNameStr[] = "listBox";
|
||||
|
||||
// ============================================================================
|
||||
@@ -349,24 +340,4 @@ void wxListBoxBase::EnsureVisible(int WXUNUSED(n))
|
||||
// the base class version does nothing (the only alternative would be to
|
||||
// call SetFirstItem() but this is probably even more stupid)
|
||||
}
|
||||
|
||||
wxCoord wxListBoxBase::GetLineHeight() const
|
||||
{
|
||||
wxListBoxBase *self = wxConstCast(this, wxListBoxBase);
|
||||
|
||||
wxClientDC dc( self );
|
||||
dc.SetFont( GetFont() );
|
||||
|
||||
wxCoord y;
|
||||
dc.GetTextExtent(wxT("H"), NULL, &y);
|
||||
|
||||
y += EXTRA_HEIGHT;
|
||||
|
||||
return y + LINE_SPACING;
|
||||
}
|
||||
|
||||
int wxListBoxBase::GetCountPerPage() const
|
||||
{
|
||||
return GetClientSize().y / GetLineHeight();
|
||||
}
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
Reference in New Issue
Block a user