]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/menu.cpp
Fix flickering of wxStaticBox background in wxMSW.
[wxWidgets.git] / src / msw / menu.cpp
index ffdbf8b57dc50dde525c9866c362fc3135c36ca9..f2bcc2000e51673b805a40133ad887af09b6c593 100644 (file)
@@ -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);
+        }
     }