www.pudn.com > PressMonitor_q.zip > 3DBarCtrl.h


#if !defined(AFX_3DBARCTRL_H__CFEEBE6F_AF67_415B_97D9_DCEB1FABF601__INCLUDED_) 
#define AFX_3DBARCTRL_H__CFEEBE6F_AF67_415B_97D9_DCEB1FABF601__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
class CBarItemInfo 
{ 
public: 
	CBarItemInfo(CString name , float value, COLORREF color ) 
	{  
		m_Name      = name; 
        m_Value     = value;     
        m_Color     = color; 
	} 
 
	~CBarItemInfo() {}; 
 
public: 
	CString     m_Name; 
    float       m_Value; 
    COLORREF    m_Color; 
 
public: 
	CString 	GetName() 
	{ 
		return m_Name; 
	} 
 
    float     GetValue() 
    { 
        return m_Value; 
    } 
 
    void    SetValue(float value) 
    { 
        m_Value = value; 
    } 
 
 
    COLORREF GetColor() 
    { 
        return m_Color;         
    } 
}; 
// 3DBarCtrl.h : header file 
// 
 
///////////////////////////////////////////////////////////////////////////// 
// C3DBarCtrl window 
#include  
class C3DBarCtrl : public CStatic 
{ 
// Construction 
public: 
	C3DBarCtrl(); 
 
// Attributes 
public: 
	bool		m_bGridBelow; 
    int			m_nValueStep; 
    float       m_MiniValue; 
    float       m_MaxiValue; 
 
    float       m_VertRatio; 
	int			m_nFrameWidth; 
 
	//fontHeight Value 
	int			m_nScaleHeight; 
	int			m_nUnitHeight; 
	int			m_nNameHeight; 
	int			m_nValueHeight; 
 
 
    int			m_nItemCount; 
    CString     m_strUnit; 
 
	CArray m_BarItemArray; 
 
 
protected: 
 
    // CDC and images 
	CDC			m_dcBackground ; 
	CBitmap		*m_pBitmapOldBackground ; 
	CBitmap		m_bitmapBackground ; 
 
	// bar rect setting 
	CRect		m_rectCtrl ; 
	CRect		m_rectPane ; 
	CRect		m_rectChart ; 
	CRect		m_rectPaneLeft ; 
	CRect		m_rectPaneRight ; 
	CRect		m_rectPaneTop ; 
	CRect		m_rectPaneBottom ; 
 
 
    // barchart colours 
	COLORREF	m_crGrid; 
	COLORREF	m_crFrame; 
	COLORREF	m_crBkGnd; 
	COLORREF	m_crPane; 
	COLORREF	m_crScale; 
	COLORREF	m_crValue; 
	COLORREF	m_crName; 
	COLORREF	m_crRuler; 
	COLORREF	m_crUnit; 
 
	//system colours 
    COLORREF    m_crWindowText; 
	COLORREF	m_crWindow; 
	COLORREF	m_cr3DFace;      
    COLORREF    m_crShadow; 
	COLORREF	m_crHighlight; 
	COLORREF	m_crDkShadow; 
	COLORREF	m_crLight;   
 
// Operations 
public: 
	//baritems operations 
	bool		AddBarItem(CString name, float value, COLORREF color ); 
	bool		RemoveBarItem(int index); 
	void		SetItemValue(int index, float value); 
 
public:   
	//functions to get value of items; 
    CString     GetItemName(int Index); 
    float       GetItemValue(int Index); 
    COLORREF    GetItemColor(int Index); 
    int	        GetItemCount() const    { return m_nItemCount; } 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(C3DBarCtrl) 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	void PaintRect(CDC* pDC, int x, int y, int w, int h, COLORREF color); 
    void RefreshWindow()                     { Invalidate();    } 
	void PaintGradiantRect(CDC *pDC, const RECT &rect,COLORREF clrFrom, COLORREF clrTo =RGB(255,255,255), BOOL ascend = true); 
	void DrawColorBar(CDC *pDC,CRect &rect,COLORREF colorFrom,COLORREF colorTo=RGB(255,255,255)); 
	void DrawUnit(CDC *pDC); 
	void DrawBar(CDC *pDC); 
	void DrawValue(CDC *pDC); 
	void DrawName(CDC *pDC); 
	void DrawGrid(CDC *pDC); 
	void DrawScale(CDC *pDC); 
	void DrawRuler(CDC *pDC); 
	void DrawPane(CDC *pDC); 
	void DrawFrame(CDC* pDC); 
	BOOL		SetScaleFromToValue(float from, float to , int ValueStep =4); 
	BOOL		ReCalculating(); 
	BOOL		Initialize(); 
	void		ReconstructControl(); 
	virtual		~C3DBarCtrl(); 
 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(C3DBarCtrl) 
	afx_msg void OnSize(UINT nType, int cx, int cy); 
	afx_msg void OnPaint(); 
	afx_msg BOOL OnEraseBkgnd(CDC* pDC); 
	//}}AFX_MSG 
 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_3DBARCTRL_H__CFEEBE6F_AF67_415B_97D9_DCEB1FABF601__INCLUDED_)