00001
00042 #ifndef INC_MGUI_TOOLELLIPSE_H
00043 #define INC_MGUI_TOOLELLIPSE_H
00044
00045 #ifndef INC_MGUI_TOOLBASE_H
00046 #include <mgui/toolbase.h>
00047 #endif
00048
00049 namespace MGUI {
00050
00051
00052
00054 class TOOL_ELLIPSE : public TOOL_BASE {
00055 public:
00056
00058 explicit TOOL_ELLIPSE (
00059 TOOLCANVAS *canvas
00060 );
00061
00063 virtual ~TOOL_ELLIPSE ();
00064
00066 double GetAngle (
00067 ) const { return (m_angle); }
00068
00070 const DPOINT2D& GetCenter (
00071 ) const { return (m_center); }
00072
00074 const DPOINT2D& GetRadius (
00075 ) const { return (m_radius); }
00076
00078 void SetAngle (
00079 double angle
00080 );
00081
00084 void SetAngleVisible (
00085 bool anglevisible = true
00086 );
00087
00089 void SetCenter (
00090 const DPOINT2D& center
00091 );
00092
00095 void SetMarker (
00096 MARKER marker,
00097 UINT16 size = 0
00098 );
00099
00101 void SetRadius (
00102 const DPOINT2D& radius
00103 );
00104
00106 void SetRadiusRange (
00107 double minradius,
00108 double maxradius
00109 );
00110
00111 private:
00112 #ifndef GENERATING_DOXYGEN_OUTPUT
00114 enum ZONE {
00115 ZONE_NoFunction = 0,
00116 ZONE_Outside,
00117 ZONE_Inside,
00118 ZONE_ResizeX,
00119 ZONE_ResizeY,
00120 ZONE_Perimeter,
00121 ZONE_SetCenter,
00122 ZONE_Rotate,
00123 };
00125 MARKER m_marker;
00126 UINT16 m_markersize;
00127 double m_minradius;
00128 double m_maxradius;
00129 bool m_anglevisible;
00130
00131 DPOINT2D m_center;
00132 DPOINT2D m_radius;
00133 double m_angle;
00135 ZONE m_CursorZone;
00136 DPOINT2D m_prevpt;
00137 TRANS2D_AFFINE m_trans;
00138
00140 class MANUAL_ELLIPSE;
00141
00143 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00144 void ComputeCursorZone (const DPOINT2D&);
00145 void StartTool (const DPOINT2D&);
00146 void UpdateCursor (const DPOINT2D&) const;
00147
00149 virtual MANUAL_BASE* v_CreateManualBase ();
00150 virtual void v_DoDraw ();
00151 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00152 virtual int v_GenerateRegion (REGION2D& region) const;
00153 virtual bool v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00154 virtual void v_OnPointerMove (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00155 #endif // GENERATING_DOXYGEN_OUTPUT
00156 };
00157
00158
00159
00160 }
00161
00162 #endif // INC_MGUI_TOOLELLIPSE_H