X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/017dc06b502c041c112a3948e6c5f65000a86d94..43f4e852a1b2ac37c3db6a2b87315192ac549191:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 8b0ab4e871..e6ea206fac 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -62,9 +62,17 @@ namespace // constants // --------------------------------------------------------------------------- -// This range gives a maximum of 500 MDI children. Should be enough :-) +// First ID for the MDI child menu item in the "Window" menu. const int wxFIRST_MDI_CHILD = 4100; -const int wxLAST_MDI_CHILD = 4600; + +// There can be no more than 9 children in the "Window" menu as beginning with +// the tenth one they're not shown and "More windows..." menu item is used +// instead. +const int wxLAST_MDI_CHILD = wxFIRST_MDI_CHILD + 8; + +// The ID of the "More windows..." menu item is the next one after the last +// child. +const int wxID_MDI_MORE_WINDOWS = wxLAST_MDI_CHILD + 1; // The MDI "Window" menu label const char *WINDOW_MENU_LABEL = gettext_noop("&Window"); @@ -562,8 +570,9 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, WXHWND hwnd; UnpackCommand(wParam, lParam, &id, &hwnd, &cmd); - if ( cmd == 0 /* menu */ && - id >= SC_SIZE /* first system menu command */ ) + if ( id == wxID_MDI_MORE_WINDOWS || + (cmd == 0 /* menu */ && + id >= SC_SIZE /* first system menu command */) ) { MSWDefWindowProc(message, wParam, lParam); processed = true; @@ -628,9 +637,7 @@ void wxMDIParentFrame::OnMDIChild(wxCommandEvent& event) int childId = wxGetWindowId(child->GetHWND()); if ( childId == event.GetId() ) { - ::SendMessage( GetWinHwnd(GetClientWindow()), - WM_MDIACTIVATE, - (WPARAM)child->GetHWND(), 0); + wxStaticCast(child, wxMDIChildFrame)->Activate(); return; } } @@ -1037,6 +1044,11 @@ void wxMDIChildFrame::Activate() wxMDIParentFrame * const parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { + // Activating an iconized MDI frame doesn't do anything, so restore it + // first to really present it to the user. + if ( IsIconized() ) + Restore(); + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, (WPARAM) GetHwnd(), 0); }