]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/menu.cpp
wxUniv compilation fixes
[wxWidgets.git] / src / msw / menu.cpp
index 6bce598d97bcbefbf583ab69716a91fdc89233f4..ca6ab1b99c178c8fd86ddd7706ca2d7ec36d73ca 100644 (file)
@@ -615,7 +615,10 @@ wxMenuBar::~wxMenuBar()
 {
     // In Windows CE, the menubar is always associated
     // with a toolbar, which destroys the menu implicitly.
-#ifndef __WXWINCE__
+#ifdef __WXWINCE__
+    if (GetToolBar())
+        GetToolBar()->SetMenuBar(NULL);
+#else
     // we should free Windows resources only if Windows doesn't do it for us
     // which happens if we're attached to a frame
     if (m_hMenu && !IsAttached())
@@ -646,6 +649,10 @@ void wxMenuBar::Refresh()
 
 WXHMENU wxMenuBar::Create()
 {
+    // Note: this totally doesn't work on Smartphone,
+    // since you have to use resources.
+    // We'll have to find another way to add a menu
+    // by changing/adding menu items to an existing menu.
 #ifdef __WXWINCE__
     if ( m_hMenu != 0 )
         return m_hMenu;
@@ -670,9 +677,11 @@ WXHMENU wxMenuBar::Create()
             tbButton.dwData = (DWORD)hPopupMenu;
             wxString label = wxStripMenuCodes(GetLabelTop(i));
             tbButton.iString = (int) label.c_str();
+
+            int position = i;
             
             tbButton.idCommand = NewControlId();
-            if (!::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton))
+            if (!::SendMessage(hCommandBar, TB_INSERTBUTTON, position, (LPARAM)&tbButton))
             {
                 wxLogLastError(wxT("TB_INSERTBUTTON"));
             }