wxFreeChart
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 = *wxBLACK_PEN, wxBrush fillBrush = *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  }
88 
93  const wxBrush &GetFillBrush()
94  {
95  return m_fillBrush;
96  }
97 
102  void SetFillBrush(wxBrush fillBrush)
103  {
104  m_fillBrush = fillBrush;
105  }
106 
107 private:
108  wxBrush m_fillBrush;
109  wxPen m_borderPen;
110 };
111 
116 class WXDLLIMPEXP_FREECHART GradientAreaDraw : public AreaDraw
117 {
118 public:
126  GradientAreaDraw(wxPen borderPen = *wxBLACK_PEN,
127  wxColour colour1 = wxColour(200, 220, 250),
128  wxColour colour2 = wxColour(255, 255, 255),
129  wxDirection dir = wxEAST);
130 
131  virtual ~GradientAreaDraw();
132 
133  virtual void Draw(wxDC &dc, wxRect rc);
134 
139  void SetColour1(wxColour colour1)
140  {
141  m_colour1 = colour1;
142  }
143 
148  void SetColour2(wxColour colour2)
149  {
150  m_colour2 = colour2;
151  }
152 
157  void SetDirection(wxDirection dir)
158  {
159  m_dir = dir;
160  }
161 
162 private:
163  wxPen m_borderPen;
164 
165  wxColour m_colour1;
166  wxColour m_colour2;
167  wxDirection m_dir;
168 };
169 
170 WX_DECLARE_HASH_MAP(int, AreaDraw *, wxIntegerHash, wxIntegerEqual, AreaDrawMap);
171 // IY: Class declaration not required because already declared by above
172 // declaration (on Linux at least). It may be needed in Windows.
173 // class WXDLLIMPEXP_FREECHART AreaDrawMap;
174 
179 class WXDLLIMPEXP_FREECHART AreaDrawCollection
180 {
181 public:
183  virtual ~AreaDrawCollection();
184 
190  void SetAreaDraw(int serie, AreaDraw *areaDraw);
191 
197  AreaDraw *GetAreaDraw(int serie);
198 
199 private:
200  AreaDrawMap m_areas;
201 };
202 
203 #endif /*AREADRAW_H_*/
void SetColour2(wxColour colour2)
Sets gradient fill second color.
Definition: areadraw.h:148
void SetFillBrush(wxBrush fillBrush)
Sets fill brush.
Definition: areadraw.h:102
Collection of areadraws for series.
Definition: areadraw.h:179
void SetDirection(wxDirection dir)
Sets gradient fill direction.
Definition: areadraw.h:157
Base class for objects drawn on chart or perform drawing of another objects (like renderers...
Definition: drawobject.h:22
Transparent area draw.
Definition: areadraw.h:41
void SetBorderPen(wxPen borderPen)
Sets border pen.
Definition: areadraw.h:84
const wxPen & GetBorderPen()
Returns border pen.
Definition: areadraw.h:75
virtual void Draw(wxDC &dc, wxRect rc)=0
Draw area background.
Gradient fill area.
Definition: areadraw.h:116
const wxBrush & GetFillBrush()
Returns fill brush.
Definition: areadraw.h:93
Fills area with specified brush and draw outline of area with specified pen.
Definition: areadraw.h:55
Base class for drawing area background.
Definition: areadraw.h:22
void SetColour1(wxColour colour1)
Sets gradient fill first color.
Definition: areadraw.h:139