00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INC_MGUI_TOOLARC_H
00022 #define INC_MGUI_TOOLARC_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_ARC : public TOOL_BASE {
00034 public:
00035
00036 enum CLOSURE {
00037 CLOSURE_None,
00038 CLOSURE_Chord,
00039 CLOSURE_Wedge
00040 };
00041
00042
00043 explicit TOOL_ARC (
00044 TOOLCANVAS *canvas
00045 );
00046
00047
00048 virtual ~TOOL_ARC ();
00049
00050
00051 const DPOINT2D& GetCenter (
00052 ) const { return (m_center); }
00053
00054
00055 CLOSURE GetClosure (
00056 ) const { return (m_closure); }
00057
00058
00059 double GetRadius (
00060 ) const { return (m_radius); }
00061
00062
00063
00064 double GetStartAngle (
00065 ) const { return (m_StartAngle); }
00066
00067
00068
00069 double GetSweepAngle (
00070 ) const { return (m_SweepAngle); }
00071
00072
00073 void SetCenter (
00074 const DPOINT2D& newcenter
00075 );
00076
00077
00078 void SetClosure (
00079 CLOSURE closure
00080 );
00081
00082
00083
00084 void SetMarker (
00085 MARKER marker,
00086 UINT16 size = 0
00087 );
00088
00089 void SetRadius (
00090 double newradius
00091 );
00092
00093 void SetRadiusRange (
00094 double newminradius,
00095 double newmaxradius
00096 );
00097
00098
00099 void SetStartAngle (
00100 double startangle
00101 );
00102
00103
00104 void SetSweepAngle (
00105 double sweepangle
00106 );
00107
00108 private:
00109 #ifndef GENERATING_DOXYGEN_OUTPUT
00110
00111 enum ZONE {
00112 ZONE_NoFunction = 0,
00113 ZONE_Outside,
00114 ZONE_Inside,
00115 ZONE_Perimeter,
00116 ZONE_SetCenter,
00117 ZONE_Start,
00118 ZONE_End
00119 };
00120
00121 MARKER m_marker;
00122 UINT16 m_markersize;
00123 double m_minradius;
00124 double m_maxradius;
00125 CLOSURE m_closure;
00126
00127 DPOINT2D m_center;
00128 double m_radius;
00129 double m_StartAngle;
00130 double m_SweepAngle;
00131
00132 ZONE m_CursorZone;
00133 DPOINT2D m_prevpt;
00134
00135
00136 void AdjustTool (const DPOINT2D&, bool firsttime=false);
00137 void ComputeCursorZone (const DPOINT2D&);
00138 void StartTool (const DPOINT2D&);
00139 void UpdateCursor (const DPOINT2D&) const;
00140
00141
00142 virtual void v_DoDraw (MGD::CONTEXT*);
00143 virtual void v_DoMove (double dx, double dy, ADJUSTFLAGS flags);
00144 virtual int v_GenerateRegion (REGION2D& region) const;
00145 virtual void v_OnLButtonDown (MGUI::POINT point, KEYSTATE keystate);
00146 virtual void v_OnMouseMove (MGUI::POINT point, KEYSTATE keystate);
00147 #endif // GENERATING_DOXYGEN_OUTPUT
00148 };
00149
00150
00151
00152
00153 }
00154
00155
00156 #endif // INC_MGUI_TOOLARC_H