Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cGraphPen.h
Go to the documentation of this file.
1 //
4 //
5 #ifndef _INC_GraphPen_H
6 #define _INC_GraphPen_H
7 #ifndef NO_PRAGMA_ONCE
8 #pragma once
9 #endif
10 
11 #include "../CGraphCfg.h"
12 #include "../CGraphData.h"
13 
14 #ifdef _MFC_VER
15 
16 namespace GrayGraph
17 {
18  class CGraphPen : public CButton, public CGraphData
19  {
23  // a time sorted stream of data points.
24  // Assume each block is a time gap.
25 
26  private:
27  // CGraphTimeSpan m_curTimeScaleGap; //!< how much min time is in the data gaps now.
28  CGraphPenCfg* m_pPenCfg;
29  int m_iPenCfgUniqueID;
30 
31 #ifdef _DEBUG
32  public:
33  GraphVal_t m_iDebugGenMin;
34  GraphVal_t m_iDebugGenRange;
35 #endif
36 
37  public:
38  CGraphPen(CGraphPenCfg *pCfg);
39  CGraphPen();
40 
41  private:
42  void DrawItem(CDC& dc, LPDRAWITEMSTRUCT pDIS);
43 
44  public:
45  // void SetTimeGapSize( cTimeSpan iTimeGapSize );
46 
47  void DoFit(int fitType);
48 
49  CGraphPenCfg* get_PenCfg() const
50  {
51  ASSERT(m_pPenCfg!=nullptr);
52  return m_pPenCfg;
53  }
54  bool CheckSamePenSource(CGraphPenCfg* pPenCfg)
55  {
56  ASSERT(pPenCfg != nullptr);
57  if (pPenCfg->GetUniqueID() == m_iPenCfgUniqueID)
58  {
59  m_pPenCfg = pPenCfg;
60  return true;
61  }
62  return false;
63  }
64 
65  bool IsDataVisible() const
66  {
67  ASSERT(m_pPenCfg != nullptr);
68  return(!m_pPenCfg->m_fMasked);
69  }
70 
71  const CGraphPen& operator=(const CGraphPen& pen)
72  {
73  // Simple copy operator for construction only.
74  ASSERT(pen.m_pPenCfg != nullptr);
75  m_pPenCfg = pen.m_pPenCfg; // pointer back to my Pen config info. (saved stuff)
76  m_iPenCfgUniqueID = m_pPenCfg->GetUniqueID();
77  return *this;
78  }
79 
80  ITERATE_t ExportFileDlg(CWnd* pWndParent);
81  ITERATE_t ImportFileDlg(CWnd* pWndParent);
82 
83  // Overrides
84  // ClassWizard generated virtual function overrides
85  //{{AFX_VIRTUAL(CGraphPen)
86  public:
87  virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
88  protected:
89  virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
90  //}}AFX_VIRTUAL
91 
92  // Implementation
93  public:
94  virtual ~CGraphPen();
95 
96  // Generated message map functions
97  protected:
98  //{{AFX_MSG(CGraphPen)
99  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
100  afx_msg void OnInitMenu(CMenu* pMenu);
101  afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
102  //}}AFX_MSG
103 
104  DECLARE_MESSAGE_MAP()
105  };
106 
108 
109  //{{AFX_INSERT_LOCATION}}
110  // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
111 };
112 #endif
113 #endif // !defined(_INC_GraphPen_H)
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: GrayGraph.cpp:29
double GraphVal_t
this is the value type we are plotting. Must also be able to hold GraphTime_t.
Definition: cGraphCfg.h:66
cWndHandle CWnd
Definition: cWndHandle.h:669
cPoint2i CPoint
Compatible with MFC 2d CPoint,CRect.
Definition: cPoint2.h:65
int ITERATE_t
like size_t but signed
Definition: Index.h:28