/* ** Command & Conquer Generals(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see . */ //////////////////////////////////////////////////////////////////////////////// // // // (c) 2001-2003 Electronic Arts Inc. // // // //////////////////////////////////////////////////////////////////////////////// // FILE: ReplayMenu.cpp ///////////////////////////////////////////////////////////////////// // Author: Chris The masta Huybregts, December 2001 // Description: Replay Menus /////////////////////////////////////////////////////////////////////////////////////////////////// // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameEngine.h" #include "GameClient/WindowLayout.h" #include "GameClient/Shell.h" #include "GameClient/KeyDefs.h" #include "GameClient/GameWindowManager.h" #include "GameClient/MessageBox.h" #include "GameNetwork/WOLBrowser/WebBrowser.h" // window ids ------------------------------------------------------------------------------------- static NameKeyType parentWindowID = NAMEKEY_INVALID; static NameKeyType buttonBackID = NAMEKEY_INVALID; static NameKeyType windowLadderID = NAMEKEY_INVALID; // window pointers -------------------------------------------------------------------------------- static GameWindow *parentWindow = NULL; static GameWindow *buttonBack = NULL; static GameWindow *windowLadder = NULL; //------------------------------------------------------------------------------------------------- /** Initialize the single player menu */ //------------------------------------------------------------------------------------------------- void WOLLadderScreenInit( WindowLayout *layout, void *userData ) { TheShell->showShellMap(TRUE); // get ids for our children controls parentWindowID = TheNameKeyGenerator->nameToKey( AsciiString("WOLLadderScreen.wnd:LadderParent") ); buttonBackID = TheNameKeyGenerator->nameToKey( AsciiString("WOLLadderScreen.wnd:ButtonBack") ); windowLadderID = TheNameKeyGenerator->nameToKey( AsciiString("WOLLadderScreen.wnd:WindowLadder") ); parentWindow = TheWindowManager->winGetWindowFromId( NULL, parentWindowID ); buttonBack = TheWindowManager->winGetWindowFromId( parentWindow, buttonBackID ); windowLadder = TheWindowManager->winGetWindowFromId( parentWindow, windowLadderID ); //Load the listbox shiznit // PopulateReplayFileListbox(listboxReplayFiles); //TheWebBrowser->createBrowserWindow("Westwood", windowLadder); if (TheWebBrowser != NULL) { TheWebBrowser->createBrowserWindow("MessageBoard", windowLadder); } // show menu layout->hide( FALSE ); // set keyboard focus to main parent TheWindowManager->winSetFocus( parentWindow ); } // end ReplayMenuInit //------------------------------------------------------------------------------------------------- /** single player menu shutdown method */ //------------------------------------------------------------------------------------------------- void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) { if (TheWebBrowser != NULL) { TheWebBrowser->closeBrowserWindow(windowLadder); } // hide menu layout->hide( TRUE ); // our shutdown is complete TheShell->shutdownComplete( layout ); } // end ReplayMenuShutdown //------------------------------------------------------------------------------------------------- /** single player menu update method */ //------------------------------------------------------------------------------------------------- void WOLLadderScreenUpdate( WindowLayout *layout, void *userData ) { } // end ReplayMenuUpdate //------------------------------------------------------------------------------------------------- /** Replay menu input callback */ //------------------------------------------------------------------------------------------------- WindowMsgHandledType WOLLadderScreenInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) { switch( msg ) { // -------------------------------------------------------------------------------------------- case GWM_CHAR: { UnsignedByte key = mData1; UnsignedByte state = mData2; switch( key ) { // ---------------------------------------------------------------------------------------- case KEY_ESC: { // // send a simulated selected event to the parent window of the // back/exit button // if( BitTest( state, KEY_STATE_UP ) ) { TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, (WindowMsgData)buttonBack, buttonBackID ); } // end if // don't let key fall through anywhere else return MSG_HANDLED; } // end escape } // end switch( key ) } // end char } // end switch( msg ) return MSG_IGNORED; } // end ReplayMenuInput //------------------------------------------------------------------------------------------------- /** single player menu window system callback */ //------------------------------------------------------------------------------------------------- WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) { switch( msg ) { // -------------------------------------------------------------------------------------------- case GWM_CREATE: { break; } // end create //--------------------------------------------------------------------------------------------- case GWM_DESTROY: { break; } // end case // -------------------------------------------------------------------------------------------- case GWM_INPUT_FOCUS: { // if we're givin the opportunity to take the keyboard focus we must say we want it if( mData1 == TRUE ) *(Bool *)mData2 = TRUE; return MSG_HANDLED; } // end input //--------------------------------------------------------------------------------------------- case GBM_SELECTED: { GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); if( controlID == buttonBackID ) { // thou art directed to return to thy known solar system immediately! TheShell->pop(); } // end else if break; } // end selected default: return MSG_IGNORED; } // end switch return MSG_HANDLED; } // end ReplayMenuSystem