]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/plot.h
da2436de3ee1159f088b033c017821469538cef8
[wxWidgets.git] / include / wx / generic / plot.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: plot.h
3 // Purpose: wxPlotWindow
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 12/1/2000
7 // Copyright: (c) Robert Roebling
8 // RCS-ID: $Id$
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PLOT_H_
13 #define _WX_PLOT_H_
14
15 #ifdef __GNUG__
16 #pragma interface "plot.h"
17 #endif
18
19 #include "wx/scrolwin.h"
20
21 //-----------------------------------------------------------------------------
22 // classes
23 //-----------------------------------------------------------------------------
24
25 class wxPlotCurve;
26 class wxPlotArea;
27 class wxPlotWindow;
28
29 //-----------------------------------------------------------------------------
30 // wxPlotCurve
31 //-----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxPlotCurve: public wxObject
34 {
35 public:
36 wxPlotCurve( int offsetY, double startY, double endY );
37
38 virtual wxInt32 GetStartX() = 0;
39 virtual wxInt32 GetEndX() = 0;
40
41 virtual double GetY( wxInt32 x ) = 0;
42
43 void SetStartY( double startY )
44 { m_startY = startY; }
45 double GetStartY()
46 { return m_startY; }
47 void SetEndY( double endY )
48 { m_endY = endY; }
49 double GetEndY()
50 { return m_endY; }
51 void SetOffsetY( int offsetY )
52 { m_offsetY = offsetY; }
53 int GetOffsetY()
54 { return m_offsetY; }
55
56 private:
57 int m_offsetY;
58 double m_startY;
59 double m_endY;
60
61 DECLARE_ABSTRACT_CLASS(wxPlotCurve)
62 };
63
64 //-----------------------------------------------------------------------------
65 // wxPlotArea
66 //-----------------------------------------------------------------------------
67
68 class WXDLLEXPORT wxPlotArea: public wxWindow
69 {
70 public:
71 wxPlotArea() {}
72 wxPlotArea( wxPlotWindow *parent );
73
74 void OnPaint( wxPaintEvent &event );
75 void OnMouse( wxMouseEvent &event );
76
77 private:
78 wxPlotWindow *m_owner;
79
80 DECLARE_CLASS(wxPlotArea)
81 DECLARE_EVENT_TABLE()
82 };
83
84 //-----------------------------------------------------------------------------
85 // wxPlotWindow
86 //-----------------------------------------------------------------------------
87
88 class WXDLLEXPORT wxPlotWindow: public wxScrolledWindow
89 {
90 public:
91 wxPlotWindow() {}
92 wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flags );
93 ~wxPlotWindow();
94
95 void Add( wxPlotCurve *curve );
96 size_t GetCount();
97 wxPlotCurve *GetAt( size_t n );
98
99 void SetCurrent( wxPlotCurve* current );
100 wxPlotCurve *GetCurrent();
101
102 void OnPaint( wxPaintEvent &event );
103
104 private:
105 friend wxPlotArea;
106
107 wxList m_curves;
108 wxPlotArea *m_area;
109 wxPlotCurve *m_current;
110
111 DECLARE_CLASS(wxPlotWindow)
112 DECLARE_EVENT_TABLE()
113 };
114
115 #endif
116 // _WX_PLOT_H_