00001
00036 #ifndef INC_MGUI_TOOLREGPOLYGON_H
00037 #define INC_MGUI_TOOLREGPOLYGON_H
00038
00039 #ifndef INC_MGUI_TOOLBASE_H
00040 #include <mgui/toolbase.h>
00041 #endif
00042
00043 namespace MGUI {
00044
00045
00047 class TOOL_REGPOLYGON : public TOOL_BASE {
00048 public:
00049
00051 explicit TOOL_REGPOLYGON (
00052 TOOLCANVAS *canvas
00053 );
00054
00056 virtual ~TOOL_REGPOLYGON ();
00057
00059 double GetAngle (
00060 ) const { return (m_angle); }
00061
00063 const DPOINT2D& GetCenter (
00064 ) const { return (m_center); }
00065
00067 int GetNumSegments (
00068 ) const { return (m_NumSegments); }
00069
00071 double GetRadius (
00072 ) const { return (m_radius); }
00073
00075 void SetAngle (
00076 double newangle
00077 );
00078
00080 void SetAngleVisible (
00081 bool anglevisible = true
00082 );
00083
00085 void SetCenter (
00086 const DPOINT2D& center
00087 );
00088
00091 void SetMarker (
00092 MARKER marker,
00093 UINT16 size = 0
00094 );
00095
00097 void SetNumSegments (
00098 int NumSegments
00099 );
00100
00102 void SetRadius (
00103 double radius
00104 );
00105
00107 void SetRadiusRange (
00108 double minradius,
00109 double maxradius
00110 );
00111
00112 private:
00113 #ifndef GENERATING_DOXYGEN_OUTPUT
00115 enum ZONE {
00116 ZONE_NoFunction = 0,
00117 ZONE_Outside,
00118 ZONE_Inside,
00119 ZONE_Perimeter,
00120 ZONE_SetCenter,
00121 ZONE_Rotate,
00122 };
00124 MARKER m_marker;
00125 UINT16 m_markersize;
00126 double m_minradius;
00127 double m_maxradius;
00128 bool m_anglevisible;
00129
00130 DPOINT2D m_center;
00131 double m_radius;
00132 double m_angle;
00133 int m_NumSegments;
00135 ZONE m_CursorZone;
00136 DPOINT2D m_prevpt;
00137
00139 class MANUAL_REGPOLYGON;
00140
00142 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00143 void ComputeCursorZone (const DPOINT2D&);
00144 void StartTool (const DPOINT2D&);
00145 void UpdateCursor (const DPOINT2D&) const;
00146
00148 virtual MANUAL_BASE* v_CreateManualBase ();
00149 virtual void v_DoDraw ();
00150 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00151 virtual int v_GenerateRegion (REGION2D& region) const;
00152 virtual bool v_OnKey (MGUI::POINT point, KEYCODE keycode, KEYSTATE keystate);
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_TOOLREGPOLYGON_H