00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INC_MGUI_TOOLCIRC_H
00022 #define INC_MGUI_TOOLCIRC_H
00023
00024 #ifndef INC_MGUI_TOOLBASE_H
00025 #include <mgui/toolbase.h>
00026 #endif
00027
00028 namespace MGUI {
00029
00030
00031
00032
00033 class TOOL_CIRCLE : public TOOL_BASE {
00034 public:
00035
00036
00037 explicit TOOL_CIRCLE (
00038 TOOLCANVAS *canvas
00039 );
00040
00041
00042 virtual ~TOOL_CIRCLE ();
00043
00044
00045 double GetAngle (
00046 ) const { return (m_angle); }
00047
00048
00049 const DPOINT2D& GetCenter (
00050 ) const { return (m_center); }
00051
00052
00053 double GetRadius (
00054 ) const { return (m_radius); }
00055
00056
00057
00058 void SetAngle (
00059 double angle
00060 );
00061
00062
00063
00064 void SetAngleVisible (
00065 bool anglevisible = true
00066 );
00067
00068
00069 void SetCenter (
00070 const DPOINT2D& center
00071 );
00072
00073
00074
00075 void SetMarker (
00076 MARKER marker,
00077 UINT16 size = 0
00078 );
00079
00080
00081 void SetRadius (
00082 double radius
00083 );
00084
00085
00086 void SetRadiusRange (
00087 double minradius,
00088 double maxradius
00089 );
00090
00091 private:
00092 #ifndef GENERATING_DOXYGEN_OUTPUT
00093
00094 enum ZONE {
00095 ZONE_NoFunction = 0,
00096 ZONE_Outside,
00097 ZONE_Inside,
00098 ZONE_Perimeter,
00099 ZONE_SetCenter,
00100 ZONE_Rotate,
00101 };
00102
00103 MARKER m_marker;
00104 UINT16 m_markersize;
00105 double m_minradius;
00106 double m_maxradius;
00107 bool m_anglevisible;
00108
00109 DPOINT2D m_center;
00110 double m_radius;
00111 double m_angle;
00112
00113 ZONE m_CursorZone;
00114 DPOINT2D m_prevpt;
00115
00116
00117 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00118 void ComputeCursorZone (const DPOINT2D&);
00119 void StartTool (const DPOINT2D&);
00120 void UpdateCursor (const DPOINT2D&) const;
00121
00122
00123 virtual void v_DoDraw (MGD::CONTEXT*);
00124 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00125 virtual int v_GenerateRegion (REGION2D& region) const;
00126 virtual void v_OnLButtonDown (MGUI::POINT point, KEYSTATE keystate);
00127 virtual void v_OnMouseMove (MGUI::POINT point, KEYSTATE keystate);
00128 #endif // GENERATING_DOXYGEN_OUTPUT
00129 };
00130
00131
00132 }
00133
00134
00135 #endif // INC_MGUI_TOOLCIRC_H