Prevent wxCheckListBox from corrupting menu item by changing ms_nLastMarginWidth (regarding defect #4068). SetOwnMarginWidth() member function needed to be added into wxOwnerDrawn.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-10-30 14:11:03 +00:00
parent bbd5034121
commit cea22c0fac
3 changed files with 13 additions and 1 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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());
}