#ifndef __AllSrvUISheet_h__
#define __AllSrvUISheet_h__
#if _MSC_VER > 1000
#pragma once
#endif #include "PageDummy.h"
#include "PageConnect.h"
#include "PageGameCreate.h"
#include "PageChat.h"
#include "PagePlayers.h"
#include "AutoSizer.h"
class CAllSrvUISheet : public CPropertySheet
{
protected:
DECLARE_MESSAGE_MAP()
public:
CAllSrvUISheet(CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
~CAllSrvUISheet();
BOOL Create();
public:
protected:
void InitSysMenu();
void InitIcon();
void AddChildrenToAutoSizer();
public:
void UpdateStatus();
HRESULT HandleError(HRESULT hr, LPCSTR pszContext, bool bExit);
IAdminSession* GetSession() { return m_spSession; }
IAdminServer* GetServer() { return m_spServer; }
IAdminGame* GetGame() { return m_spGame; }
bool IsServerInMultiMode() const { return m_bMultiMode; }
bool SelectGame();
HRESULT CreateGame(bool bLobby, IAGCGameParameters* pGameParameters);
HRESULT DestroyGame();
HRESULT PostConnect(DWORD dwCookie);
public:
void OnEvent(IAGCEvent* pEvent);
public:
virtual void PostNcDestroy();
protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
protected:
struct XEvents : public IAdminSessionEvents
{
XEvents(CAllSrvUISheet* pThis);
virtual ~XEvents();
STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
STDMETHODIMP OnEvent(IAGCEvent* pEvent);
private:
CAllSrvUISheet* m_pThis;
ULONG m_nRefs;
};
friend XEvents;
protected:
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMove(int x, int y);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnClose();
protected:
enum {c_cTimersMin, c_SizeTimer, c_StageTimer, c_cTimersMax};
enum {c_SizeTimeout = 200, c_StageTimeout = 2000,};
protected:
CPageDummy m_PageDummy;
CPageConnect m_PageConnect;
CPageGameCreate m_PageGameCreate;
CPageChat m_PageChat;
CPagePlayers m_PagePlayers;
IAdminSessionPtr m_spSession;
IConnectionPointPtr m_spcp;
IAdminServerPtr m_spServer;
IAdminGamePtr m_spGame;
DWORD m_dwConnectionCookie;
CAutoSizer m_AutoSizer;
CStatusBarCtrl m_wndStatusBar;
bool m_bInitDone;
bool m_bMultiMode;
};
#endif