~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxContribItems/wxchart/include/wx/chartwindow.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        chartwindow.h
 
3
// Purpose:     wxChart
 
4
// Author:      Paolo Gava
 
5
// Modified by:
 
6
// Created:
 
7
// Copyright:   (C) 2006, Paolo Gava
 
8
// RCS-ID:      $Id: chartwindow.h 9270 2013-08-18 05:22:02Z mortenmacfly $
 
9
// Licence:     wxWindows licence
 
10
/////////////////////////////////////////////////////////////////////////////
 
11
 
 
12
#if !defined( __WXCHARTWINDOW_H__ )
 
13
#define __WXCHARTWINDOW_H__
 
14
 
 
15
//----------------------------------------------------------------------------
 
16
// Headers
 
17
//----------------------------------------------------------------------------
 
18
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 
19
#pragma interface "chartwindow.h"
 
20
#endif
 
21
 
 
22
#ifdef __BORLANDC__
 
23
#pragma hdrstop
 
24
#endif
 
25
 
 
26
#ifndef WX_PRECOMP
 
27
    #include <wx/window.h>
 
28
    #include <wx/scrolwin.h>
 
29
#endif
 
30
 
 
31
#include "wx/chart.h"
 
32
 
 
33
//----------------------------------------------------------------------------
 
34
// Classes
 
35
//----------------------------------------------------------------------------
 
36
class wxChartSizes;
 
37
 
 
38
//+++-S-cd-------------------------------------------------------------------
 
39
//      NAME:           CWxChartWindow
 
40
//      DESC:
 
41
//      INTERFACE:
 
42
//
 
43
//----------------------------------------------------------------------E-+++
 
44
/* C::B begin */
 
45
class WXDLLIMPEXP_CHART wxChartWindow : public wxWindow
 
46
/* C::B end */
 
47
{
 
48
public:
 
49
 
 
50
        wxChartWindow(wxScrolledWindow *parent = NULL, bool usegrid = true);
 
51
 
 
52
        // allow access of CChart's public methods
 
53
        // Add() - Clear()
 
54
        //-----------------------------------------
 
55
        void Add(wxChartPoints* cp);
 
56
        void Clear();
 
57
 
 
58
        // allow access of CChart's public methods
 
59
        // Get statistics
 
60
        //---------------
 
61
        ChartValue GetMaxX() const;
 
62
        ChartValue GetMinX() const;
 
63
        ChartValue GetMaxY() const;
 
64
        ChartValue GetMinY() const;
 
65
        int GetNumBarPoints() const;
 
66
        int GetNumBar3DPoints() const;
 
67
 
 
68
    // Get/Set virtual size
 
69
    //---------------------
 
70
    ChartValue GetVirtualMaxX() const;
 
71
    ChartValue GetVirtualMinX() const;
 
72
    ChartValue GetVirtualMaxY() const;
 
73
    ChartValue GetVirtualMinY() const;
 
74
    ChartValue GetVirtualWidth() const;
 
75
 
 
76
    // Get/Set zoom
 
77
    //-------------
 
78
    void SetZoom(double z);
 
79
    double GetZoom() const;
 
80
 
 
81
    // Set sizes for drawing
 
82
    //----------------------
 
83
    void SetSizes(wxChartSizes *sizes);
 
84
    wxChartSizes *GetSizes() const;
 
85
 
 
86
        // Draw chart points
 
87
        //------------------
 
88
        void Draw(CHART_HPAINT hp, int x = 0, int y = 0);
 
89
 
 
90
private:
 
91
        wxChart m_Chart;
 
92
        wxScrolledWindow *m_WinParent;
 
93
    bool m_UseGrid;
 
94
 
 
95
    // Draw helper function
 
96
    //-----------------
 
97
    void DrawHLines(CHART_HPAINT hp, CHART_HRECT hr);
 
98
 
 
99
        // wxWindows events
 
100
        //-----------------
 
101
    void OnPaint(wxPaintEvent &event);
 
102
    void OnMouse(wxMouseEvent &event);
 
103
 
 
104
/* C::B begin */
 
105
    DECLARE_DYNAMIC_CLASS(wxChartWindow)
 
106
/* C::B end */
 
107
    DECLARE_EVENT_TABLE()
 
108
};
 
109
 
 
110
//----------------------------------------------------------------------------
 
111
// Inlines
 
112
//----------------------------------------------------------------------------
 
113
 
 
114
 
 
115
//+++-S-cf-------------------------------------------------------------------
 
116
//      NAME:           Add()
 
117
//      DESC:
 
118
//      PARAMETERS:     CChartPoints* cp
 
119
//      RETURN:         None
 
120
//----------------------------------------------------------------------E-+++
 
121
inline void wxChartWindow::Add(
 
122
        wxChartPoints* cp
 
123
)
 
124
{
 
125
        m_Chart.Add( cp );
 
126
}
 
127
 
 
128
//+++-S-cf-------------------------------------------------------------------
 
129
//      NAME:           Clear()
 
130
//      DESC:
 
131
//      PARAMETERS:     None
 
132
//      RETURN:         None
 
133
//----------------------------------------------------------------------E-+++
 
134
inline void wxChartWindow::Clear()
 
135
{
 
136
        m_Chart.Clear();
 
137
}
 
138
 
 
139
//+++-S-cf-------------------------------------------------------------------
 
140
//      NAME:           GetMaxX()
 
141
//      DESC:           Get the max x-val calculated from all chartpoints
 
142
//      PARAMETERS:     None
 
143
//      RETURN:         ChartValue
 
144
//----------------------------------------------------------------------E-+++
 
145
inline ChartValue wxChartWindow::GetMaxX() const
 
146
{
 
147
        return ( m_Chart.GetMaxX() );
 
148
}
 
149
 
 
150
//+++-S-cf-------------------------------------------------------------------
 
151
//      NAME:           GetMinX()
 
152
//      DESC:           Get the min x-val calculated from all chartpoints
 
153
//      PARAMETERS:     None
 
154
//      RETURN:         ChartValue
 
155
//----------------------------------------------------------------------E-+++
 
156
inline ChartValue wxChartWindow::GetMinX() const
 
157
{
 
158
        return ( m_Chart.GetMinX() );
 
159
}
 
160
 
 
161
//+++-S-cf-------------------------------------------------------------------
 
162
//      NAME:           GetYMax()
 
163
//      DESC:           Get the max y-val calculated from all chartpoints
 
164
//      PARAMETERS:     None
 
165
//      RETURN:         ChartValue
 
166
//----------------------------------------------------------------------E-+++
 
167
inline ChartValue wxChartWindow::GetMaxY() const
 
168
{
 
169
        return ( m_Chart.GetMaxY() );
 
170
}
 
171
 
 
172
//+++-S-cf-------------------------------------------------------------------
 
173
//      NAME:           GetYMin()
 
174
//      DESC:           Get the min y-val calculated from all chartpoints
 
175
//      PARAMETERS:     None
 
176
//      RETURN:         ChartValue
 
177
//----------------------------------------------------------------------E-+++
 
178
inline ChartValue wxChartWindow::GetMinY() const
 
179
{
 
180
        return ( m_Chart.GetMinY() );
 
181
}
 
182
 
 
183
//+++-S-cf-------------------------------------------------------------------
 
184
//      NAME:           GetNumBarPoints()
 
185
//      DESC:           Number of bar points is used to calculate the width
 
186
//                              of the chart
 
187
//      PARAMETERS:     None
 
188
//      RETURN:         None
 
189
//----------------------------------------------------------------------E-+++
 
190
inline int wxChartWindow::GetNumBarPoints() const
 
191
{
 
192
        return ( m_Chart.GetNumBarPoints() );
 
193
 
 
194
}
 
195
 
 
196
//+++-S-cf-------------------------------------------------------------------
 
197
//      NAME:           GetNumBar3DPoints()
 
198
//      DESC:           Number of bar points is used to calculate the width
 
199
//                              of the chart
 
200
//      PARAMETERS:     None
 
201
//      RETURN:         None
 
202
//----------------------------------------------------------------------E-+++
 
203
inline int wxChartWindow::GetNumBar3DPoints() const
 
204
{
 
205
        return ( m_Chart.GetNumBar3DPoints() );
 
206
}
 
207
 
 
208
//+++-S-cf-------------------------------------------------------------------
 
209
//      NAME:           SetZoom
 
210
//      DESC:           Set zoom
 
211
//      PARAMETERS:     double
 
212
//      RETURN:         None
 
213
//----------------------------------------------------------------------E-+++
 
214
inline void wxChartWindow::SetZoom(
 
215
        double z
 
216
)
 
217
{
 
218
        m_Chart.SetZoom( z );
 
219
}
 
220
 
 
221
//+++-S-cf-------------------------------------------------------------------
 
222
//  NAME:       SetZoom
 
223
//  DESC:       Set zoom
 
224
//  PARAMETERS: double
 
225
//  RETURN:     None
 
226
//----------------------------------------------------------------------E-+++
 
227
inline double wxChartWindow::GetZoom() const
 
228
{
 
229
    return m_Chart.GetZoom();
 
230
}
 
231
 
 
232
//+++-S-cf-------------------------------------------------------------------
 
233
//      NAME:           SetSizes
 
234
//      DESC:           Set sizes for drawing
 
235
//      PARAMETERS:     ChartSizes sizes
 
236
//      RETURN:         None
 
237
//----------------------------------------------------------------------E-+++
 
238
inline void wxChartWindow::SetSizes(
 
239
    wxChartSizes *sizes
 
240
)
 
241
{
 
242
    m_Chart.SetSizes( sizes );
 
243
}
 
244
 
 
245
//+++-S-cf-------------------------------------------------------------------
 
246
//  NAME:       GetSizes
 
247
//  DESC:       Get sizes for drawing
 
248
//  PARAMETERS: None
 
249
//  RETURN:     ChartSizes sizes
 
250
//----------------------------------------------------------------------E-+++
 
251
inline wxChartSizes *wxChartWindow::GetSizes() const
 
252
{
 
253
    return m_Chart.GetSizes();
 
254
}
 
255
 
 
256
//+++-S-cf-------------------------------------------------------------------
 
257
//  NAME:       GetVirtualMaxX
 
258
//  DESC:       Get virtual size for drawing
 
259
//  PARAMETERS: None
 
260
//  RETURN:     ChartValue
 
261
//----------------------------------------------------------------------E-+++
 
262
inline ChartValue wxChartWindow::GetVirtualMaxX() const
 
263
{
 
264
    return GetMaxX();
 
265
}
 
266
 
 
267
//+++-S-cf-------------------------------------------------------------------
 
268
//  NAME:       GetVirtualMinX
 
269
//  DESC:       Get virtual size for drawing
 
270
//  PARAMETERS: None
 
271
//  RETURN:     ChartValue
 
272
//----------------------------------------------------------------------E-+++
 
273
inline ChartValue wxChartWindow::GetVirtualMinX() const
 
274
{
 
275
    return GetMinX();
 
276
}
 
277
 
 
278
//+++-S-cf-------------------------------------------------------------------
 
279
//  NAME:       GetVirtualMaxY
 
280
//  DESC:       Get virtual size for drawing
 
281
//  PARAMETERS: None
 
282
//  RETURN:     ChartValue
 
283
//----------------------------------------------------------------------E-+++
 
284
inline ChartValue wxChartWindow::GetVirtualMaxY() const
 
285
{
 
286
    return GetMaxY();
 
287
}
 
288
 
 
289
//+++-S-cf-------------------------------------------------------------------
 
290
//  NAME:       GetVirtualMinX
 
291
//  DESC:       Get virtual size for drawing
 
292
//  PARAMETERS: None
 
293
//  RETURN:     ChartValue
 
294
//----------------------------------------------------------------------E-+++
 
295
inline ChartValue wxChartWindow::GetVirtualMinY() const
 
296
{
 
297
    return GetMinY();
 
298
}
 
299
 
 
300
#endif // __WXCHARTWINDOW_H__