mgui/toolcirc.h

Go to the documentation of this file.
00001 /**
00002  * \file mgui/toolcirc.h
00003  * \brief MGUI::TOOL_CIRCLE class definition
00004  *
00005  * \if NODOC
00006  * $Id: toolcirc.h_v 1.3 2003/10/03 19:58:19 linux32build!build Exp $
00007  *
00008  * $Log: toolcirc.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:08:10  mju
00016  * Initial revision
00017  *
00018  * \endif
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 //! TOOL_CIRCLE - Circle tool
00032 //!
00033 class TOOL_CIRCLE : public TOOL_BASE {
00034    public:
00035 
00036       //! Constructor.
00037       explicit TOOL_CIRCLE (
00038          TOOLCANVAS *canvas
00039          );
00040 
00041       //! Destructor.
00042       virtual ~TOOL_CIRCLE ();
00043 
00044       //! Get current rotation angle.
00045       double GetAngle (
00046          ) const { return (m_angle); }
00047 
00048       //! Get center position.
00049       const DPOINT2D& GetCenter (
00050          ) const { return (m_center); }
00051 
00052       //! Get radius.
00053       double GetRadius (
00054          ) const { return (m_radius); }
00055 
00056       //! Set rotation angle.
00057       //! The rotation will only be visible to the user if SetAngleVisible() has been used.
00058       void SetAngle (
00059          double angle                        //!< New rotation angle in RADIANS
00060          );
00061 
00062       //! Set whether rotation angle indicator is visible.
00063       //! The rotation angle is indicated by a line from the center to the boundary.
00064       void SetAngleVisible (
00065          bool anglevisible = true
00066          );
00067 
00068       //! Set circle center coordinates.
00069       void SetCenter (
00070          const DPOINT2D& center
00071          );
00072 
00073       //! Set marker type and size.
00074       //! The default marker is MARKER_Plus with a size of 9 pixels.
00075       void SetMarker (
00076          MARKER marker,                      //!< New marker type
00077          UINT16 size = 0                     //!< New marker size, 0 to retain current size
00078          );
00079 
00080       //! Set radius.
00081       void SetRadius (
00082          double radius
00083          );
00084 
00085       //! Set allowed radius range.
00086       void SetRadiusRange (
00087          double minradius,                   //!< Minimum radius in tool units
00088          double maxradius                    //!< Maximum radius, <= 0 for no maximum
00089          );
00090 
00091    private:
00092       #ifndef GENERATING_DOXYGEN_OUTPUT
00093       //! Enumeration constants
00094       enum ZONE {
00095          ZONE_NoFunction = 0,
00096          ZONE_Outside,
00097          ZONE_Inside,
00098          ZONE_Perimeter,
00099          ZONE_SetCenter,
00100          ZONE_Rotate,
00101          };
00102       //! Tool settings
00103       MARKER m_marker;
00104       UINT16 m_markersize;
00105       double m_minradius;                 //!< Minimum radius
00106       double m_maxradius;                 //!< Maximum radius, 0 if no maximum
00107       bool m_anglevisible;             //!< Visibility of rotation angle indicator
00108       //! Tool position values
00109       DPOINT2D m_center;                  //!< Center
00110       double m_radius;
00111       double m_angle;
00112       //! Values used during interaction
00113       ZONE m_CursorZone;                  //!< Current cursor zone
00114       DPOINT2D m_prevpt;                  //!< Previous point during button-down
00115 
00116       //! Methods
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       //! TOOL_BASE overrides.
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 }  // End namespace MGUI
00133 
00134 
00135 #endif   // INC_MGUI_TOOLCIRC_H

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