X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c50f1fb9226d9260454ccb9c8a67d0be23c2827f..93ccaed86983970c4a2aa5af34593781e5b8964f:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 551c1cc4ec..cfd5d647ce 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -61,7 +61,7 @@ extern wxChar wxMDIFrameClassName[]; extern wxChar wxMDIChildFrameClassName[]; extern wxWindow *wxWndHook; // from window.cpp -extern wxList *wxWinHandleList; +extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); static HWND invalidHandle = 0; @@ -192,10 +192,8 @@ bool wxMDIParentFrame::Create(wxWindow *parent, if (style & wxCAPTION) msflags |= WS_CAPTION; - // Adding WS_CLIPCHILDREN causes children not to be properly - // drawn when first displaying them. -// if (style & wxCLIP_CHILDREN) -// msflags |= WS_CLIPCHILDREN; + if (style & wxCLIP_CHILDREN) + msflags |= WS_CLIPCHILDREN; wxWindow::MSWCreate(m_windowId, parent, wxMDIFrameClassName, this, title, x, y, width, height, msflags); @@ -383,9 +381,9 @@ long wxMDIParentFrame::MSWWindowProc(WXUINT message, break; case WM_SIZE: - // we will leave this message to the base class version, but we - // must pass it to DefFrameProc() too - MSWDefWindowProc(message, wParam, lParam); + // as we don't (usually) resize the MDI client to exactly fit the + // client area (we put it below the toolbar, above statusbar &c), + // we should not pass this one to DefFrameProc break; } @@ -484,7 +482,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) if ( child->GetHWND() ) { long childId = wxGetWindowId(child->GetHWND()); - if (childId == id) + if (childId == (long)id) { ::SendMessage( GetWinHwnd(GetClientWindow()), WM_MDIACTIVATE, @@ -642,7 +640,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, m_hWnd = (WXHWND)Return; wxWndHook = NULL; - wxWinHandleList->Append((long)GetHWND(), this); + wxAssociateWinWithHandle((HWND) GetHWND(), this); // VZ: what's this? an act of piracy? //SetWindowLong(GetHwnd(), 0, (long)this); @@ -729,25 +727,35 @@ void wxMDIChildFrame::InternalSetMenuBar() // MDI operations // --------------------------------------------------------------------------- -void wxMDIChildFrame::Maximize() +void wxMDIChildFrame::Maximize(bool maximize) { wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); if ( parent && parent->GetClientWindow() ) - ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIMAXIMIZE, (WPARAM) GetHwnd(), 0); + { + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), + maximize ? WM_MDIMAXIMIZE : WM_MDIRESTORE, + (WPARAM)GetHwnd(), 0); + } } void wxMDIChildFrame::Restore() { wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); if ( parent && parent->GetClientWindow() ) - ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE, (WPARAM) GetHwnd(), 0); + { + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE, + (WPARAM) GetHwnd(), 0); + } } void wxMDIChildFrame::Activate() { wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); if ( parent && parent->GetClientWindow() ) - ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, (WPARAM) GetHwnd(), 0); + { + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, + (WPARAM) GetHwnd(), 0); + } } // ---------------------------------------------------------------------------