]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
toplevel event handler exposed
[wxWidgets.git] / src / msw / mdi.cpp
index 626131f0bec930314b458027b714ce07e33664d9..72ba895be88e9ab97db486ce46dfb91d66fa0920 100644 (file)
@@ -233,12 +233,14 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
 
 wxMDIParentFrame::~wxMDIParentFrame()
 {
-    DestroyChildren();
-
-    // already delete by DestroyChildren()
+    // see comment in ~wxMDIChildFrame
+#if wxUSE_TOOLBAR
     m_frameToolBar = NULL;
+#endif
     m_frameStatusBar = NULL;
 
+    DestroyChildren();
+
     if (m_windowMenu)
     {
         delete m_windowMenu;
@@ -380,11 +382,11 @@ void wxMDIParentFrame::ActivatePrevious()
 // the MDI parent frame window proc
 // ---------------------------------------------------------------------------
 
-long wxMDIParentFrame::MSWWindowProc(WXUINT message,
+WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
                                      WXWPARAM wParam,
                                      WXLPARAM lParam)
 {
-    long rc = 0;
+    WXLRESULT rc = 0;
     bool processed = false;
 
     switch ( message )
@@ -594,7 +596,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
     return false;
 }
 
-long wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
+WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
                                         WXWPARAM wParam,
                                         WXLPARAM lParam)
 {
@@ -671,9 +673,9 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
 
   MDICREATESTRUCT mcs;
 
-  mcs.szClass = style & wxNO_FULL_REPAINT_ON_RESIZE
-                    ? wxMDIChildFrameClassNameNoRedraw
-                    : wxMDIChildFrameClassName;
+  mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
+                    ? wxMDIChildFrameClassName
+                    : wxMDIChildFrameClassNameNoRedraw;
   mcs.szTitle = title;
   mcs.hOwner = wxGetInstance();
   if (x > -1)
@@ -696,7 +698,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
   else
       mcs.cy = CW_USEDEFAULT;
 
-  DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE ;
+  DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ;
   if (style & wxMINIMIZE_BOX)
     msflags |= WS_MINIMIZEBOX;
   if (style & wxMAXIMIZE_BOX)
@@ -730,12 +732,15 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
 
 wxMDIChildFrame::~wxMDIChildFrame()
 {
-    DestroyChildren();
-
-    // already deleted by DestroyChildren()
+    // will be destroyed by DestroyChildren() but reset them before calling it
+    // to avoid using dangling pointers if a callback comes in the meanwhile
+#if wxUSE_TOOLBAR
     m_frameToolBar = NULL;
+#endif
     m_frameStatusBar = NULL;
 
+    DestroyChildren();
+
     RemoveWindowMenu(NULL, m_hMenu);
 
     MSWDestroyWindow();
@@ -854,11 +859,11 @@ void wxMDIChildFrame::Activate()
 // MDI window proc and message handlers
 // ---------------------------------------------------------------------------
 
-long wxMDIChildFrame::MSWWindowProc(WXUINT message,
+WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message,
                                     WXWPARAM wParam,
                                     WXLPARAM lParam)
 {
-    long rc = 0;
+    WXLRESULT rc = 0;
     bool processed = false;
 
     switch ( message )
@@ -1026,11 +1031,13 @@ 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
     }
 #endif // Win95
 
@@ -1071,7 +1078,7 @@ bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo)
 // MDI specific message translation/preprocessing
 // ---------------------------------------------------------------------------
 
-long wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXUINT wParam, WXLPARAM lParam)
+WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 {
     return DefMDIChildProc(GetHwnd(),
                            (UINT)message, (WPARAM)wParam, (LPARAM)lParam);
@@ -1299,9 +1306,7 @@ static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
     wxWindow *parent = win->GetParent();
     wxCHECK_RET( parent, wxT("MDI client without parent frame? weird...") );
 
-#ifndef __WIN16__
     ::SendMessage(GetWinHwnd(win), WM_MDIREFRESHMENU, 0, 0L);
-#endif
 
     ::DrawMenuBar(GetWinHwnd(parent));
 }
@@ -1389,15 +1394,9 @@ static void RemoveWindowMenu(wxWindow *win, WXHMENU menu)
 static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
                               WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact)
 {
-#ifdef __WIN32__
     *activate = true;
     *hwndAct = (WXHWND)lParam;
     *hwndDeact = (WXHWND)wParam;
-#else // Win16
-    *activate = (WXWORD)wParam;
-    *hwndAct = (WXHWND)LOWORD(lParam);
-    *hwndDeact = (WXHWND)HIWORD(lParam);
-#endif // Win32/Win16
 }
 
 #endif