]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/menu.cpp
The alignment controls are now left-aligned if the floating controls are not shown.
[wxWidgets.git] / src / msw / menu.cpp
index f1559bdb5780b5b5cd7d86bf00ff9a14ae2d1ac1..f2bcc2000e51673b805a40133ad887af09b6c593 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Julian Smart
 // Modified by: Vadim Zeitlin
 // Created:     04/01/98
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -543,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__
@@ -696,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
@@ -727,6 +730,12 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
 
             return false;
         }
+
+        if ( makeItemOwnerDrawn )
+        {
+            SetOwnerDrawnMenuItem(GetHmenu(), pos,
+                                  reinterpret_cast<ULONG_PTR>(pItem), TRUE);
+        }
     }
 
 
@@ -1534,6 +1543,10 @@ void wxMenuBar::RebuildAccelTable()
 
         delete [] accelEntries;
     }
+    else // No (more) accelerators.
+    {
+        SetAcceleratorTable(wxAcceleratorTable());
+    }
 }
 
 #endif // wxUSE_ACCEL