DlgWOLWait.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. *
  20. * FILE
  21. * $Archive: /Commando/Code/Commando/DlgWOLWait.h $
  22. *
  23. * DESCRIPTION
  24. *
  25. * PROGRAMMER
  26. * Denzil E. Long, Jr.
  27. * $Author: Bhayes $
  28. *
  29. * VERSION INFO
  30. * $Revision: 14 $
  31. * $Modtime: 2/18/02 7:51p $
  32. *
  33. ******************************************************************************/
  34. #ifndef __DLGWOLWAIT_H__
  35. #define __DLGWOLWAIT_H__
  36. #include <WWUI\PopupDialog.h>
  37. #include <WWLib\Notify.h>
  38. #include <WWOnline\RefPtr.h>
  39. #include <WWOnline\WaitCondition.h>
  40. namespace WWOnline
  41. {
  42. class Session;
  43. }
  44. class DlgWOLWait;
  45. class DlgWOLWaitEvent :
  46. public TypedEventPtr<DlgWOLWaitEvent, WaitCondition>
  47. {
  48. public:
  49. typedef WaitCondition::WaitResult WaitResult;
  50. inline WaitResult Result(void) const
  51. {return mResult;}
  52. DlgWOLWaitEvent(WaitResult result, WaitCondition* wait) :
  53. TypedEventPtr<DlgWOLWaitEvent, WaitCondition>(wait),
  54. mResult(result)
  55. {}
  56. protected:
  57. // Prevent copy and assignment
  58. DlgWOLWaitEvent(const DlgWOLWaitEvent&);
  59. const DlgWOLWaitEvent& operator=(const DlgWOLWaitEvent&);
  60. private:
  61. WaitResult mResult;
  62. };
  63. class DlgWOLWait :
  64. public PopupDialogClass,
  65. public Notifier<DlgWOLWaitEvent>
  66. {
  67. public:
  68. enum {SHOW_NEVER = 0xFFFFFFFF};
  69. static bool DoDialog(const WCHAR* title, const WCHAR* button_text, RefPtr<WaitCondition>& wait,
  70. Observer<DlgWOLWaitEvent>* observer = NULL, unsigned long timeout = 0, unsigned long dialog_timeout = 0);
  71. static bool DoDialog(const WCHAR* title, RefPtr<WaitCondition>& wait,
  72. Observer<DlgWOLWaitEvent>* observer = NULL, unsigned long timeout = 0, unsigned long dialog_timeout = 0);
  73. static bool DoDialog(int titleID, RefPtr<WaitCondition>& wait,
  74. Observer<DlgWOLWaitEvent>* observer = NULL, unsigned long timeout = 0, unsigned long dialog_timeout = 0);
  75. const RefPtr<WaitCondition>& GetWait(void)
  76. {return mWait;}
  77. static DlgWOLWait *Get_Instance (void) { return mTheInstance; }
  78. protected:
  79. DlgWOLWait(RefPtr<WaitCondition>& wait, unsigned long timeout, unsigned long dialog_timeout = 0);
  80. ~DlgWOLWait();
  81. // Prevent copy and assignment
  82. DlgWOLWait(const DlgWOLWait&);
  83. const DlgWOLWait& operator=(const DlgWOLWait&);
  84. void CheckCondition(void);
  85. void On_Init_Dialog(void);
  86. void On_Destroy(void);
  87. void On_Periodic(void);
  88. void On_Command(int ctrl, int message, DWORD param);
  89. void Render(void);
  90. DECLARE_NOTIFIER(DlgWOLWaitEvent)
  91. private:
  92. RefPtr<WaitCondition> mWait;
  93. RefPtr<WWOnline::Session> mWOLSession;
  94. unsigned mStartTime;
  95. unsigned long mTimeout;
  96. unsigned long mDialogTimeout;
  97. bool mShowDialog;
  98. static DlgWOLWait * mTheInstance;
  99. };
  100. #endif // __DLGWOLLOGON_H__