mgui/toolarc.h

Go to the documentation of this file.
00001 /**
00002  * \file mgui/toolarc.h
00003  * \brief MGUI::TOOL_ARC class definition
00004  *
00005  * \if NODOC
00006  * $Id: toolarc.h_v 1.3 2003/10/03 19:58:19 linux32build!build Exp $
00007  *
00008  * $Log: toolarc.h_v $
00009  * Revision 1.3  2003/10/03 19:58:19  linux32build!build
00010  * Doxygen
00011  *
00012  * Revision 1.2  2003/09/15 13:49:32  fileserver!dwilliss
00013  * Doxygen
00014  *
00015  * Revision 1.1  2003/01/10 23:07:41  mju
00016  * Initial revision
00017  *
00018  * \endif
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 //! TOOL_ARC - Circular arc tool
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       //! Constructor.
00043       explicit TOOL_ARC (
00044          TOOLCANVAS *canvas
00045          );
00046 
00047       //! Destructor.
00048       virtual ~TOOL_ARC ();
00049 
00050       //! Get center position.
00051       const DPOINT2D& GetCenter (
00052          ) const { return (m_center); }
00053 
00054       //! Get closure type.
00055       CLOSURE GetClosure (
00056          ) const { return (m_closure); }
00057 
00058       //! Get radius.
00059       double GetRadius (
00060          ) const { return (m_radius); }
00061 
00062       //! Get starting angle.
00063       //! @return Starting angle in radians.
00064       double GetStartAngle (
00065          ) const { return (m_StartAngle); }
00066 
00067       //! Get sweep angle.
00068       //! @return Sweep angle in radians.
00069       double GetSweepAngle (
00070          ) const { return (m_SweepAngle); }
00071 
00072       //! Set center of arc.
00073       void SetCenter (
00074          const DPOINT2D& newcenter
00075          );
00076 
00077       //! Set closure type.
00078       void SetClosure (
00079          CLOSURE closure
00080          );
00081 
00082       //! Set marker type and size.
00083       //! The default marker is MARKER_Plus with a size of 9 pixels.
00084       void SetMarker (
00085          MARKER marker,                      //!< New marker type
00086          UINT16 size = 0                     //!< New marker size, 0 to retain current size
00087          );
00088 
00089       void SetRadius (
00090          double newradius
00091          );
00092 
00093       void SetRadiusRange (
00094          double newminradius,
00095          double newmaxradius
00096          );
00097 
00098       //! Set starting angle.
00099       void SetStartAngle (
00100          double startangle                   //!< Starting angle in radians
00101          );
00102 
00103       //! Set sweep angle
00104       void SetSweepAngle (
00105          double sweepangle                   //!< Sweep angle in radians
00106          );
00107 
00108    private:
00109       #ifndef GENERATING_DOXYGEN_OUTPUT
00110       //! Enumeration constants
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       //! Tool settings
00121       MARKER m_marker;
00122       UINT16 m_markersize;
00123       double m_minradius;                 //!< Minimum radius
00124       double m_maxradius;                 //!< Maximum radius, 0 if no maximum
00125       CLOSURE m_closure;
00126       //! Tool position values
00127       DPOINT2D m_center;                  //!< Center
00128       double m_radius;
00129       double m_StartAngle;
00130       double m_SweepAngle;
00131       //! Values used during interaction
00132       ZONE m_CursorZone;                  //!< Current cursor zone
00133       DPOINT2D m_prevpt;                  //!< Previous point during button-down
00134 
00135       //! Methods
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       //! TOOL_BASE overrides.
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 }  // End namespace MGUI
00154 
00155 
00156 #endif   // INC_MGUI_TOOLARC_H

Generated on Thu Aug 12 06:18:29 2004 for TNTsdk by doxygen 1.3.4-20031026