00001 /* 00002 * 00003 * ChartLabel.h 00004 * 00005 * Written by Cédric Moonen (cedric_moonen@hotmail.com) 00006 * 00007 * 00008 * 00009 * This code may be used for any non-commercial and commercial purposes in a compiled form. 00010 * The code may be redistributed as long as it remains unmodified and providing that the 00011 * author name and this disclaimer remain intact. The sources can be modified WITH the author 00012 * consent only. 00013 * 00014 * This code is provided without any garanties. I cannot be held responsible for the damage or 00015 * the loss of time it causes. Use it at your own risks 00016 * 00017 * An e-mail to notify me that you are using this code is appreciated also. 00018 * 00019 * 00020 */ 00021 00022 #ifndef _CHARTLABEL_H_ 00023 #define _CHARTLABEL_H_ 00024 00025 template <class PointType> 00026 class CChartSerieBase; 00027 00029 00041 template <class PointType> 00042 class CChartLabelProvider 00043 { 00044 public: 00046 CChartLabelProvider() { } 00048 virtual ~CChartLabelProvider() { } 00049 00051 00058 virtual TChartString GetText(CChartSerieBase<PointType>* pSerie, 00059 unsigned PointIndex) = 0; 00060 }; 00061 00063 00066 template <class PointType> 00067 class CChartLabel 00068 { 00069 friend CChartSerieBase<PointType>; 00070 00071 public: 00073 void SetLabelText(const TChartString& strText); 00075 00081 void SetFont(int nPointSize, const TChartString& strFaceName); 00083 void SetVisisble(bool bVisible); 00085 void SetLabelProvider(CChartLabelProvider<PointType>* pProvider) 00086 { 00087 m_pLabelProvider = pProvider; 00088 } 00089 00090 protected: 00092 CChartLabel(CChartCtrl* pParentCtrl, CChartSerieBase<PointType>* pParentSeries); 00094 virtual ~CChartLabel(); 00095 00097 00100 virtual void Draw(CDC* pDC, unsigned uPointIndex) = 0; 00101 00103 bool m_bIsVisible; 00105 int m_iFontSize; 00107 TChartString m_strFontName; 00108 00110 TChartString m_strLabelText; 00112 CChartLabelProvider<PointType>* m_pLabelProvider; 00113 00115 CChartCtrl* m_pParentCtrl; 00117 CChartSerieBase<PointType>* m_pParentSeries; 00118 }; 00119 00120 #include "ChartLabel.inl" 00121 00122 #endif // _CHARTLABEL_H_