import "ecere" class Form1 : Window { caption = "Form1"; background = formColor; borderStyle = sizable; hasMaximize = true; hasMinimize = true; hasClose = true; clientSize = { 632, 438 }; //Lets add few circles Circle c1 {borderSize = 1;borderType = outsideBevel; cX = 270; cY = 65; radius = 38; }; Circle c2 {borderSize = 1;borderType = outsideBevel; cX = 102; cY = 83; radius = 150; }; Circle c3 {borderSize = 1;borderType = outsideBevel; cX = 321; cY = 130; radius = 50; }; //Lets do something more with it.. bool c1Inside, c2Inside, c3Inside; c1Inside = false; c2Inside = false; c3Inside = false; // The Clip() functions that work for the box are not done // The filled angles will be available at some other time, but the idea was to have the // posibility of pie chart if it was needed, but it should be based on angles and I have // some other idea in mind for that so will see what will happen - it might end up transfered to // some other class instead... void OnRedraw(Surface surface) { ColorAlpha colors[2]; ColorAlpha colors2[2]; ColorAlpha colorsO[2]; ColorAlpha colors2O[2]; //Normal colors colors[0] = black; colors[1] = red; colors2[0] = blue; colors2[1] = green; //Over colorsO[0] = white; colorsO[1] = yellow; colors2O[0] = red; colors2O[1] = brown; //Lets draw these circles if(c1Inside) { surface.DrawCircleF(c1.cX,c1.cY,c1.radius,fullCircle,colorsO,c1.borderSize,c1.borderType); } else { surface.DrawCircle(c1); //A quick way to draw them, which does not give you a lot of // room to do anything with it } //surface.DrawCircleF(x0,y0,radius,curcleType,color[2],borderSize,borderStyle); if(c2Inside) { surface.DrawCircleF(c2.cX,c2.cY,c2.radius,fullCircle,colors2O,c2.borderSize,c2.borderType); } else { surface.DrawCircleF(c2.cX,c2.cY,c2.radius,fullCircle,colors,c2.borderSize,c2.borderType); } if(c3Inside) { surface.DrawCircle(c3); } else { surface.DrawCircleF(c3.cX,c3.cY,c3.radius,fullCircle,colors2,c3.borderSize,c3.borderType); } } //Lets see what we can do with this... bool OnMouseMove(int x, int y, Modifiers mods) { c1Inside = false; c2Inside = false; c3Inside = false; if(c1.isPointInside({x,y},true)) { c1Inside = true; } if(c2.isPointInside({x,y},true)) { c2Inside = true; } if(c3.isPointInside({x,y},true)) { c3Inside = true; } Update(null); return true; } bool OnLeftButtonDown(int x, int y, Modifiers mods) { bool tc1, tc2, tc3; String msg; msg = "The click happend outside of any circle"; //default value tc1 = c1.isPointInside({x,y},true); // Sometimes you want the border to be considered as the // part of the circle, then you say true, but if you do not want // to have border included in the calculations then just put // false and it will not be counted tc2 = c2.isPointInside({x,y},false); tc3 = c3.isPointInside({x,y},true); if(tc1) { msg = "the 'c1' circle was hit"; } else if(tc2) { msg = "the 'c2' circle was hit"; } else if(tc3) { msg = "the 'c3' circle was hit"; } MessageBox {this, text = "results", contents = msg}.Modal(); return true; } bool OnRightButtonDown(int x, int y, Modifiers mods) { //Lets see if the circles are overlapping each other... if(c1.Overlap(c2)) { MessageBox {this, text = "results", contents = "c1 and c2 overlap"}.Modal(); } if(c1.Overlap(c3)) { MessageBox {this, text = "results", contents = "c1 and c3 overlap"}.Modal(); } if(c2.Overlap(c3)) { MessageBox {this, text = "results", contents = "c2 and c3 overlap"}.Modal(); } return true; } } Form1 form1 {};