//NetTalk
/*------------------------------------------------------------------------------*\
 =============================
   模块名称: Main.h
 =============================
 
 [版权]
 
   2000-2002  115软件工厂  版权所有
                                              
\*------------------------------------------------------------------------------*/
#ifndef _MAIN_H_
#define _MAIN_H_
////////////////
#define WM_USER_TIP  WM_USER+101
#define WM_TRAYNOTIFY  WM_USER+102
#define WM_USER_SETUP  WM_USER+103
////////////////////////////////////////////////
///IP输入对话框
class CIPInput:public CGraphDlg
{
public:
	unsigned short m_uPort;
	char m_szIP[30];
	virtual  ~CIPInput();
	CIPInput();
protected:
	virtual LRESULT WndProc(UINT uMsg,WPARAM wParam,LPARAM lParam);
};
////////////////////
class CCreditDlg:public CDialogX
{
protected:
	virtual LRESULT WndProc(UINT uMsg,WPARAM wParam,LPARAM lParam);
public:
	BOOL Create(HWND hParent);
};
//////////////////////////////////////////
//关于对话框
class CAboutDlg:public CGraphDlg
{
public:
	virtual  ~CAboutDlg();
	CAboutDlg();

protected:
	CCreditDlg m_cd2;
	CCreditDlg m_cd1;
	
	CRippleWnd m_rw;
	virtual LRESULT WndProc(UINT uMsg,WPARAM wParam,LPARAM lParam);
};

//////////
struct SETUP
{
	BOOL bAutoRun;
	BOOL bInitShow;
	BOOL bMiniHide;
	BOOL bRing;
	BOOL bRingUser;
	char szRingPath[256];
	BOOL bAutoMsg;
	BOOL bRefuseCall;
	BOOL bBandAdjust;
	WORD wHotKey;
	
};
class CSetupDlg:public CGraphDlg
{
public:
	
	static SETUP Setup;
	static void LoadSetup();
	static void SaveSetup();
	virtual ~CSetupDlg();
	CSetupDlg();

protected:
	virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam );
	virtual BOOL OnInitDialog();
	virtual LRESULT WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
};
//////////
class CRingDlg:public CGraphDlg
{
public:
	BOOL DoModal(HWND hParent,char* szCaller);
	virtual  ~CRingDlg();
	CRingDlg();
protected:
	virtual void OnEraseBkgnd(HDC hdc);
	char* m_szCaller;
	
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	virtual BOOL OnInitDialog();
	virtual LRESULT WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
};
/////////////
class CCallDlg:public CGraphDlg
{
public:
	void Busy();
	void Refuse();
	void FailConnect();
	void Connected();
	BOOL DoModal(HWND hParent,char* szDst);
	virtual  ~CCallDlg();
	CCallDlg();

protected:
	char* m_szDst;
	virtual BOOL OnInitDialog();
	virtual void OnEraseBkgnd(HDC hdc);
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	virtual LRESULT WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
};
////////////////////////////////////////////////
//主窗口
class CMainWnd:public CDialogX
{
public:	
	
	BOOL m_bHilightTitleBar;
	
	
	CMainWnd();
	virtual ~CMainWnd();	
	
protected:
	CRingDlg m_RingDlg;
	void OnSetup(SETUP* Setup);

	DWORD m_uTalkTime;
	CMsgTalkDlg m_MsgTalk;
	CCallDlg m_CallDlg;

	CVideoShow m_vs;
	
	HWND m_hwndTT;
	CSlideBar m_sldAudioOut;
	CSlideBar m_sldAudioIn;
	CSlideBar m_sldVideoQ;
	HRGN m_hrgnTitle;
	CCoolBtn m_btnHang;
	CCoolBtn m_btnCall;
	CCoolBtn m_btnAddr;
	CCoolBtn m_btnSetup;
	CCoolBtn m_btnClose;
	CCoolBtn m_btnMin;
	CCoolBtn m_btnHelp;
	CCoolBtn m_btnAbout;
	CCoolBtn m_btnLocal;
	CCoolBtn m_btnOnoff;
	CCoolBtn m_btnOutview;
	CCoolBtn m_btnMsg;
		
	void DrawFps(char* pszFps);
	
	void DrawDataRate(char* pszDataRate);

///消息响应函数//////////////////
	virtual HBRUSH OnCtrlColorStatic(HDC hdc, HWND hwnd);
	virtual HBRUSH OnCtrlColorEdit(HDC hdc,HWND hwnd);
	virtual void OnEraseBkgnd(HDC hdc);
	virtual BOOL OnCommand(WPARAM wParam,LPARAM lParam);
	virtual void OnMouseMove( UINT nFlags, POINT point );
	virtual void OnLButtonUp( UINT nFlags, POINT &point );
	virtual void OnLButtonDown( UINT nFlags, POINT& point );
	virtual void OnClose();
	virtual void OnTimer(UINT nIDEvent );
	virtual BOOL OnSetCursor(HWND hWnd,UINT nHitTest, UINT message);
	virtual void OnDestroy();
	virtual BOOL OnInitDialog();
	virtual LRESULT WndProc(UINT uMsg,WPARAM wParam,LPARAM lParam);
	void OnTrayNotify(WPARAM wParam,LPARAM lParam);
	void OnIOMNotify(WPARAM wParam,LPARAM lParam);
	void OnAudioData(BOOL flag,CAVIOMgr* pMgr);
	static void CALLBACK OutVolumeChanged( DWORD dwCurrentVolume, DWORD dwUserValue );
	static void CALLBACK InVolumeChanged( DWORD dwCurrentVolume, DWORD dwUserValue );
///////////////////////////////
	int m_iZeroCount;
	
	
	
	UINT m_nDataSend;
	UINT m_nDataRcv;
		
	BOOL m_bSendVideo;
	
	CTrayNotify m_TrayNotify;
	CVideoWnd m_RemoteVideoWnd;
	CVideoWnd m_LocalVideoWnd;

	HBITMAP m_bmpVideo;

	

	CVolumeInXXX m_VoInCtrl;
	CVolumeOutWave m_VoOutCtrl;
	
	UINT m_VQ;
	
	CWaveShow m_WaveShowOut;
	CWaveShow m_WaveShowIn;
	

	
	DWORD m_nTimePass;
	UINT m_nFrameCount;
	
	
	

	HBRUSH m_hbCtrlBg;
	HBRUSH m_hbFpsBg;

	
	CRectX m_rcFps;
	CRectX m_rcDataRate;
	CRectX m_rcVideo;
		
	
private:
};

#endif