diff --git a/docs/changes.txt b/docs/changes.txt index 07d15bba21..c245e5eab0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -141,6 +141,7 @@ wxMSW: - Worked around child window and caret positioning bug (in Windows) when using wxBORDER_THEME in a container window. - Suppressed spurious character event for decimal key in numeric keypad. +- Prevented wxCheckListBox from corrupting menu items. wxGTK: diff --git a/include/wx/ownerdrw.h b/include/wx/ownerdrw.h index 55ec29893f..cfbc5769a1 100644 --- a/include/wx/ownerdrw.h +++ b/include/wx/ownerdrw.h @@ -144,6 +144,16 @@ protected: // get the font to use, whether m_font is set or not wxFont GetFontToUse() const; + // Same as wxOwnerDrawn::SetMarginWidth() but does not affect + // ms_nLastMarginWidth. Exists solely to work around bug #4068, + // and will not exist in wxWidgets 2.9.0 and later. + void SetOwnMarginWidth(int nWidth) + { + m_nMarginWidth = (size_t) nWidth; + if ( ((size_t) nWidth) != ms_nDefaultMarginWidth ) + m_bOwnerDrawn = true; + } + wxString m_strName, // label for a manu item m_strAccel; // the accel string ("Ctrl-F17") if any diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index 5fd1765fc5..e81704a84e 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -160,8 +160,9 @@ wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) // fix appearance for check list boxes: they don't look quite the same as // menu icons - SetMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - + SetOwnMarginWidth(::GetSystemMetrics(SM_CXMENUCHECK) - 2*wxSystemSettings::GetMetric(wxSYS_EDGE_X) + 1); + SetBackgroundColour(pParent->GetBackgroundColour()); }