Debian Codegraph @

src/simple_pie_plot.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by Guy Rutenberg *
3 * [email protected] *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21 #include "simple_pie_plot.h"cxx . . $ `<file>/src/simple_pie_plot.h`/
22 #include <memory>
23 #include <algorithm>
24 #include <cmath>
25 #include <wx/graphics.h>
26 using namespace std;
27 using namespace simple_pie_plot;
28
29 const double PIcxx . . $ PI. = 4.0 * atancxx . . $ atan(447c67c6676f75c3).(1.0);
30
31 const double SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::m_legend_left_paddingcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_left_padding. = 10;
32
33 /**
34 * Draws a pie slice with origin in (\a x,\a y), radius (\a r) from
35 * from \a start_angle to \a end_angle, where angles are in radians measured
36 * from the x-axis. The figure is drawn using \a dc.
37 */
38 void DrawPieSlicecxx . . $ DrawPieSlice(3c06b4304b12e8b4).(double x, double y, double r, double start_angle,
39 double end_angle, wxGraphicsContextcxx . . $ wxGraphicsContext# *dc)
40 {
41 wxGraphicsPathcxx . . $ wxGraphicsPath# path = dc->CreatePathcxx . . $ wxGraphicsContext#CreatePath(774b5aa10c777615).();
42 path.MoveToPointcxx . . $ wxGraphicsPath#MoveToPoint(bc12c9ec15586e6a).(x,y);
43 path.AddArccxx . . $ wxGraphicsPath#AddArc(2880d0c1ef0bc44e).(x, y, r, start_angle, end_angle, true);
44 dc->DrawPathcxx . . $ wxGraphicsContext#DrawPath(2325b75064482a50).(path);
45 }
46
47 SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#SimplePiePlot(bcdeeae89954f8a3).(wxWindowcxx . . $ wxWindow#* parent, wxWindowIDcxx . . $ wxWindowID# id,
48 const wxPointcxx . . $ wxPoint#& pos, const wxSizecxx . . $ wxSize#& size,
49 long style, const wxStringcxx . . $ wxString#& name)
50 : wxPanelcxx . . $ wxPanel#(parent, id, pos, size, style, name)
51 {
52 m_highlightcxx . . $ simple_pie_plot/SimplePiePlot#m_highlight. = -1;
53
54 m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. = 0;
55 m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height. = 0;
56 m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width. = 0;
57
58 Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(this->GetIdcxx . . $ wxWindowBase#GetId(455f465bc33b4cdf).(), wxEVT_PAINTcxx . . $ wxEVT_PAINT., wxPaintEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4280:9`!(SimplePiePlot::OnPaint));
59 Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(this->GetIdcxx . . $ wxWindowBase#GetId(455f465bc33b4cdf).(), wxEVT_SIZEcxx . . $ wxEVT_SIZE., wxSizeEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4276:9`!(SimplePiePlot::OnResize));
60
61 Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(this->GetIdcxx . . $ wxWindowBase#GetId(455f465bc33b4cdf).(), wxEVT_MOTIONcxx . . $ wxEVT_MOTION., wxMouseEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4286:9`!(SimplePiePlot::OnMouseMove));
62 Connectcxx . . $ wxEvtHandler#Connect(bb4f3294b37e5589).(this->GetIdcxx . . $ wxWindowBase#GetId(455f465bc33b4cdf).(), wxEVT_LEAVE_WINDOWcxx . . $ wxEVT_LEAVE_WINDOW., wxMouseEventHandlercxx . . $ `<external>/9123237030240659982/event.h:4286:9`!(SimplePiePlot::OnMouseLeaveWindow));
63 }
64
65 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::OnPaintcxx . . $ simple_pie_plot/SimplePiePlot#OnPaint(954efb20b042ed11).(wxPaintEventcxx . . $ wxPaintEvent#& event)
66 {
67 wxPaintDCcxx . . $ wxPaintDC# pdccxx . . $ wxPaintDC#wxPaintDC(4289b2e0b1e17a99).(this);
68 auto_ptrcxx . . $ std/auto_ptr#<wxGraphicsContextcxx . . $ wxGraphicsContext#> dccxx . . $ std/auto_ptr#auto_ptr(ebd0a1552f8ce24f).(wxGraphicsContextcxx . . $ wxGraphicsContext#::Createcxx . . $ wxGraphicsContext#Create(4bb1da43ec33592e).(pdc));
69 wxBrushcxx . . $ wxBrush# color_brushcxx . . $ wxBrush#wxBrush(49f6e7a06ebc5aa8).;
70
71 if (m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() == 0) {
72 return;
73 }
74
75 if (!m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. || !m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height.) {
76 CalculateLegendDimensionscxx . . $ simple_pie_plot/SimplePiePlot#CalculateLegendDimensions(728e75216fb6696d).(dc.getcxx . . $ std/auto_ptr#get(5a2a78a048fb49a8).());
77 // This might have caused a new minimum size to occure, tell
78 // parent about it by refitting. See also comment in
79 // GetMinSize()
80 if (this->GetParentcxx . . $ wxWindowBase#GetParent(6f9227b2c068e0af).() && this->GetParentcxx . . $ wxWindowBase#GetParent(6f9227b2c068e0af).()->GetSizercxx . . $ wxWindowBase#GetSizer(dbebe6247d42815d).())
81 this->GetParentcxx . . $ wxWindowBase#GetParent(6f9227b2c068e0af).()->GetSizercxx . . $ wxWindowBase#GetSizer(dbebe6247d42815d).()->SetSizeHintscxx . . $ wxSizer#SetSizeHints(4289b2e0b1e17a99).(this->GetParentcxx . . $ wxWindowBase#GetParent(6f9227b2c068e0af).());
82 }
83 CalculatePiePlotLocationcxx . . $ simple_pie_plot/SimplePiePlot#CalculatePiePlotLocation(49f6e7a06ebc5aa8).();
84
85
86 dc->cxx . . $ std/auto_ptr#`operator->`(5a2a78a048fb49a8).SetPencxx . . $ wxGraphicsContext#SetPen(14801b85a4885f61).(*wxTRANSPARENT_PENcxx . . $ `<external>/15936994373797470861/gdicmn.h:1043:9`!);
87 for (int i = 1; i<m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) {
88 // create brush
89 color_brush.SetColourcxx . . $ wxBrush#SetColour(c6fe1e6e9a9d4367).(GetSegmentColorcxx . . $ simple_pie_plot/SimplePiePlot#GetSegmentColor(2186c6a3b1551d0a).(i-1));
90 dc->cxx . . $ std/auto_ptr#`operator->`(5a2a78a048fb49a8).SetBrushcxx . . $ wxGraphicsContext#SetBrush(7703d09f4870cffa).(color_brush);
91
92 DrawPieSlicecxx . . $ DrawPieSlice(3c06b4304b12e8b4).(m_pie_xcxx . . $ simple_pie_plot/SimplePiePlot#m_pie_x., m_pie_ycxx . . $ simple_pie_plot/SimplePiePlot#m_pie_y., m_radiuscxx . . $ simple_pie_plot/SimplePiePlot#m_radius., m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i-1],
93 m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i], dc.getcxx . . $ std/auto_ptr#get(5a2a78a048fb49a8).());
94 }
95
96 DrawLegendcxx . . $ simple_pie_plot/SimplePiePlot#DrawLegend(728e75216fb6696d).(dc.getcxx . . $ std/auto_ptr#get(5a2a78a048fb49a8).());
97 }
98
99 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::CalculatePiePlotLocationcxx . . $ simple_pie_plot/SimplePiePlot#CalculatePiePlotLocation(49f6e7a06ebc5aa8).()
100 {
101 double pie_width;
102 int width, height;
103
104 assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(m_legend_width);
105
106 GetClientSizecxx . . $ wxWindowBase#GetClientSize(17144c1a7896dbb).(&width, &height);
107 // m_max_legend_height* for the color box and it's right padding
108 pie_width = width - m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width. - m_legend_left_paddingcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_left_padding.;
109 m_pie_xcxx . . $ simple_pie_plot/SimplePiePlot#m_pie_x. = pie_width/2.0;
110 m_pie_ycxx . . $ simple_pie_plot/SimplePiePlot#m_pie_y. = height/2.0;
111 m_radiuscxx . . $ simple_pie_plot/SimplePiePlot#m_radius. = mincxx . . $ std/min(2a338fce5842aa6a).(pie_width,(double)height)/2.0;
112 }
113
114 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::OnResizecxx . . $ simple_pie_plot/SimplePiePlot#OnResize(2b95f7f26403c12f).(wxSizeEventcxx . . $ wxSizeEvent#& event)
115 {
116 Refreshcxx . . $ wxWindow#Refresh(e1a781ccdc106755).();
117 event.Skipcxx . . $ wxEvent#Skip(b45ddcbc8423892c).();
118 }
119
120 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::SetDatacxx . . $ simple_pie_plot/SimplePiePlot#SetData(9cc36d28fd3db431).(vectorcxx . . $ std/vector#<double> d, vectorcxx . . $ std/vector#<wxStringcxx . . $ wxString#> labels)
121 {
122 // number of values should match number of labels
123 assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(labels.size() == d.size());
124
125 m_datacxx . . $ simple_pie_plot/SimplePiePlot#m_data..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).();
126 m_data_totalcxx . . $ simple_pie_plot/SimplePiePlot#m_data_total. = 0;
127 for (double &tmp : d) {
128 // we can't plot negative values
129 assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(tmp >= 0);
130 m_data_totalcxx . . $ simple_pie_plot/SimplePiePlot#m_data_total. += tmp;
131 m_datacxx . . $ simple_pie_plot/SimplePiePlot#m_data..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(tmp);
132 }
133 m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels..assigncxx . . $ std/vector#assign(50ef72ff69bc573d).(labels.begincxx . . $ std/vector#begin(33b10a496a38335b).(), labels.endcxx . . $ std/vector#end(33b10a496a38335b).());
134 CalculateAnglescxx . . $ simple_pie_plot/SimplePiePlot#CalculateAngles(49f6e7a06ebc5aa8).();
135
136 // this will cause the legend size to be re-calculated
137 m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. = 0;
138 m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height. = 0;
139 }
140
141 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::CalculateAnglescxx . . $ simple_pie_plot/SimplePiePlot#CalculateAngles(49f6e7a06ebc5aa8).()
142 {
143 double new_angle = 0;
144
145 m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).();
146 m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(new_angle);
147 for (double &tmp : m_datacxx . . $ simple_pie_plot/SimplePiePlot#m_data.) {
148 new_angle = new_angle + 2 * PIcxx . . $ PI. * (tmp/m_data_totalcxx . . $ simple_pie_plot/SimplePiePlot#m_data_total.);
149 m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(new_angle);
150 }
151 }
152
153 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::CalculateLegendDimensionscxx . . $ simple_pie_plot/SimplePiePlot#CalculateLegendDimensions(728e75216fb6696d).(wxGraphicsContextcxx . . $ wxGraphicsContext# *dc)
154 {
155 double tmp_height;
156 double tmp_width;
157 m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. = 0;
158 m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height. = 0;
159
160 dc->SetFontcxx . . $ wxGraphicsContext#SetFont(4e4a58151f8699f5).(*wxNORMAL_FONTcxx . . $ `<external>/15936994373797470861/gdicmn.h:1029:9`!, *wxBLACKcxx . . $ `<external>/15936994373797470861/gdicmn.h:1058:9`!);
161
162 for (wxStringcxx . . $ wxString# &label : m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels.) {
163 dc->GetTextExtentcxx . . $ wxGraphicsContext#GetTextExtent(52a4bf1c7c360be3).(label, &tmp_width, &tmp_height, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
164 m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. = maxcxx . . $ std/max(2a338fce5842aa6a).(m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width., tmp_width);
165 m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height. = maxcxx . . $ std/max(2a338fce5842aa6a).(m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height., tmp_height);
166 }
167
168 m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width. = m_max_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_width. + 2*m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height.;
169 m_legend_line_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_line_height. = 1.5 * m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height.;
170 }
171
172 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::DrawLegendcxx . . $ simple_pie_plot/SimplePiePlot#DrawLegend(728e75216fb6696d).(wxGraphicsContextcxx . . $ wxGraphicsContext# *dc)
173 {
174 wxBrushcxx . . $ wxBrush# color_brushcxx . . $ wxBrush#wxBrush(49f6e7a06ebc5aa8).;
175 int width, height;
176 GetClientSizecxx . . $ wxWindowBase#GetClientSize(17144c1a7896dbb).(&width, &height);
177
178 assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(m_legend_width);
179 double legend_x = width - m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width.;
180
181 dc->SetPencxx . . $ wxGraphicsContext#SetPen(14801b85a4885f61).(*wxTRANSPARENT_PENcxx . . $ `<external>/15936994373797470861/gdicmn.h:1043:9`!);
182 dc->SetFontcxx . . $ wxGraphicsContext#SetFont(4e4a58151f8699f5).(*wxNORMAL_FONTcxx . . $ `<external>/15936994373797470861/gdicmn.h:1029:9`!, *wxBLACKcxx . . $ `<external>/15936994373797470861/gdicmn.h:1058:9`!);
183
184 for (int i = 0; i<m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) {
185 color_brush.SetColourcxx . . $ wxBrush#SetColour(c6fe1e6e9a9d4367).(GetSegmentColorcxx . . $ simple_pie_plot/SimplePiePlot#GetSegmentColor(2186c6a3b1551d0a).(i));
186 dc->SetBrushcxx . . $ wxGraphicsContext#SetBrush(7703d09f4870cffa).(color_brush);
187
188 dc->DrawRectanglecxx . . $ wxGraphicsContext#DrawRectangle(52a61fa14d44b641).(legend_x, i * m_legend_line_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_line_height.,
189 m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height., m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height.);
190 dc->DrawTextcxx . . $ wxGraphicsContext#DrawText(8daee90989b21874).(m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i], legend_x + 2*m_max_legend_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_max_legend_height.,
191 i * m_legend_line_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_line_height.);
192 }
193
194 }
195
196 wxColourcxx . . $ wxColour# SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::GetSegmentColorcxx . . $ simple_pie_plot/SimplePiePlot#GetSegmentColor(2186c6a3b1551d0a).(int i)
197 {
198 double hue_step = 1.0/(m_datacxx . . $ simple_pie_plot/SimplePiePlot#m_data..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).());
199 double hue = i * hue_step;
200 double value = m_highlightcxx . . $ simple_pie_plot/SimplePiePlot#m_highlight. == i ? 1.0 : 0.9;
201 wxColourcxx . . $ wxColour# colorcxx . . $ wxColour#wxColour(49f6e7a06ebc5aa8).;
202 wxImagecxx . . $ wxImage#::RGBValuecxx . . $ wxImage#RGBValue# rgbcxx . . $ wxImage#RGBValue#RGBValue(684ed43ade99b32e).;
203 wxImagecxx . . $ wxImage#::HSVValuecxx . . $ wxImage#HSVValue# hsvcxx . . $ wxImage#HSVValue#HSVValue(98dd472ac7e5c3d4).(hue, 1, value);
204 rgb =cxx . . $ wxImage#RGBValue#`operator=`(e2e7e235262e2a6e). wxImagecxx . . $ wxImage#::HSVtoRGBcxx . . $ wxImage#HSVtoRGB(7c3a524664b61733).(hsv);
205 color.Setcxx . . $ wxColourBase#Set(bfb537490240b335).(rgb.redcxx . . $ wxImage#RGBValue#red., rgb.greencxx . . $ wxImage#RGBValue#green., rgb.bluecxx . . $ wxImage#RGBValue#blue.);
206
207 return colorcxx . . $ wxColour#wxColour(c6fe1e6e9a9d4367).;
208 }
209
210 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::OnMouseMovecxx . . $ simple_pie_plot/SimplePiePlot#OnMouseMove(7e6a1c70b0e99497).(wxMouseEventcxx . . $ wxMouseEvent#& event)
211 {
212 //check if the move is even in the plot
213 int width, height;
214 GetClientSizecxx . . $ wxWindowBase#GetClientSize(17144c1a7896dbb).(&width, &height);
215
216 const double dist_mouse = (m_pie_xcxx . . $ simple_pie_plot/SimplePiePlot#m_pie_x.-event.m_xcxx . . $ wxMouseState#m_x.)*(m_pie_xcxx . . $ simple_pie_plot/SimplePiePlot#m_pie_x.-event.m_xcxx . . $ wxMouseState#m_x.) +
217 (m_pie_ycxx . . $ simple_pie_plot/SimplePiePlot#m_pie_y.-event.m_ycxx . . $ wxMouseState#m_y.)*(m_pie_ycxx . . $ simple_pie_plot/SimplePiePlot#m_pie_y.-event.m_ycxx . . $ wxMouseState#m_y.);
218 if (dist_mouse <= (m_radiuscxx . . $ simple_pie_plot/SimplePiePlot#m_radius.*m_radiuscxx . . $ simple_pie_plot/SimplePiePlot#m_radius.)) {
219 //angles are clockwise from the x-axis
220 double angle = acoscxx . . $ acos(447c67c6676f75c3).((event.m_xcxx . . $ wxMouseState#m_x.-m_pie_xcxx . . $ simple_pie_plot/SimplePiePlot#m_pie_x.)/sqrtcxx . . $ sqrt(447c67c6676f75c3).(dist_mouse));
221 if (event.m_ycxx . . $ wxMouseState#m_y. < m_pie_ycxx . . $ simple_pie_plot/SimplePiePlot#m_pie_y.)
222 angle = 2*PIcxx . . $ PI. - angle;
223 int i;
224 for (i = 1; i<m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) {
225 if (angle<=m_anglescxx . . $ simple_pie_plot/SimplePiePlot#m_angles.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i])
226 break;
227 }
228 Highlightcxx . . $ simple_pie_plot/SimplePiePlot#Highlight(d4f767463ce0a6b3).(i-1);
229 return;
230 } else if (event.m_xcxx . . $ wxMouseState#m_x. >= width-m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width.){
231 int i = (int) (event.m_ycxx . . $ wxMouseState#m_y. / m_legend_line_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_line_height.);
232 if (i<m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).()){
233 Highlightcxx . . $ simple_pie_plot/SimplePiePlot#Highlight(d4f767463ce0a6b3).(i);
234 return;
235 }
236 }
237
238 ClearHighlightcxx . . $ simple_pie_plot/SimplePiePlot#ClearHighlight(49f6e7a06ebc5aa8).();
239 }
240
241 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::OnMouseLeaveWindowcxx . . $ simple_pie_plot/SimplePiePlot#OnMouseLeaveWindow(7e6a1c70b0e99497).(wxMouseEventcxx . . $ wxMouseEvent#& event)
242 {
243 ClearHighlightcxx . . $ simple_pie_plot/SimplePiePlot#ClearHighlight(49f6e7a06ebc5aa8).();
244 }
245
246 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::Highlightcxx . . $ simple_pie_plot/SimplePiePlot#Highlight(d4f767463ce0a6b3).(int i)
247 {
248 m_highlightcxx . . $ simple_pie_plot/SimplePiePlot#m_highlight. = i;
249 Refreshcxx . . $ wxWindow#Refresh(e1a781ccdc106755).();
250 }
251
252 void SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::ClearHighlightcxx . . $ simple_pie_plot/SimplePiePlot#ClearHighlight(49f6e7a06ebc5aa8).()
253 {
254 if (m_highlightcxx . . $ simple_pie_plot/SimplePiePlot#m_highlight. != -1) {
255 m_highlightcxx . . $ simple_pie_plot/SimplePiePlot#m_highlight. = -1;
256 Refreshcxx . . $ wxWindow#Refresh(e1a781ccdc106755).();
257 }
258 }
259
260 wxSizecxx . . $ wxSize# SimplePiePlotcxx . . $ simple_pie_plot/SimplePiePlot#::GetMinSizecxx . . $ simple_pie_plot/SimplePiePlot#GetMinSize(1760195b8cec6c4e).() const
261 {
262 // In the first call to GetMinSize, m_legend_line_height and
263 // m_legend_width may not be populated yet (set to zero), this
264 // is a result of not being able to call CalculateLegendDimensions()
265 // at this point due to constness. In order to workaround this issue,
266 // if CalculateLegendDimensions() gets called in OnPaint() (this
267 // happens also after setting new data), OnPaint() also notifies the
268 // parent's sizer (is such exist) to update the size hints
269 // accordingly.
270 const double total_legend_height = m_labelscxx . . $ simple_pie_plot/SimplePiePlot#m_labels..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() * m_legend_line_heightcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_line_height.;
271 const double total_width = total_legend_height + m_legend_widthcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_width. +
272 m_legend_left_paddingcxx . . $ simple_pie_plot/SimplePiePlot#m_legend_left_padding.;
273 return wxSizecxx . . $ wxSize#wxSize(3e454b8ccf442868).((int)ceilcxx . . $ ceil(447c67c6676f75c3).(total_width),(int)ceilcxx . . $ ceil(447c67c6676f75c3).(total_legend_height));
274 }
275