From 47e2b852c31700cad7d1586a84b7ffaee40aa0de Mon Sep 17 00:00:00 2001 From: Francois Boisvert Date: Tue, 9 Feb 1999 14:11:19 +0000 Subject: [PATCH] The systems buttons (minimize/restore/close) now appear on the menu bar of mdi application. --- windows/mdi.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/windows/mdi.c b/windows/mdi.c index be889b8bd56..f6ea50bbe66 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -782,12 +782,13 @@ static BOOL32 MDI_AugmentFrameMenu( MDICLIENTINFO* ci, WND *frame, return 0; } - if( !AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, - SC_RESTORE, (LPSTR)(DWORD)hBmpRestore )) - { - RemoveMenu32(frame->wIDmenu,0,MF_BYPOSITION); - return 0; - } + // Using the magic menu id's to insert system buttons in the menu bar + AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, + SC_MINIMIZE, (LPSTR)(DWORD)3 ) ; + AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, + SC_RESTORE, (LPSTR)(DWORD)2 ); + AppendMenu32A(frame->wIDmenu,MF_HELP | MF_BITMAP, + SC_CLOSE, (LPSTR)(DWORD)5 ); EnableMenuItem32(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem32(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); @@ -808,11 +809,16 @@ static BOOL32 MDI_RestoreFrameMenu( WND *frameWnd, HWND32 hChild ) TRACE(mdi,"for child %04x\n",hChild); - if( GetMenuItemID32(frameWnd->wIDmenu,nItems) != SC_RESTORE ) + if( GetMenuItemID32(frameWnd->wIDmenu,nItems) != SC_CLOSE ) return 0; RemoveMenu32(frameWnd->wIDmenu,0,MF_BYPOSITION); - DeleteMenu32(frameWnd->wIDmenu,nItems-1,MF_BYPOSITION); + + DeleteMenu32(frameWnd->wIDmenu,GetMenuItemCount32(frameWnd->wIDmenu) - 1,MF_BYPOSITION); + DeleteMenu32(frameWnd->wIDmenu,GetMenuItemCount32(frameWnd->wIDmenu) - 1,MF_BYPOSITION); + DeleteMenu32(frameWnd->wIDmenu,GetMenuItemCount32(frameWnd->wIDmenu) - 1,MF_BYPOSITION); + + DrawMenuBar32(frameWnd->hwndSelf);