From ee3de647ffd5891138864d032bc0f2bd5a130ef0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 27 Aug 2013 22:49:28 +0000 Subject: [PATCH] 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 --- src/msw/menu.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index ffdbf8b57d..f2bcc2000e 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -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(pItem), TRUE); + } } -- 2.45.2