/*
*******************************************************************************
* Copyright (c) 1996-2000 Digi International Inc., All Rights Reserved        *
*                                                                             *
* This  software  contains  proprietary  and  confidential   information   of *
* Digi International  Inc.   By  accepting  transfer  of this copy, Recipient *
* agrees to retain this software in  confidence,  to  prevent  disclosure  to *
* others,  and  to make no  use of this software other than that for which it *
* was delivered.  This is an unpublished copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************

// StatView.h : header file
//

*/

#include <afxpriv.h> // needed for AfxSetWindowText()

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CStatViewBase form view

#ifndef __AFXEXT_H__
#include <afxext.h>
#endif

class CStatDoc;
// CStatViewBase handles common stat pane tasks, like changing
// the frame window title bar when it recevies focus and 
// right mouse clicks
// You should derive all stat view panes from this class and
// supply a GetStatName() routine
class CStatViewBase : public CFormView
{	
	TCHAR m_Buf[256];

	COLORREF m_Highlight;
	CRgn m_UpdateRgn;
	CMap<UINT, UINT, DWORD, DWORD> m_CtrlMap;


protected:
	CStatViewBase(UINT);
	DECLARE_DYNAMIC(CStatViewBase)

	void PercentFrame(HWND, DWORD, CDC *);
	void DoWANStats();
	void DoWANLineStatus();

	virtual LPCTSTR GetStatName() { VERIFY(FALSE); return NULL; };
	
// Form Data
public:
	//{{AFX_DATA(CStatViewBase)
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

// Attributes
public:
	CStatDoc* GetDocument();

// Operations
public:

	void QuickDump(UINT nID, DWORD Num);

	void QuickDumpText(UINT nID, const CString& buf)
	{ AfxSetWindowText(::GetDlgItem(m_hWnd, nID), buf); }

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CStatViewBase)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CStatViewBase();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CStatViewBase)
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in WinChessView.cpp
inline CStatDoc* CStatViewBase::GetDocument()
   { return (CStatDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CFRStatView form view

#ifndef __AFXEXT_H__
#include <afxext.h>
#endif

class CFRStatView : public CStatViewBase
{
protected:
	CFRStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CFRStatView)

	virtual LPCTSTR GetStatName() 
		{ return "Frame Relay"; };

// Form Data
public:
	//{{AFX_DATA(CFRStatView)
	enum { IDD = IDD_FRSimpleStats };
	CComboBox	m_DLCIBox;
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFRStatView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CFRStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CFRStatView)
	afx_msg void OnSelchangeDlci();
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CHlcStatViewBase form view

class CHlcStatViewBase : public CStatViewBase
{
protected:
	CHlcStatViewBase(UINT);     // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CHlcStatViewBase)
	virtual LPCTSTR GetStatName() 
		{ return GetDocument()->GetDataSource()->GetProtocol(); };

// Form Data
public:

	enum { idISDN_DirectoryNumber = 1, idISDN_SubAddress, idISDN_Spid };
	//{{AFX_DATA(CHlcStatViewBase)
	CComboBox	m_ModemBox;
	CListCtrl m_ISDNList;
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CHlcStatViewBase)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CHlcStatViewBase();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CHlcStatViewBase)
	afx_msg void OnSelchangeModem();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CPriStatView form view

class CPriStatView : public CHlcStatViewBase
{
protected:
	CPriStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPriStatView)

// Form Data
public:
	//{{AFX_DATA(CPriStatView)
	enum { IDD = IDD_PriStats };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPriStatView)
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CPriStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CPriStatView)
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CBriStatView form view

class CBriStatView : public CHlcStatViewBase
{
protected:
	CBriStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CBriStatView)

// Form Data
public:
	//{{AFX_DATA(CBriStatView)
	enum { IDD = IDD_BriStats };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBriStatView)
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CBriStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CBriStatView)
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CModemStatView form view

class CModemStatView : public CHlcStatViewBase
{
protected:
	CModemStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CModemStatView)

// Form Data
public:
	//{{AFX_DATA(CModemStatView)
	enum { IDD = IDD_ModemStats };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CModemStatView)
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CModemStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CModemStatView)
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CSnaStatView form view

#ifndef __AFXEXT_H__
#include <afxext.h>
#endif

class CSnaStatView : public CStatViewBase
{
protected:
	CSnaStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CSnaStatView)

	virtual LPCTSTR GetStatName()
		{ return "SNA"; };

// Form Data
public:
	//{{AFX_DATA(CSnaStatView)
	enum { IDD = IDD_SnaSimpleStats };
//	CComboBox	m_DLCIBox;
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSnaStatView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CSnaStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CSnaStatView)
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CX25StatView form view

#ifndef __AFXEXT_H__
#include <afxext.h>
#endif

class CX25StatView : public CStatViewBase
{
protected:
	CX25StatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CX25StatView)

	virtual LPCTSTR GetStatName() 
		{ return "X.25"; };

// Form Data
public:
	//{{AFX_DATA(CX25StatView)
	enum { IDD = IDD_X25SimpleStats };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CX25StatView)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CX25StatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CX25StatView)
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CPPPStatView form view


class CPPPStatView : public CStatViewBase
{
protected:
	CPPPStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPPPStatView)

	virtual LPCTSTR GetStatName()
		{ return "PPP"; };

// Form Data
public:
	//{{AFX_DATA(CPPPStatView)
	enum { IDD = IDD_PPPSimpleStats };
//	CComboBox	m_DLCIBox;
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPPPStatView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CPPPStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CPPPStatView)
	afx_msg void OnPaint();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CPPPCsuStatView form view


class CPPPCsuStatView : public CStatViewBase
{
protected:
	CPPPCsuStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPPPCsuStatView)

	virtual LPCTSTR GetStatName()
		{ return "PPP"; };

// Form Data
public:
	//{{AFX_DATA(CPPPCsuStatView)
	enum { IDD = IDD_CsuLine };
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPPPCsuStatView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CPPPCsuStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CPPPCsuStatView)
//	afx_msg void OnPaint();
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CFRCsuStatView form view

class CFRCsuStatView : public CStatViewBase
{
protected:
	CFRCsuStatView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CFRCsuStatView)

	virtual LPCTSTR GetStatName() 
		{ return "Frame Relay"; };

// Form Data
public:
	//{{AFX_DATA(CFRCsuStatView)
	enum { IDD = IDD_FRCsuStats };
	CComboBox	m_DLCIBox;
	//}}AFX_DATA

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFRCsuStatView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CFRCsuStatView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CFRCsuStatView)
	afx_msg void OnSelchangeDlci();
	afx_msg void OnPaint();
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

