Fix wxDataViewCtrl default row height in high DPI

Use FromDIP() to ensure that it is not too small when using DPI scaling.

Also make the code slightly more clear by using a meaningful variable
name instead of a (duplicated) comment.
This commit is contained in:
Vadim Zeitlin
2022-01-22 17:14:48 +00:00
parent 1a1c02804b
commit 906808b8e5

View File

@@ -2117,14 +2117,16 @@ wxDataViewMainWindow::~wxDataViewMainWindow()
int wxDataViewMainWindow::GetDefaultRowHeight() const
{
const int SMALL_ICON_HEIGHT = FromDIP(16);
#ifdef __WXMSW__
// We would like to use the same line height that Explorer uses. This is
// different from standard ListView control since Vista.
if ( wxGetWinVersion() >= wxWinVersion_Vista )
return wxMax(16, GetCharHeight()) + 6; // 16 = mini icon height
return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(6);
else
#endif // __WXMSW__
return wxMax(16, GetCharHeight()) + 1; // 16 = mini icon height
return wxMax(SMALL_ICON_HEIGHT, GetCharHeight()) + FromDIP(1);
}