1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        piecharpoints.h
3 // Purpose:     wxChart
4 // Author:      Paolo Gava
5 // Modified by:
6 // Created:
7 // Copyright:   (C) 2006, Paolo Gava
8 // RCS-ID:      $Id: piechartpoints.h 7947 2012-04-28 10:01:45Z mortenmacfly $
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 
12 #if !defined( __PIECHARTPOINTS_H__ )
13 #define __PIECHARTPOINTS_H__
14 
15 //----------------------------------------------------------------------------
16 // Headers
17 //----------------------------------------------------------------------------
18 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
19 #pragma interface "piechartpoints.h"
20 #endif
21 
22 #include "wx/points.h"
23 #include "wx/chartcolors.h"
24 #include "wx/chartpoints.h"
25 
26 // External Classes
27 //-----------------
28 class wxChartSizes;
29 
30 //+++-S-cd-------------------------------------------------------------------
31 //	NAME:		wxPieChartPoints
32 //	DESC:		Definition of pie chart
33 //	INTERFACE:
34 //
35 //----------------------------------------------------------------------E-+++
36 /* C::B begin */
37 class WXDLLIMPEXP_CHART wxPieChartPoints : public wxChartPoints
38 /* C::B end */
39 {
40 public:
41 
42     // Create object. This class has to be created on the heap
43     // because CChart needs its base pointer to create a list
44     // example:
45     // {
46     //   CPieChartPoints bcp;
47     //   CChart c;
48     //   c.Add( &bcp );
49     // }
50     // If this is allow after the bcp is out of scope the list has
51     // a pointer which has been deallocated!
52     //------------------------------------------------------------
53     static wxPieChartPoints* CreateWxPieChartPoints(wxString name,
54             ChartColor c = wxCHART_NOCOLOR, bool showlabel = false);
55 
~wxPieChartPoints()56 	virtual ~wxPieChartPoints() {};
57 
58 	// Draw the series of points
59 	//--------------------------
60 	void Draw(CHART_HPAINT hp, CHART_HRECT hr);
61 
62 	// Get n-th point information
63 	//---------------------------
64 	ChartValue GetXVal(int n) const;
65 	ChartValue GetYVal(int n) const;
66     wxString GetName(int n) const;
67 	ChartColor GetColor(int n) const;
68 
69 	// Get stat values
70 	//----------------
71 	int GetCount() const;
72 	ChartValue GetMaxX() const;
73 	ChartValue GetMaxY() const;
74 	ChartValue GetMinX() const;
75 	ChartValue GetMinY() const;
76 
77 	// Get/Set zoom
78 	//-------------
79 	void SetZoom(double z);
80 	double GetZoom();
81 
82 	// Set sizes for drawing
83 	//----------------------
84 	void SetSizes(wxChartSizes *sizes);
85 	wxChartSizes* GetSizes() const;
86 
87 	// Get/Set Color
88 	//--------------
89 	ChartColor GetColor() const;
90 	void SetColor(ChartColor c);
91 
92 	// Get/Set Name
93 	//--------------
94 	wxString GetName() const;
95 	void SetName(wxString name);
96 
97 	// Add point
98 	//----------
99 	void Add(wxString name, ChartValue x, ChartValue y);
100 	void Add(wxString name, ChartValue x, ChartValue y,
101 			 ChartColor c);
102 
103 	// Set/Get Display option
104 	//-----------------------
105 	void SetDisplayTag(wxDISPLAY_LABEL d);
106 	wxDISPLAY_LABEL GetDisplayTag() const;
107 
108 private:
109 	wxPoints m_Points;
110 	wxString m_Name;
111 	ChartColor m_Color;
112 	double m_Zoom;
113 	wxDISPLAY_LABEL m_PieTag;
114     bool m_ShowLabel;
115 	wxChartSizes *m_Sizes;
116 
117     // ctor
118     // has to be created on the heap!
119     //-------------------------------
120     wxPieChartPoints(wxString name, ChartColor c, bool showlabel);
121 
122 	// copy ctor & op= NOT allow
123 	//--------------------------
124 	wxPieChartPoints(const wxPieChartPoints&);
125 	wxPieChartPoints& operator=(const wxPieChartPoints&);
126 };
127 
128 
129 #endif // __PIECHARTPOINTS_H__
130