#if !defined(AFX_NTGRAPHCTL_H__4E772943_A5F2_4917_B53F_DE7BE01A6E36__INCLUDED_)
#define AFX_NTGRAPHCTL_H__4E772943_A5F2_4917_B53F_DE7BE01A6E36__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef MAX
#define MAX 1
#endif
#ifndef MIN
#define MIN 0
#endif
#define MAX_ELEMENTS 100
#include <vector>
using namespace std;
class CGraphElement {
public :
int m_nCount; // Added by A. Hofmann
BOOL m_bShow; // Added by A. Hofmann
CGraphElement() ;
BOOL bIsPlotAvailable ;
double *dValueX ;
double *dValueY ;
COLORREF m_Color ;
int m_Type, m_Width ;
BOOL NewElement(UINT nPoint);
BOOL DeleteElement();
protected:
BOOL bBufferAllocated;
} ;
// NTGraphCtl.h : Declaration of the CNTGraphCtrl ActiveX Control class.
/////////////////////////////////////////////////////////////////////////////
// CNTGraphCtrl : See NTGraphCtl.cpp for implementation.
class CNTGraphCtrl : public COleControl
{
DECLARE_DYNCREATE(CNTGraphCtrl)
// Constructor
public:
CNTGraphCtrl();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNTGraphCtrl)
public:
virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
virtual void DoPropExchange(CPropExchange* pPX);
virtual void OnResetState();
virtual DWORD GetControlFlags();
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnFontChanged();
//}}AFX_VIRTUAL
// Implementation
protected:
~CNTGraphCtrl();
DECLARE_OLECREATE_EX(CNTGraphCtrl) // Class factory and guid
DECLARE_OLETYPELIB(CNTGraphCtrl) // GetTypeInfo
DECLARE_PROPPAGEIDS(CNTGraphCtrl) // Property page IDs
DECLARE_OLECTLTYPE(CNTGraphCtrl) // Type name and misc status
// Subclassed control support
BOOL IsSubclassedControl();
LRESULT OnOcmCommand(WPARAM wParam, LPARAM lParam);
// Message maps
//{{AFX_MSG(CNTGraphCtrl)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Dispatch maps
//{{AFX_DISPATCH(CNTGraphCtrl)
BOOL m_showGrid;
afx_msg void OnShowGridChanged();
CString m_strLabelX;
afx_msg void OnXLabelChanged();
CString m_strLabelY;
afx_msg void OnYLabelChanged();
OLE_COLOR m_gridColor;
afx_msg void OnGridColorChanged();
OLE_COLOR m_labelColor;
afx_msg void OnLabelColorChanged();
OLE_COLOR m_axisColor;
afx_msg void OnAxisColorChanged();
short m_nGridX;
afx_msg void OnNGridXChanged();
short m_nGridY;
afx_msg void OnNGridYChanged();
CString m_strGraphTitle;
afx_msg void OnGraphTitleChanged();
OLE_COLOR m_cursorColor;
afx_msg void OnCursorColorChanged();
BOOL m_zoomMode;
afx_msg void OnZoomModeChanged();
BOOL m_cursorMode;
afx_msg void OnCursorModeChanged();
double m_xCursor;
afx_msg void OnXCursorChanged();
double m_yCursor;
afx_msg void OnYCursorChanged();
BOOL m_panMode;
afx_msg void OnPanModeChanged();
afx_msg short GetElementCount();
afx_msg void SetElementCount(short nNewValue);
afx_msg LPDISPATCH GetTickFont();
afx_msg void SetTickFont(LPDISPATCH newValue);
afx_msg LPDISPATCH GetTitleFont();
afx_msg void SetTitleFont(LPDISPATCH newValue);
afx_msg LPDISPATCH GetLabelFont();
afx_msg void SetLabelFont(LPDISPATCH newValue);
afx_msg void ClearGraph();
afx_msg BOOL CreateElement(long nElement);
afx_msg BOOL SetRange(double MinX, double MaxX,double MinY,double MaxY);
afx_msg BOOL SetXYValue(double x, double y, long index, short iElementId);
afx_msg void Copy2Clipboard();
afx_msg void AutoRange();
afx_msg void ShowElement(short ElementID, BOOL bShow);
afx_msg short GetElementLinetype(short ElementID);
afx_msg void SetElementLinetype(short ElementID, short nNewValue);
afx_msg short GetElementLinewidth(short ElementID);
afx_msg void SetElementLinewidth(short ElementID, short nNewValue);
afx_msg OLE_COLOR GetElementColor(short ElementID);
afx_msg void SetElementColor(short ElementID, OLE_COLOR nNewValue);
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
afx_msg void AboutBox();
// Event maps
//{{AFX_EVENT(CNTGraphCtrl)
void FireCursorEvent(double x, double y)
{FireEvent(eventidCursorEvent,EVENT_PARAM(VTS_R8 VTS_R8), x, y);}
//}}AFX_EVENT
DECLARE_EVENT_MAP()
// Dispatch and event IDs
public:
enum {
//{{AFX_DISP_ID(CNTGraphCtrl)
dispidShowGrid = 1L,
dispidXLabel = 2L,
dispidYLabel = 3L,
dispidGridColor = 4L,
dispidLabelColor = 5L,
dispidAxisColor = 6L,
dispidNGridX = 7L,
dispidNGridY = 8L,
dispidGraphTitle = 9L,
dispidCursorColor = 10L,
dispidZoomMode = 11L,
dispidCursorMode = 12L,
dispidXCursor = 13L,
dispidYCursor = 14L,
dispidPanMode = 15L,
dispidElementCount = 16L,
dispidTickFont = 17L,
dispidTitleFont = 18L,
dispidLabelFont = 19L,
dispidClearGraph = 20L,
dispidCreateElement = 21L,
dispidSetRange = 22L,
dispidSetXYValue = 23L,
dispidCopy2Clipboard = 24L,
dispidAutoRange = 25L,
dispidElementLinetype = 27L,
dispidElementLinewidth = 28L,
dispidElementColor = 29L,
dispidShowElement = 26L,
eventidCursorEvent = 1L,
//}}AFX_DISP_ID
};
protected:
void ResCalc();
void CalcRect(CDC *pDC);
void DrawTitle(CDC *pDC);
void DrawGrid(CDC *pDC);
void DrawAxis(CDC *pDC);
void DrawTicks(CDC *pDC);
void DrawAxisLabel(CDC *pDC);
void DrawCursor(CDC *pDC);
void PlotElement(CDC *pDC);
void CreateYFont(CDC *pDC);
void DrawGraph(CDC *pDC);
void PrepareForDrawing(CDC *pDC, CRect rect);
void CursorPosition(CPoint point);
void DoPan(CPoint point);
void DoPrint(CDC *pDC, int x , int y);
CPoint Corrdinate(double x, double y);
CGraphElement mpElement[MAX_ELEMENTS] ;
CToolTipCtrl m_ttip;
void RelayEvent(UINT message, WPARAM wParam, LPARAM lParam);
void FillToolInfo(TOOLINFO *ti);
int nPointCount, nPlotIndex, nElementCount ;
double dResY, dResX ;
double dRangeY[2], dRangeX[2];
double dOldRangeX[2], dOldRangeY[2];
double dAutoRangeX[2], dAutoRangeY[2];
COLORREF m_BGColor ;
BOOL bIsElementAllocated ;
BOOL bIsElementAvailable ;
BOOL bIsFontCreated;
BOOL bUnzoom;
CPoint m_OldPoint;
CDC m_dcBackground ;
CBitmap *m_pBitmapOldBackground ;
CBitmap m_bitmapBackground ;
CRect m_ctlRect;
CRect m_axisRect;
CFont *m_pYLabelFont;
CFontHolder m_fontTick;
CFontHolder m_fontTitle;
CFontHolder m_fontLabel;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_NTGRAPHCTL_H__4E772943_A5F2_4917_B53F_DE7BE01A6E36__INCLUDED)