wxFreeChart
chartpanel.h
1 // Name: chartpanel.h
3 // Purpose: wxChartPanel declaration
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 CHARTPANEL_H_
11 #define CHARTPANEL_H_
12 
13 #include <wx/wxfreechartdefs.h>
14 #include <wx/chart.h>
15 
16 class wxChartPanel;
17 
21 class WXDLLIMPEXP_FREECHART ChartPanelMode
22 {
23 public:
24  // IY: Virtual destructor needed otherwise behaviour is undefined.
25  virtual ~ChartPanelMode() {}
26  virtual void Init(wxChartPanel *chartPanel) = 0;
27 };
28 
29 
34 class WXDLLIMPEXP_FREECHART wxChartPanel : public wxScrolledWindow
35 {
36 public:
37  wxChartPanel(wxWindow *parent, wxWindowID = wxID_ANY, Chart *chart = NULL,
38  const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
39  virtual ~wxChartPanel();
40 
45  void SetChart(Chart *chart);
46 
51  Chart *GetChart();
52 
57  void SetMode(ChartPanelMode *mode);
58 
66  void SetAntialias(bool antialias);
67 
72  bool GetAntialias();
73 
79  wxBitmap CopyBackbuffer();
80 
81  //
82  // ChartObserver
83  //
84  virtual void ChartChanged(Chart *chart);
85 
86  virtual void ChartScrollsChanged(Chart *chart);
87 
88  // TODO: Quick hack to allow axis plot to call to cause refresh from event - set back to private.
89  void RedrawBackBitmap();
90 
91 private:
92  void ResizeBackBitmap(wxSize size);
93  void RecalcScrollbars();
94 
95  //
96  // Event handlers
97  //
98  void OnPaint(wxPaintEvent &ev);
99  void OnSize(wxSizeEvent &ev);
100  void OnScrollWin(wxScrollWinEvent &ev);
101  void OnMouseEvents(wxMouseEvent &ev);
102 
103  void ScrollAxis(Axis *axis, int d);
104 
105  Chart *m_chart;
106 
107  wxBitmap m_backBitmap;
108 
109  bool m_antialias;
110 
111  ChartPanelMode *m_mode;
112 
113  DECLARE_EVENT_TABLE()
114 };
115 
116 
117 #endif /*CHARTPANEL_H_*/
Chart.
Definition: chart.h:30
ChartPanel is wxWidgets panel for displaying chart.
Definition: chartpanel.h:34
Base class for all axes.
Definition: axis.h:39
Base class for zoom/pan modes.
Definition: chartpanel.h:21