home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / ui / piewedge.h < prev    next >
C/C++ Source or Header  |  1995-04-09  |  4KB  |  129 lines

  1.  
  2.  
  3. #ifndef _piewedge_h_ /* Thu Jan  5 09:34:33 1995 */
  4. #define _piewedge_h_
  5.  
  6.  
  7.  
  8. /*
  9.  *
  10.  *          Copyright (C) 1994, M. A. Sridhar
  11.  *  
  12.  *
  13.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  14.  *     to copy, modify or distribute this software  as you see fit,
  15.  *     and to use  it  for  any  purpose, provided   this copyright
  16.  *     notice and the following   disclaimer are included  with all
  17.  *     copies.
  18.  *
  19.  *                        DISCLAIMER
  20.  *
  21.  *     The author makes no warranties, either expressed or implied,
  22.  *     with respect  to  this  software, its  quality, performance,
  23.  *     merchantability, or fitness for any particular purpose. This
  24.  *     software is distributed  AS IS.  The  user of this  software
  25.  *     assumes all risks  as to its quality  and performance. In no
  26.  *     event shall the author be liable for any direct, indirect or
  27.  *     consequential damages, even if the  author has been  advised
  28.  *     as to the possibility of such damages.
  29.  *
  30.  */
  31.  
  32.  
  33.  
  34. // This is a GraphicObject representing a pie wedge of an ellipse. This is a
  35. // closed figure.
  36.  
  37. #if defined(__GNUC__)
  38. #pragma interface
  39. #endif
  40.  
  41.  
  42. #include "ui/arc.h"
  43.  
  44.  
  45. class CL_EXPORT UI_Arc;
  46. class CL_EXPORT UI_Ellipse;
  47.  
  48. class CL_EXPORT UI_PieWedge: public UI_GraphicObject {
  49.  
  50. public:
  51.     UI_PieWedge (const UI_Rectangle& boundingRect, long startAngleDeg64, long
  52.                  subtendedDeg64);
  53.     // Construct a pie wedge of an ellipse. The PieWedge is part of the
  54.     // ellipse whose
  55.     // bounding rectangle is {\tt boundingRect}. Its starting point is at an
  56.     // angle {$d$} degrees from the 3-o'clock position of {\tt boundingRect}
  57.     // where $d = {\tt startAngleDeg64} * 64$, and it subtends an angle $s$
  58.     // at the center of the ellipse, where $s = {\tt subtendedDeg64} * 64$,
  59.  
  60.     UI_PieWedge (const UI_Point &p1, const UI_Point &p2,
  61.                  const UI_Point& origin);
  62.     // Construct an arc of an ellipse with the points p1, p2 being the
  63.     // start point and the end point and the origin being the center of
  64.     // the ellipse.
  65.     
  66.     bool DrawOn (UI_DrawingSurface& sfc,
  67.                  const UI_Point& p = UI_Point (0,0)) const;
  68.     // Draw the ellipse on the surface {\tt sfc} (overrides inherited
  69.     // method).
  70.  
  71.     bool Fill (UI_DrawingSurface& sfc) const;
  72.     
  73.     bool ReshapeTo (const UI_Point& p1, const UI_Point& p2);
  74.     // Override method inherited from GraphicObject. The implementation
  75.     // reshapes the ellipse so that its bounding rectangle is the rectangle
  76.     // whose diagonally opposite points are p1 and p2.
  77.  
  78.     UI_Rectangle BoundingRectangle() const;
  79.     // Returns the bounding rectangle of the ellipse of which this pie wedge
  80.     // is part.
  81.  
  82.     UI_PointPair EndPoints() const;
  83.  
  84.     UI_HitTest HitTest (const UI_Point& p) const;
  85.     // Hit testing: overrides method inherited from Graphic.
  86.     
  87.     bool IntersectsBoundary (const UI_Rectangle& r) const;
  88.  
  89.     long StartAngle() const;
  90.  
  91.     long SubtendedAngle() const;
  92.  
  93.     UI_Ellipse Ellipse() const;
  94.  
  95.     void StartAngle (long startAngle64);
  96.  
  97.     void SubtendedAngle (long subtAngle64);
  98.  
  99.     void Origin (const UI_Point &origin);
  100.     
  101.     const char* ClassName() const {return "UI_PieWedge";};
  102.  
  103. protected:
  104.  
  105.     UI_Rectangle _boundingEllipse;
  106.     UI_Rectangle _boundingRect;
  107.     long         _startAngle  ;
  108.     long         _subtAngle   ;
  109.     UI_Arc       _arc         ;
  110.  
  111. };
  112.  
  113.  
  114.  
  115.  
  116. inline long UI_PieWedge::StartAngle() const
  117. {
  118.     return _startAngle;
  119. }
  120.  
  121.  
  122. inline long UI_PieWedge::SubtendedAngle() const
  123. {
  124.     return _subtAngle;
  125. }
  126.  
  127.  
  128. #endif /* _piewedge_h_ */
  129.