]>
Commit | Line | Data |
---|---|---|
981b2508 RR |
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: | |
846e1424 | 36 | wxPlotCurve( int offsetY, double startY, double endY ); |
981b2508 RR |
37 | |
38 | virtual wxInt32 GetStartX() = 0; | |
39 | virtual wxInt32 GetEndX() = 0; | |
846e1424 RR |
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; } | |
981b2508 RR |
53 | int GetOffsetY() |
54 | { return m_offsetY; } | |
55 | ||
981b2508 RR |
56 | private: |
57 | int m_offsetY; | |
846e1424 RR |
58 | double m_startY; |
59 | double m_endY; | |
981b2508 RR |
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 ); | |
d3a809c7 RR |
76 | |
77 | void DrawCurve( wxDC *dc, wxPlotCurve *curve, int from = -1, int to = -1 ); | |
78 | void DeleteCurve( wxPlotCurve *curve, int from = -1, int to = -1 ); | |
981b2508 RR |
79 | |
80 | private: | |
81 | wxPlotWindow *m_owner; | |
82 | ||
83 | DECLARE_CLASS(wxPlotArea) | |
84 | DECLARE_EVENT_TABLE() | |
85 | }; | |
86 | ||
87 | //----------------------------------------------------------------------------- | |
88 | // wxPlotWindow | |
89 | //----------------------------------------------------------------------------- | |
90 | ||
91 | class WXDLLEXPORT wxPlotWindow: public wxScrolledWindow | |
92 | { | |
93 | public: | |
94 | wxPlotWindow() {} | |
95 | wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flags ); | |
96 | ~wxPlotWindow(); | |
97 | ||
98 | void Add( wxPlotCurve *curve ); | |
99 | size_t GetCount(); | |
100 | wxPlotCurve *GetAt( size_t n ); | |
101 | ||
102 | void SetCurrent( wxPlotCurve* current ); | |
103 | wxPlotCurve *GetCurrent(); | |
104 | ||
d3a809c7 RR |
105 | void Move( wxPlotCurve* curve, int pixels_up ); |
106 | void Enlarge( wxPlotCurve *curve, double factor ); | |
107 | ||
108 | void OnMoveUp( wxCommandEvent& event ); | |
109 | void OnMoveDown( wxCommandEvent& event ); | |
110 | ||
111 | void OnEnlarge100( wxCommandEvent& event ); | |
112 | void OnEnlarge50( wxCommandEvent& event ); | |
113 | void OnShrink50( wxCommandEvent& event ); | |
114 | void OnShrink33( wxCommandEvent& event ); | |
115 | ||
981b2508 | 116 | void OnPaint( wxPaintEvent &event ); |
d3a809c7 RR |
117 | |
118 | void RedrawYAxis(); | |
981b2508 RR |
119 | |
120 | private: | |
121 | friend wxPlotArea; | |
d3a809c7 | 122 | |
981b2508 RR |
123 | wxList m_curves; |
124 | wxPlotArea *m_area; | |
125 | wxPlotCurve *m_current; | |
126 | ||
127 | DECLARE_CLASS(wxPlotWindow) | |
128 | DECLARE_EVENT_TABLE() | |
129 | }; | |
130 | ||
131 | #endif | |
132 | // _WX_PLOT_H_ |