From c4053ed35abe597597c4b843529be38ca3c3c7f2 Mon Sep 17 00:00:00 2001 From: Ryan Norton Date: Wed, 24 Dec 2003 21:53:59 +0000 Subject: [PATCH] revert git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/menu.cpp | 82 ++---------------------------------------------- 1 file changed, 3 insertions(+), 79 deletions(-) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 38a7dfadd9..d8c27dcd25 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -36,7 +36,6 @@ #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" - #include "wx/mdi.h" #endif #if wxUSE_OWNER_DRAWN @@ -1046,11 +1045,8 @@ wxMenu *wxMenuBar::Remove(size_t pos) if ( !menu ) return NULL; - size_t arraypos = pos; - if ( IsAttached() ) { - #ifdef __WXWINCE__ if (GetToolBar()) { @@ -1060,85 +1056,12 @@ wxMenu *wxMenuBar::Remove(size_t pos) } } #else -#if wxUSE_MDI_ARCHITECTURE - //MDI - window menu stuff - if (GetFrame() && GetFrame()->IsKindOf(CLASSINFO(wxMDIParentFrame))) - { - //There's two cases which we need to deal with in order - //to remove at the correct index with MDI windows - - //#1 is due to the fact that wxWindows sneakely creates - //a new menu item "Window" on the menu bar natively, without - //notifying the actual wxMenuBar. Therefore, the Window - //menu never go into the actual calculations... - //So if a user tries to insert a menu after the Window menu - //his/her calculations will be one(1) index off, since the - //Window menu is before the to-be-removed menu and - //wxMenuBar doesn't know about the existance of it. - - //There are two ways to deal with this - - //1 - is to force the window menu to always be at the end - //of the menu bar (rightmost, greatest index), I.E. - //override remove and insert functions to force - //the window (and help) menus to be at the rightmost positions - //2 - is to increment pos here if the user is trying - //to remove a menu after the Window menu - - //Solution #2 (which if chosen would go here) - //is a little involved - //1. Search for Window menu - //2. If found note where it is - //3. If the removal point is at or above where the Window - // menu is, ++pos - - - //Case #2 is a MSW MDI "feature", where if a child MDI - //frame is maximized, the system menu of the child MDI - //frame is inserted at index 0 of the parent frame. - - //To deal with this we simply check to see if a child MDI - //frame is maximized, then increment the position we - //are going to remove the menu at. - - //Get a pointer to the children of the wxMDIParentFrame - wxWindowList* pParentsChildren = &(GetFrame()->GetChildren()); - - //Iterate through the children - for (size_t n = 0; n < pParentsChildren->GetCount(); ++n) - { - //Check to see if this particular child window is a - //MDI child - if(pParentsChildren->Item(n)->GetData()->IsKindOf(CLASSINFO(wxMDIChildFrame))) - { - //If so then we need to see if it's maximized - - //Get a pointer to the child... - wxMDIChildFrame* pData = (wxMDIChildFrame*) pParentsChildren->Item(n)->GetData(); - - //Is it maximized? - if(pData->IsMaximized()) - { - //Increase the removal position by one - ++pos; - - //Note that in Windows there can - //Only be one maximized child window - //(well not technically, but there - //can only be one child system menu - //prepended to the parent's menu - //bar, which is what we're concerned about) - break; - } - }//end if child == wxMDIChildFrame - }//end children iteration loop - }//end if GetFrame()->IsKindOf(CLASSINFO(wxMDIParentFrame)) -#endif //wxUSE_MDI_ARCHITECTURE - if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { wxLogLastError(wxT("RemoveMenu")); } #endif + #if wxUSE_ACCEL if ( menu->HasAccels() ) { @@ -1150,7 +1073,8 @@ wxMenu *wxMenuBar::Remove(size_t pos) Refresh(); } - m_titles.RemoveAt(arraypos); + + m_titles.RemoveAt(pos); return menu; } -- 2.47.2