]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
Added missing not operator that was preventing the drawing of the
[wxWidgets.git] / src / msw / mdi.cpp
index 89040acf21dc561d485b470c87e4511dce049360..63d39498843c7e0d3aede3a8d83e322b3295c25d 100644 (file)
@@ -27,7 +27,6 @@
 #if wxUSE_MDI && !defined(__WXUNIVERSAL__)
 
 #ifndef WX_PRECOMP
-    #include "wx/setup.h"
     #include "wx/frame.h"
     #include "wx/menu.h"
     #include "wx/app.h"
@@ -215,6 +214,8 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
       return false;
   }
 
+  SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
+
   // unlike (almost?) all other windows, frames are created hidden
   m_isShown = false;
 
@@ -751,7 +752,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
     msflags |= WS_MINIMIZEBOX;
   if (style & wxMAXIMIZE_BOX)
     msflags |= WS_MAXIMIZEBOX;
-  if (style & wxTHICK_FRAME)
+  if (style & wxRESIZE_BORDER)
     msflags |= WS_THICKFRAME;
   if (style & wxSYSTEM_MENU)
     msflags |= WS_SYSMENU;
@@ -807,6 +808,11 @@ bool wxMDIChildFrame::Show(bool show)
     if ( show )
         ::BringWindowToTop(GetHwnd());
 
+    // we need to refresh the MDI frame window menu to include (or exclude if
+    // we've been hidden) this frame
+    wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+    MDISetMenu(parent->GetClientWindow(), NULL, NULL);
+
     return true;
 }
 
@@ -1106,13 +1112,6 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
             lpPos->cx = rectClient.right - rectClient.left;
             lpPos->cy = rectClient.bottom - rectClient.top;
         }
-#if wxUSE_TOOLBAR
-        wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
-        if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown())
-        {
-            pFrameWnd->GetToolBar()->Refresh();
-        }
-#endif
     }
 
     return false;
@@ -1160,7 +1159,9 @@ WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXL
 
 bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
 {
-    return wxFrame::MSWTranslateMessage(msg);
+    // we must pass the parent frame to ::TranslateAccelerator(), otherwise it
+    // doesn't do its job correctly for MDI child menus
+    return MSWDoTranslateMessage((wxMDIChildFrame *)GetParent(), msg);
 }
 
 // ---------------------------------------------------------------------------
@@ -1373,13 +1374,16 @@ void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
 
 static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
 {
-    ::SendMessage(GetWinHwnd(win), WM_MDISETMENU,
-#ifdef __WIN32__
-                  (WPARAM)hmenuFrame, (LPARAM)hmenuWindow
-#else
-                  0, MAKELPARAM(hmenuFrame, hmenuWindow)
-#endif
-                 );
+    if ( hmenuFrame || hmenuWindow )
+    {
+        if ( !::SendMessage(GetWinHwnd(win),
+                            WM_MDISETMENU,
+                            (WPARAM)hmenuFrame,
+                            (LPARAM)hmenuWindow) )
+        {
+            wxLogLastError(_T("SendMessage(WM_MDISETMENU)"));
+        }
+    }
 
     // update menu bar of the parent window
     wxWindow *parent = win->GetParent();