Version: 0.6.0
plot.h
1 // Name: plot.h
3 // Purpose: plot base class 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 PLOT_H_
11 #define PLOT_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/observable.h>
15 
16 #include <wx/areadraw.h>
17 
18 class WXDLLIMPEXP_FREECHART Plot;
19 class WXDLLIMPEXP_FREECHART wxChartPanel;
20 
24 class WXDLLIMPEXP_FREECHART PlotObserver
25 {
26 public:
27  PlotObserver();
28 
29  virtual ~PlotObserver();
30 
35  virtual void PlotNeedRedraw(Plot *_plot) = 0;
36 };
37 
42 class WXDLLIMPEXP_FREECHART Plot : public Observable<PlotObserver>
43 {
44 public:
45  Plot();
46  virtual ~Plot();
47 
53  virtual void Draw(wxDC &dc, wxRect rc);
54 
61  virtual void DrawNoDataMessage(wxDC &dc, wxRect rc);
62 
63  void SetChartPanel(wxChartPanel *chartPanel);
64 
69  wxChartPanel *GetChartPanel();
70 
71 
76  void SetBackground(AreaDraw *background)
77  {
78  wxREPLACE(m_background, background);
79  FirePlotNeedRedraw();
80  }
81 
86  void SetTextNoData(const wxString &textNoData)
87  {
88  m_textNoData = textNoData;
89  FirePlotNeedRedraw();
90  }
91 
92 protected:
98  virtual bool HasData() = 0;
99 
106  virtual void DrawData(wxDC &dc, wxRect rc) = 0;
107 
113  virtual void ChartPanelChanged(wxChartPanel *oldPanel, wxChartPanel *newPanel);
114 
115  FIRE_WITH_THIS(PlotNeedRedraw);
116 
117 private:
118  wxFont m_textNoDataFont;
119  wxString m_textNoData;
120 
121  AreaDraw *m_background;
122 
123  wxChartPanel *m_chartPanel;
124 };
125 
126 #endif /*PLOT_H_*/
Definition: chartpanel.h:51
Definition: areadraw.h:22
void SetBackground(AreaDraw *background)
Definition: plot.h:76
Definition: observable.h:14
Definition: plot.h:24
Definition: plot.h:42
void SetTextNoData(const wxString &textNoData)
Definition: plot.h:86