static void GUIDrawMenuBar( gui_window *wnd ) { if( wnd->root_frame != NULLHANDLE ) { if( _wpi_getmenu( wnd->root_frame ) != NULLHANDLE ) { _wpi_drawmenubar( wnd->root_frame ); } } else { if( wnd->style & GUI_POPUP ) { if( _wpi_getmenu( wnd->hwnd_frame ) != NULLHANDLE ) { _wpi_drawmenubar( wnd->hwnd_frame ); } } } }
/* * setMaximizedMenuConfig - set up main menu in the maximized configuration */ static void setMaximizedMenuConfig( HWND hwnd ) { #ifndef __OS2_PM__ HMENU menu; HMENU sys_menu; if( insertedItems ) { SetSystemMenu( hwnd ); } else { getMenuBitmaps(); menu = _wpi_getmenu( mdiInfo.root ); insertedItems = TRUE; sys_menu = generateSystemMenu( hwnd ); if( sys_menu != NULL ) { InsertMenu( menu, 0, MF_POPUP | MF_BYPOSITION | MF_BITMAP, (UINT)sys_menu, (LPVOID)closeBitmap ); } else { InsertMenu( menu, 0, MF_BYPOSITION | MF_BITMAP, -1, (LPVOID)closeBitmap ); } InsertMenu( menu, -1, MF_HELP | MF_BYPOSITION | MF_BITMAP, SC_RESTORE, (LPVOID)restoreBitmap ); _wpi_drawmenubar( mdiInfo.root ); } #else hwnd = hwnd; #endif } /* setMaximizedMenuConfig */
/* * SetSystemMenu -- make the system menu showing belong to the current window */ void SetSystemMenu( HWND hwnd ) { HMENU sys_menu; HMENU menu; sys_menu = NULLHANDLE; if( hwnd != NULLHANDLE ) { sys_menu = generateSystemMenu( hwnd ); } menu = _wpi_getmenu( mdiInfo.root ); getMenuBitmaps(); #ifndef __OS2_PM__ if( sys_menu != NULL ) { ModifyMenu( menu, 0, MF_POPUP | MF_BYPOSITION | MF_BITMAP, (UINT)sys_menu, (LPVOID)closeBitmap ); } else { ModifyMenu( menu, 0, MF_BYPOSITION | MF_BITMAP, -1, (LPVOID)closeBitmap ); } #else if( sys_menu != NULLHANDLE ) { _wpi_modifymenu( menu, 0, MF_POPUP | MF_STRING, 0, 0, sys_menu, "SYSMENU", TRUE ); } else { _wpi_modifymenu( menu, 0, MF_STRING, 0, 0, NULLHANDLE, "SYSMENU", TRUE ); } #endif _wpi_drawmenubar( mdiInfo.root ); } /* SetSystemMenu */
/* * MDIInitMenu - initialize menu for MDI */ void MDIInitMenu( void ) { if( childrenMaximized ) { MDIClearMaximizedMenuConfig(); deleteMaximizedMenuConfig(); setMaximizedMenuConfig( currentWindow ); if( currentWindow != NULLHANDLE ) { mdiInfo.set_window_title( currentWindow ); } } else { _wpi_drawmenubar( mdiInfo.root ); } } /* MDIInitMenu */
/* * SetRestoreBitmap - set the bitmap on our restore menu item */ void SetRestoreBitmap( bool pressed ) { HMENU menu; menu = _wpi_getmenu( mdiInfo.root ); if( pressed ) { ModifyMenu( menu, 7, MF_BYPOSITION | MF_BITMAP | MF_HELP, SC_RESTORE, (LPVOID) restoredBitmap ); } else { ModifyMenu( menu, 7, MF_BYPOSITION | MF_BITMAP | MF_HELP, SC_RESTORE, (LPVOID) restoreBitmap ); } _wpi_drawmenubar( mdiInfo.root ); } /* SetRestoreBitmap */
/* * deleteMaximizedMenuConfig - delete the maximized menu configuration */ static void deleteMaximizedMenuConfig( void ) { HMENU root_menu; int count; if( !insertedItems ) { return; } insertedItems = FALSE; root_menu = _wpi_getmenu( mdiInfo.root ); _wpi_deletemenu( root_menu, 0, TRUE ); count = (int)_wpi_getmenuitemcount( root_menu ); _wpi_deletemenu( root_menu, count-1, TRUE ); _wpi_drawmenubar( mdiInfo.root ); } /* deleteMaximizedMenuConfig */