Version: 0.6.0
areadraw.h
1 // Name: areadraw.h
3 // Purpose: area draw 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 AREADRAW_H_
11 #define AREADRAW_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/hashmap.h>
15 
16 #include <wx/drawobject.h>
17 
22 class WXDLLIMPEXP_FREECHART AreaDraw : public DrawObject
23 {
24 public:
25  AreaDraw();
26 
27  virtual ~AreaDraw();
28 
34  virtual void Draw(wxDC &dc, wxRect rc) = 0;
35 };
36 
41 class WXDLLIMPEXP_FREECHART NoAreaDraw : public AreaDraw
42 {
43 public:
44  NoAreaDraw();
45 
46  virtual ~NoAreaDraw();
47 
48  virtual void Draw(wxDC &dc, wxRect rc);
49 };
50 
55 class WXDLLIMPEXP_FREECHART FillAreaDraw : public AreaDraw
56 {
57 public:
63  FillAreaDraw(wxPen borderPen = (wxPen) *wxBLACK_PEN, wxBrush fillBrush = (wxBrush) *wxWHITE_BRUSH);
64 
65  FillAreaDraw(wxColour borderColour, wxColour fillColour);
66 
67  virtual ~FillAreaDraw();
68 
69  virtual void Draw(wxDC &dc, wxRect rc);
70 
75  const wxPen &GetBorderPen()
76  {
77  return m_borderPen;
78  }
79 
84  void SetBorderPen(wxPen borderPen)
85  {
86  m_borderPen = borderPen;
87  FireNeedRedraw();
88  }
89 
94  const wxBrush &GetFillBrush()
95  {
96  return m_fillBrush;
97  }
98 
103  void SetFillBrush(wxBrush fillBrush)
104  {
105  m_fillBrush = fillBrush;
106  FireNeedRedraw();
107  }
108 
109 private:
110  wxBrush m_fillBrush;
111  wxPen m_borderPen;
112 };
113 
118 class WXDLLIMPEXP_FREECHART GradientAreaDraw : public AreaDraw
119 {
120 public:
128  GradientAreaDraw(wxPen borderPen = *wxBLACK_PEN,
129  wxColour colour1 = wxColour(200, 220, 250),
130  wxColour colour2 = wxColour(255, 255, 255),
131  wxDirection dir = wxEAST);
132 
133  virtual ~GradientAreaDraw();
134 
135  virtual void Draw(wxDC &dc, wxRect rc);
136 
141  void SetColour1(wxColour colour1)
142  {
143  m_colour1 = colour1;
144  FireNeedRedraw();
145  }
146 
151  void SetColour2(wxColour colour2)
152  {
153  m_colour2 = colour2;
154  FireNeedRedraw();
155  }
156 
161  void SetDirection(wxDirection dir)
162  {
163  m_dir = dir;
164  FireNeedRedraw();
165  }
166 
167 private:
168  wxPen m_borderPen;
169 
170  wxColour m_colour1;
171  wxColour m_colour2;
172  wxDirection m_dir;
173 };
174 
175 WX_DECLARE_HASH_MAP(int, AreaDraw *, wxIntegerHash, wxIntegerEqual, AreaDrawMap);
176 class AreaDrawMap;
177 
182 class WXDLLIMPEXP_FREECHART AreaDrawCollection
183 {
184 public:
186  virtual ~AreaDrawCollection();
187 
193  void SetAreaDraw(int serie, AreaDraw *areaDraw);
194 
200  AreaDraw *GetAreaDraw(int serie);
201 
202 private:
203  AreaDrawMap m_areas;
204 };
205 
206 #endif /*AREADRAW_H_*/
void SetBorderPen(wxPen borderPen)
Definition: areadraw.h:84
void SetDirection(wxDirection dir)
Definition: areadraw.h:161
Definition: areadraw.h:118
Definition: areadraw.h:22
void SetFillBrush(wxBrush fillBrush)
Definition: areadraw.h:103
const wxPen & GetBorderPen()
Definition: areadraw.h:75
Definition: areadraw.h:182
virtual void Draw(wxDC &dc, wxRect rc)=0
Definition: drawobject.h:45
void SetColour1(wxColour colour1)
Definition: areadraw.h:141
void SetColour2(wxColour colour2)
Definition: areadraw.h:151
Definition: areadraw.h:41
Definition: areadraw.h:55
const wxBrush & GetFillBrush()
Definition: areadraw.h:94