HoverRace  2.0
RoomListDialog.h
Go to the documentation of this file.
1 #ifdef HR_LEGACY_BUILD
2 
3 // RoomListDialog.h
4 // Header for the base room list dialog.
5 //
6 // Copyright (c) 2009 Michael Imamura.
7 //
8 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
9 // you may not use this file except in compliance with the License.
10 //
11 // A copy of the license should have been attached to the package from which
12 // you have taken this file. If you can not find the license you can not use
13 // this file.
14 //
15 //
16 // The author makes no representations about the suitability of
17 // this software for any purpose. It is provided "as is" "AS IS",
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
19 // implied.
20 //
21 // See the License for the specific language governing permissions
22 // and limitations under the License.
23 
24 #pragma once
25 
26 #include "RoomList.h"
27 
28 namespace HoverRace {
29 namespace Client {
30 
42 class RoomListDialog {
43  private:
44  RoomListDialog() { }
45  protected:
46  RoomListDialog(const std::string &url);
47  virtual ~RoomListDialog();
48 
49  protected:
50  const std::string &GetUrl() const { return url; }
51  const std::string &GetErrorMessage() const { return errMsg; }
52  RoomListPtr GetRoomList() const { return roomList; }
53 
54  protected:
55  enum result_t {
56  RESULT_SUCCESS,
57  RESULT_CANCELED,
58  RESULT_FAILED,
59  };
60  void CancelLoad();
61  void DisplayError(HWND parent) const;
62  virtual void HandleLoadFinished(HWND hwnd, result_t result) = 0;
63 
64  private:
65  void ThreadProc(HWND dlgHwnd);
66 
67  protected:
68  virtual BOOL DlgProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) = 0;
69  static BOOL CALLBACK DlgFunc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
70 
71  private:
72  std::string url;
73  boost::thread loadThread;
74  std::string errMsg;
75  RoomListPtr roomList;
76 
77  protected:
78  static const int WM_APP_LOAD_COMPLETE = WM_APP + 20;
79 };
80 
81 } // namespace Client
82 } // namespace HoverRace
83 #endif
std::shared_ptr< RoomList > RoomListPtr
Definition: RoomList.h:96
Definition: Announcement.h:24