APplied patch [ 731719 ] Owner draw font leak/overuse

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-05-03 11:58:18 +00:00
parent 10fc146318
commit e0754b1233
2 changed files with 19 additions and 5 deletions

View File

@@ -104,7 +104,7 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
: wxMenuItemBase(parentMenu, id, text, help,
isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu)
#if wxUSE_OWNER_DRAWN
, wxOwnerDrawn(text, isCheckable)
, wxOwnerDrawn(text, isCheckable, TRUE)
#endif // owner drawn
{
Init();

View File

@@ -46,7 +46,7 @@
// ctor
// ----
wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
bool bCheckable, bool WXUNUSED(bMenuItem))
bool bCheckable, bool bMenuItem)
: m_strName(str)
{
#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
@@ -64,9 +64,23 @@ wxOwnerDrawn::wxOwnerDrawn(const wxString& str,
ms_nLastMarginWidth = nm.iMenuWidth;
}
wxNativeFontInfo info;
memcpy(&info.lf, &nm.lfMenuFont, sizeof(LOGFONT));
m_font.Create(info);
if (bMenuItem)
{
static wxFont menu_font;
if (!menu_font.Ok())
{
// create menu font
wxNativeFontInfo info;
memcpy(&info.lf, &nm.lfMenuFont, sizeof(LOGFONT));
menu_font.Create(info);
}
m_font = menu_font;
}
else
{
m_font = *wxNORMAL_FONT;
}
#else
// windows clean install default
m_nMinHeight = 18;