]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/plot.h
Fixes for problem where selection fails to start on dragging mouse in
[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 void DrawCurve( wxDC *dc, wxPlotCurve *curve, int from = -1, int to = -1 );
78 void DeleteCurve( wxPlotCurve *curve, int from = -1, int to = -1 );
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
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
116 void OnPaint( wxPaintEvent &event );
117
118 void RedrawYAxis();
119
120 private:
121 friend wxPlotArea;
122
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_