00001
00026 #ifndef INC_MGUI_TOOLCIRCLE_H
00027 #define INC_MGUI_TOOLCIRCLE_H
00028
00029 #ifndef INC_MGUI_TOOLBASE_H
00030 #include <mgui/toolbase.h>
00031 #endif
00032
00033 namespace MGUI {
00034
00035
00036
00038 class TOOL_CIRCLE : public TOOL_BASE {
00039 public:
00040
00042 explicit TOOL_CIRCLE (
00043 TOOLCANVAS *canvas
00044 );
00045
00047 virtual ~TOOL_CIRCLE ();
00048
00050 double GetAngle (
00051 ) const { return (m_angle); }
00052
00054 const DPOINT2D& GetCenter (
00055 ) const { return (m_center); }
00056
00058 double GetRadius (
00059 ) const { return (m_radius); }
00060
00063 void SetAngle (
00064 double angle
00065 );
00066
00069 void SetAngleVisible (
00070 bool anglevisible = true
00071 );
00072
00074 void SetCenter (
00075 const DPOINT2D& center
00076 );
00077
00080 void SetMarker (
00081 MARKER marker,
00082 UINT16 size = 0
00083 );
00084
00086 void SetRadius (
00087 double radius
00088 );
00089
00091 void SetRadiusRange (
00092 double minradius,
00093 double maxradius
00094 );
00095
00096 private:
00097 #ifndef GENERATING_DOXYGEN_OUTPUT
00099 enum ZONE {
00100 ZONE_NoFunction = 0,
00101 ZONE_Outside,
00102 ZONE_Inside,
00103 ZONE_Perimeter,
00104 ZONE_SetCenter,
00105 ZONE_Rotate,
00106 };
00108 MARKER m_marker;
00109 UINT16 m_markersize;
00110 double m_minradius;
00111 double m_maxradius;
00112 bool m_anglevisible;
00113
00114 DPOINT2D m_center;
00115 double m_radius;
00116 double m_angle;
00118 ZONE m_CursorZone;
00119 DPOINT2D m_prevpt;
00120
00122 class MANUAL_CIRCLE;
00123 friend class MANUAL_CIRCLE;
00124
00126 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00127 void ComputeCursorZone (const DPOINT2D&);
00128 void StartTool (const DPOINT2D&);
00129 void UpdateCursor (const DPOINT2D&) const;
00130
00132 virtual MANUAL_BASE* v_CreateManualBase ();
00133 virtual void v_DoDraw ();
00134 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00135 virtual int v_GenerateRegion (REGION2D& region) const;
00136 virtual bool v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00137 virtual void v_OnPointerMove (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate);
00138 #endif // GENERATING_DOXYGEN_OUTPUT
00139 };
00140
00141
00142
00143 }
00144
00145 #endif // INC_MGUI_TOOLCIRCLE_H