MessageBox.cpp 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. ** Command & Conquer Renegade(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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Installer *
  23. * *
  24. * $Archive:: /Commando/Code/Installer/MessageBox.cpp $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 11/29/01 3:54p $*
  29. * *
  30. * $Revision:: 4 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. // Includes.
  36. #include "ErrorHandler.h"
  37. #include "MessageBox.h"
  38. #include "InstallMenuDialog.h"
  39. #include "Resource.h"
  40. /***********************************************************************************************
  41. * MessageBoxClass::Create_Dialog -- *
  42. * *
  43. * INPUT: *
  44. * *
  45. * OUTPUT: *
  46. * *
  47. * WARNINGS: *
  48. * *
  49. * HISTORY: *
  50. * 08/22/01 IML : Created. *
  51. *=============================================================================================*/
  52. MessageBoxClass *MessageBoxClass::Create_Dialog (const WCHAR *title, const WCHAR *text, MessageBoxTypeEnum type, CallbackMenuDialogClass *callbackobject)
  53. {
  54. MessageBoxClass *popup;
  55. switch (type) {
  56. case MESSAGE_BOX_TYPE_OK:
  57. popup = NEW_REF (MessageBoxClass, (IDD_DIALOG_MESSAGE_BOX_OK, callbackobject));
  58. break;
  59. case MESSAGE_BOX_TYPE_YES_NO:
  60. popup = NEW_REF (MessageBoxClass, (IDD_DIALOG_MESSAGE_BOX_YES_NO, callbackobject));
  61. break;
  62. case MESSAGE_BOX_TYPE_RETRY_QUIT:
  63. popup = NEW_REF (MessageBoxClass, (IDD_DIALOG_MESSAGE_BOX_RETRY_QUIT, callbackobject));
  64. break;
  65. };
  66. popup->Start_Dialog();
  67. popup->Set_Title (title);
  68. popup->Set_Dlg_Item_Text (IDC_MESSAGE_BOX_STATIC, text);
  69. popup->Build_Background_Renderers();
  70. return (popup);
  71. }
  72. /***********************************************************************************************
  73. * MessageBoxClass::Do_Dialog -- *
  74. * *
  75. * INPUT: *
  76. * *
  77. * OUTPUT: *
  78. * *
  79. * WARNINGS: *
  80. * *
  81. * HISTORY: *
  82. * 08/22/01 IML : Created. *
  83. *=============================================================================================*/
  84. void MessageBoxClass::Do_Dialog (const WCHAR *title, const WCHAR *text, MessageBoxTypeEnum type, CallbackMenuDialogClass *callbackobject)
  85. {
  86. MessageBoxClass *popup;
  87. popup = Create_Dialog (title, text, type, callbackobject);
  88. REF_PTR_RELEASE (popup);
  89. }
  90. /***********************************************************************************************
  91. * MessageBoxClass::On_Command -- *
  92. * *
  93. * INPUT: *
  94. * *
  95. * OUTPUT: *
  96. * *
  97. * WARNINGS: *
  98. * *
  99. * HISTORY: *
  100. * 08/22/01 IML : Created. *
  101. *=============================================================================================*/
  102. void MessageBoxClass::On_Command (int ctrl_id, int message_id, DWORD param)
  103. {
  104. if (CallbackObject != NULL) {
  105. CallbackObject->Callback (ctrl_id, this);
  106. }
  107. End_Dialog();
  108. }
  109. /***********************************************************************************************
  110. * CallbackMenuDialogClass::Callback -- *
  111. * *
  112. * INPUT: *
  113. * *
  114. * OUTPUT: *
  115. * *
  116. * WARNINGS: *
  117. * *
  118. * HISTORY: *
  119. * 08/22/01 IML : Created. *
  120. *=============================================================================================*/
  121. void CallbackMenuDialogClass::Callback (int id, PopupDialogClass *popup)
  122. {
  123. switch (id) {
  124. case IDC_BUTTON_YES:
  125. MenuDialogClass::On_Command (IDCANCEL, 0, 0);
  126. break;
  127. default:
  128. break;
  129. }
  130. }