/******************************************************************************
**
** Authors : Satish Hota
** Date    : 21-Nov-01
** Filename: MFCDevConHelper.h
** Purpose : Interface for the CMFCDevConHelper class.
**
** History:
** 21-Nov-01 Satish Hota
**     File Created
** 25-Nov-01 Satish Hota
**     Added pens and brushes as member variables that are created on first use
**     and are destroyed when the destructor is called.
** 26-Nov-01 Satish Hota
**     Added new text methods GetTextExtents and TextOut.  Added a font member
**     variable to save the existing font.
** 30-Nov-01 Satish Hota
**     Added a PenType and LineEndType enumerations.  Changed the interface of
**     the Draw methods to accept pen-type and line-end-type.  Added a dashed
**     pen.
******************************************************************************/

#if !defined(AFX_MFCDEVCONHELPER_H__B17F7E25_7A2F_45F0_8A3A_2F6C671280EF__INCLUDED_)
#define AFX_MFCDEVCONHELPER_H__B17F7E25_7A2F_45F0_8A3A_2F6C671280EF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>

class CMFCDevConHelper  
{
public:
    enum PenType
    {
        PenType_Solid = 0x01,
        PenType_Dashed = 0x02,
        PenType_Thick = 0x04
    };

    enum LineEndType
    {
        LineEndType_Default = 0x00,
        LineEndType_StartArrow = 0x01,
        LineEndType_EndArrow   = 0x02,
        LineEndType_ArrowsAtBothEnds = 0x03
    };

public:
    virtual long TextOut(int nXCoor, int nYCoor, const std::string& strText);
    virtual long GetTextExtents(const std::string& strText, int* pnWidth, int* pnHeight);
	void PostUpdate();
	long DrawLine(int nFromX, int nFromY, int nToX, int nToY, PenType ePenType, LineEndType eLineEndType);
	long DrawRoundedRect(int nLeft, int nTop, int nRight, int nBottom, int nRoundX, int nRoundY, PenType ePenType);
	long DrawRectangle(int nLeft, int nTop, int nRight, int nBottom, PenType ePenType);
	CMFCDevConHelper(CView* pView, CDC* pDC);
	virtual ~CMFCDevConHelper();

protected:
	CView* m_pView;
	CDC* m_pDC;
	LOGBRUSH m_LogBrush;
	LOGPEN m_LogPen;
	LOGPEN m_LogThickPen;
    LOGPEN m_LogDashedPen;
private:
	CFont* m_pOldFont;
	CBrush* m_pBrush;
	CPen* m_pPen;
	CPen* m_pDashedPen;
	CPen* m_pThickPen;
	CPen* m_pOldPen;
	CBrush* m_pOldBrush;
	bool SwitchDrawingObjects(PenType ePenType, LineEndType eLineEndType);
	bool RestoreDrawingObjects();
};

#endif // !defined(AFX_MFCDEVCONHELPER_H__B17F7E25_7A2F_45F0_8A3A_2F6C671280EF__INCLUDED_)
