Correct making the newly inserted menu item owner drawn in some cases.
The item being inserted is not inserted yet when we call SetOwnerDrawnMenuItem() so we must call it separately for it after inserting it. Closes #15437. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -542,6 +542,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
|
||||
// check if we have something more than a simple text item
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
bool makeItemOwnerDrawn = false;
|
||||
if ( pItem->IsOwnerDrawn() )
|
||||
{
|
||||
#ifndef __DMC__
|
||||
@@ -695,6 +696,9 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
// set menu as ownerdrawn
|
||||
m_ownerDrawn = true;
|
||||
|
||||
// also ensure that the new item itself is made owner drawn
|
||||
makeItemOwnerDrawn = true;
|
||||
|
||||
ResetMaxAccelWidth();
|
||||
}
|
||||
// only update our margin for equals alignment to other item
|
||||
@@ -726,6 +730,12 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( makeItemOwnerDrawn )
|
||||
{
|
||||
SetOwnerDrawnMenuItem(GetHmenu(), pos,
|
||||
reinterpret_cast<ULONG_PTR>(pItem), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user