// PortForwardView.h : interface of the CPortForwardView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_PORTFORWARDVIEW_H__FB200AFC_E887_435E_A02D_79B03CCEA33F__INCLUDED_)
#define AFX_PORTFORWARDVIEW_H__FB200AFC_E887_435E_A02D_79B03CCEA33F__INCLUDED_

//#include "WebServer.h"	// Added by ClassView
//#include "DlgResizeHelper.h"	// Added by ClassView
//#include "DeleteKeyListCtrl.h"


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


//#include "LabelledButton.h"
#include "upnp_PortForwardEngine.h"	// Added by ClassView


class CPortForwardView : public CFormView
{
protected: // create from serialization only
	CPortForwardView();
	DECLARE_DYNCREATE(CPortForwardView)

public:
	//{{AFX_DATA(CPortForwardView)
	enum { IDD = IDD_PORTFORWARD_FORM };
	CButton	m_ctlCheckListenForChangeEvents;
	CProgressCtrl	m_ctlProgressIgdDeviceInfo;
	CProgressCtrl	m_ctlProgressDeleteUpdate;
	CProgressCtrl	m_ctlProgressAddUpdate;
	CProgressCtrl	m_ctlProgressEditUpdate;
	CProgressCtrl	m_ctlProgressComUpdate;
	CDeleteKeyListCtrl	m_ctlListPortMappings;
	CEdit	m_ctlEditPortTestTextWindow;
	CEdit	m_ctlEditListenerPortNumber;
	CButton	m_ctlStaticPortTestGroup;
	CStatic	m_ctlStaticIgdName;
	CButton	m_ctlCheckOpenListener;
	CLabelledButton	m_ctlBtnDeleteSelectedEntry;
	CLabelledButton	m_ctlBtnMoreDeviceInfo;
	CLabelledButton	m_ctlBtnRunLoopbackPortTest;
	CLabelledButton	m_ctlBtnUpdateNow;
	CLabelledButton	m_ctlBtnRunIncomingPortTest;
	CLabelledButton	m_ctlBtnEditSelectedEntry;
	CLabelledButton	m_ctlBtnAddNewEntry;
	//}}AFX_DATA

// Attributes
public:
	CPortForwardDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPortForwardView)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
public:

	virtual ~CPortForwardView();

	CPortForwardEngine m_PortForwardEngine;
	CPortForwardEngine::DeviceInformationContainer m_DeviceInfoContainer;

	BOOL m_bPortTestingEnabled;
	BOOL m_bListenForChangeEventsEnabled;
	
	DlgResizeHelper m_resizeHelper;

	CWebServer m_WebServer;
	int m_iListeningPort;

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

	void EnablePortTestingWindows( BOOL bEnable );
	void RunPortTest( BOOL bFullInternet );

// Generated message map functions
protected:
	//{{AFX_MSG(CPortForwardView)
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg LRESULT OnMappingThreadNotificationMessage(WPARAM wParam, LPARAM lParam);
	afx_msg void OnButtonCheckOpenListenerPort();
	afx_msg void OnButtonAddNewEntry();
	afx_msg void OnButtonEditSelectedEntry();
	afx_msg void OnButtonRunPortTest();
	afx_msg void OnButtonUpdateNowUsingNewThread();
	afx_msg void OnButtonMoreDeviceInfo();
	afx_msg void OnButtonDeleteSelectedEntry();
	afx_msg void OnButtonRunLoopbackPortTest();
	afx_msg void OnButtonCheckListenForChangeEvents();
	afx_msg void OnButtonHelp();
	afx_msg void OnDblclkListOfPortMappings(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in PortForwardView.cpp
inline CPortForwardDoc* CPortForwardView::GetDocument()
   { return (CPortForwardDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PORTFORWARDVIEW_H__FB200AFC_E887_435E_A02D_79B03CCEA33F__INCLUDED_)
