DisconnectMenu.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. #pragma once
  24. #ifndef __DISCONNECTDIALOG_H
  25. #define __DISCONNECTDIALOG_H
  26. #include "GameNetwork/DisconnectManager.h"
  27. enum DisconnectMenuStateType {
  28. DISCONNECTMENUSTATETYPE_SCREENON,
  29. DISCONNECTMENUSTATETYPE_SCREENOFF
  30. };
  31. class DisconnectMenu {
  32. public:
  33. DisconnectMenu();
  34. virtual ~DisconnectMenu();
  35. void init();
  36. void attachDisconnectManager(DisconnectManager *disconnectManager);
  37. void showScreen();
  38. void hideScreen();
  39. Bool isScreenVisible( void ) { return m_menuState == DISCONNECTMENUSTATETYPE_SCREENON; }
  40. void showPlayerControls(Int slot);
  41. void hidePlayerControls(Int slot);
  42. void showPacketRouterTimeout();
  43. void hidePacketRouterTimeout();
  44. void setPlayerName(Int playerNum, UnicodeString name);
  45. void setPlayerTimeoutTime(Int playerNum, time_t newTime);
  46. void setPacketRouterTimeoutTime(time_t newTime);
  47. void sendChat(UnicodeString text);
  48. void showChat(UnicodeString text);
  49. void quitGame();
  50. void removePlayer(Int slot, UnicodeString playerName);
  51. void voteForPlayer(Int slot);
  52. void updateVotes(Int slot, Int votes);
  53. protected:
  54. DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager.
  55. DisconnectMenuStateType m_menuState; ///< The current state of the menu screen.
  56. static char *m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window.
  57. static char *m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window.
  58. static char *m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window.
  59. static char *m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window.
  60. static char *m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window.
  61. static char *m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window.
  62. static char *m_textDisplayControlName; ///< name of the text display listbox control window.
  63. };
  64. extern DisconnectMenu *TheDisconnectMenu;
  65. #endif // #ifndef __DISCONNECTDIALOG_H