diff --git a/docs/changes.txt b/docs/changes.txt index 1dddc2922c..ba093bf66b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -669,6 +669,7 @@ wxMSW: - Fix wxRichMessageDialog return value for dialog with only "OK" button. - Fix precision loss in wxGraphicsContext::{Draw,Stroke}Lines() (tibo_). - Fix destroying the font from wxFont::GetFaceName() in some cases (aebailey82). +- Fix wxCheckListBox appearance when using larger fonts (Igor Korot). wxOSX: diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 4a452a16bf..5509e049cf 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -37,7 +37,13 @@ #if wxUSE_OWNER_DRAWN #include "wx/ownerdrw.h" -#endif + + namespace + { + // space beneath/above each row in pixels + const int LISTBOX_EXTRA_SPACE = 1; + } // anonymous namespace +#endif // wxUSE_OWNER_DRAWN // ============================================================================ // list box item declaration and implementation @@ -642,6 +648,13 @@ bool wxListBox::SetFont(const wxFont &font) const unsigned count = m_aItems.GetCount(); for ( unsigned i = 0; i < count; i++ ) m_aItems[i]->SetFont(font); + + // Non owner drawn list boxes update the item height on their own, but + // we need to do it manually in the owner drawn case. + wxClientDC dc(this); + dc.SetFont(font); + SendMessage(GetHwnd(), LB_SETITEMHEIGHT, 0, + dc.GetCharHeight() + 2 * LISTBOX_EXTRA_SPACE); } wxListBoxBase::SetFont(font); @@ -684,13 +697,6 @@ bool wxListBox::RefreshItem(size_t n) // drawing // ------- -namespace -{ - // space beneath/above each row in pixels - static const int LISTBOX_EXTRA_SPACE = 1; - -} // anonymous namespace - // the height is the same for all items // TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes