mgui/toolelip.h

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

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