X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e441e1f4e8671915ee9bb32049edb4f1d700126e..79630806b65160fe7a433f243a6aa9b55e690aec:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 5d2e46955c..6b7b5d50a8 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -28,7 +28,7 @@ #pragma hdrstop #endif -#if wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__) +#if wxUSE_MDI && !defined(__WXUNIVERSAL__) #ifndef WX_PRECOMP #include "wx/setup.h" @@ -62,7 +62,6 @@ // global variables // --------------------------------------------------------------------------- -extern wxWindowList wxModelessWindows; // from dialog.cpp extern wxMenu *wxCurrentPopupMenu; extern const wxChar *wxMDIFrameClassName; // from app.cpp @@ -223,8 +222,6 @@ bool wxMDIParentFrame::Create(wxWindow *parent, return false; } - wxModelessWindows.Append(this); - // unlike (almost?) all other windows, frames are created hidden m_isShown = false; @@ -233,11 +230,15 @@ bool wxMDIParentFrame::Create(wxWindow *parent, wxMDIParentFrame::~wxMDIParentFrame() { - DestroyChildren(); - - // already delete by DestroyChildren() + // see comment in ~wxMDIChildFrame +#if wxUSE_TOOLBAR m_frameToolBar = NULL; +#endif +#if wxUSE_STATUSBAR m_frameStatusBar = NULL; +#endif // wxUSE_STATUSBAR + + DestroyChildren(); if (m_windowMenu) { @@ -380,11 +381,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 +595,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) { @@ -696,7 +697,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) @@ -723,18 +724,21 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxAssociateWinWithHandle((HWND) GetHWND(), this); - wxModelessWindows.Append(this); - return true; } 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 +#if wxUSE_STATUSBAR m_frameStatusBar = NULL; +#endif // wxUSE_STATUSBAR + + DestroyChildren(); RemoveWindowMenu(NULL, m_hMenu); @@ -742,7 +746,7 @@ wxMDIChildFrame::~wxMDIChildFrame() } // Set the client size (i.e. leave the calculation of borders etc. -// to wxWindows) +// to wxWidgets) void wxMDIChildFrame::DoSetClientSize(int width, int height) { HWND hWnd = GetHwnd(); @@ -759,12 +763,14 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height) int actual_width = rect2.right - rect2.left - rect.right + width; int actual_height = rect2.bottom - rect2.top - rect.bottom + height; +#if wxUSE_STATUSBAR if (GetStatusBar() && GetStatusBar()->IsShown()) { int sx, sy; GetStatusBar()->GetSize(&sx, &sy); actual_height += sy; } +#endif // wxUSE_STATUSBAR POINT point; point.x = rect2.left; @@ -854,11 +860,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 +1032,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 +1079,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 +1307,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,17 +1395,10 @@ 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 -// wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__) +#endif // wxUSE_MDI && !defined(__WXUNIVERSAL__)