X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3307dddecfbac0041ec7b76b06ea95f4726f866..27c78e4552aaefac9a4db0d4453eff09cdfef2ad:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 0dce669ebf..b0ec95a99d 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "mdi.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -45,6 +41,7 @@ #include "wx/log.h" #endif +#include "wx/stockitem.h" #include "wx/mdi.h" #include "wx/msw/private.h" @@ -133,6 +130,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_SIZE(wxMDIParentFrame::OnSize) + EVT_ICONIZE(wxMDIParentFrame::OnIconized) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) END_EVENT_TABLE() @@ -323,7 +321,7 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) } } -void wxMDIParentFrame::OnSize(wxSizeEvent&) +void wxMDIParentFrame::UpdateClientSize() { if ( GetClientWindow() ) { @@ -334,6 +332,23 @@ void wxMDIParentFrame::OnSize(wxSizeEvent&) } } +void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event)) +{ + UpdateClientSize(); + + // do not call event.Skip() here, it somehow messes up MDI client window +} + +void wxMDIParentFrame::OnIconized(wxIconizeEvent& event) +{ + event.Skip(); + + if ( !event.Iconized() ) + { + UpdateClientSize(); + } +} + // Returns the active MDI child window wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const { @@ -774,7 +789,17 @@ wxMDIChildFrame::~wxMDIChildFrame() bool wxMDIChildFrame::Show(bool show) { m_needsInitialShow = false; - return wxFrame::Show(show); + + if (!wxFrame::Show(show)) + return false; + + // KH: Without this call, new MDI children do not become active. + // This was added here after the same BringWindowToTop call was + // removed from wxTopLevelWindow::Show (November 2005) + if ( show ) + ::BringWindowToTop(GetHwnd()); + + return true; } // Set the client size (i.e. leave the calculation of borders etc. @@ -852,8 +877,8 @@ void wxMDIChildFrame::InternalSetMenuBar() void wxMDIChildFrame::DetachMenuBar() { - RemoveWindowMenu(NULL, m_hMenu); - wxFrame::DetachMenuBar(); + RemoveWindowMenu(NULL, m_hMenu); + wxFrame::DetachMenuBar(); } WXHICON wxMDIChildFrame::GetDefaultIcon() const @@ -1285,11 +1310,11 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF // (see OGL studio sample). So check if the position is changed and if so, // redraw the MDI child frames. - wxPoint oldPos = GetPosition(); + const wxPoint oldPos = GetPosition(); - wxWindow::DoSetSize(x, y, width, height, sizeFlags); + wxWindow::DoSetSize(x, y, width, height, sizeFlags | wxSIZE_FORCE); - wxPoint newPos = GetPosition(); + const wxPoint newPos = GetPosition(); if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) { @@ -1383,8 +1408,8 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) continue; } - - if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) ) + wxString strBuf(buf); + if ( wxStripMenuCodes(strBuf) == wxGetStockLabel(wxID_HELP,false) ) { success = true; ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,