Version: 0.6.0
marker.h
1 // Name: marker.h
3 // Purpose: markers declarations
4 // Author: Moskvichev Andrey V.
5 // Created: 2008/11/07
6 // Copyright: (c) 2008-2010 Moskvichev Andrey V.
7 // Licence: wxWidgets licence
9 
10 #ifndef MARKER_H_
11 #define MARKER_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/drawobject.h>
15 #include <wx/areadraw.h>
16 
17 #include <wx/dynarray.h>
18 
19 class Axis;
20 
24 class WXDLLIMPEXP_FREECHART Marker : public DrawObject
25 {
26 public:
27  Marker();
28  virtual ~Marker();
29 
37  virtual void Draw(wxDC &dc, wxRect rcData, Axis *horizAxis, Axis *vertAxis) = 0;
38 };
39 
40 WX_DECLARE_USER_EXPORTED_OBJARRAY(Marker *, MarkerArray, WXDLLIMPEXP_FREECHART);
41 
45 class WXDLLIMPEXP_FREECHART PointMarker : public Marker
46 {
47 public:
48  PointMarker();
49  virtual ~PointMarker();
50 
51  virtual void Draw(wxDC &dc, wxRect rcData, Axis *horizAxis, Axis *vertAxis);
52 
53  void SetText(const wxString &text)
54  {
55  m_text = text;
56  FireNeedRedraw();
57  }
58 
59 private:
60  wxString m_text;
61  wxFont m_textFont;
62  wxColour m_textColour;
63 };
64 
68 class WXDLLIMPEXP_FREECHART LineMarker : public Marker
69 {
70 public:
71  LineMarker(wxPen linePen);
72 
73  LineMarker(wxColour lineColour, int lineWidth = 1);
74 
75  virtual ~LineMarker();
76 
77  virtual void Draw(wxDC &dc, wxRect rcData, Axis *horizAxis, Axis *vertAxis);
78 
83  void SetVerticalLine(double value);
84 
89  void SetHorizontalLine(double value);
90 
96  void SetValue(double value, bool horizontal);
97 
98 private:
99  wxPen m_linePen;
100 
101  double m_value;
102  bool m_horizontal;
103 };
104 
109 class WXDLLIMPEXP_FREECHART RangeMarker : public Marker
110 {
111 public:
112  RangeMarker(AreaDraw *rangeAreaDraw);
113  virtual ~RangeMarker();
114 
115  virtual void Draw(wxDC &dc, wxRect rcData, Axis *horizAxis, Axis *vertAxis);
116 
122  void SetVerticalRange(double minValue, double maxValue);
123 
129  void SetHorizontalRange(double minValue, double maxValue);
130 
137  void SetRange(double minValue, double maxValue, bool horizontal);
138 
143  void SetRangeAreaDraw(AreaDraw *rangeAreaDraw);
144 
145 private:
146  double m_minValue;
147  double m_maxValue;
148  bool m_horizontal;
149 
150  AreaDraw *m_rangeAreaDraw;
151 };
152 
153 #endif /*MARKER_H_*/
virtual void Draw(wxDC &dc, wxRect rcData, Axis *horizAxis, Axis *vertAxis)=0
Definition: marker.h:45
Definition: areadraw.h:22
Definition: marker.h:68
Definition: axis.h:62
Definition: drawobject.h:45
Definition: marker.h:24
Definition: marker.h:109