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

  1.  
  2.  
  3.  
  4. #ifndef _region_h_ /* Fri Jan 20 23:22:43 1995 */
  5. #define _region_h_
  6.  
  7.  
  8. // A region is a set of points in two-dimensional space. It is used for
  9. // graphic operations.
  10.  
  11.  
  12. #if defined(__GNUC__)
  13. #pragma interface
  14. #endif
  15.  
  16.  
  17. #if defined(__MS_WINDOWS__)
  18. typedef ulong UI_RegionHandle;
  19. #elif defined(__X_MOTIF__)
  20. #include <Xlib.h>
  21. typedef Region UI_RegionHandle;
  22. #endif
  23.  
  24.  
  25. #include "ui/point.h"
  26.  
  27. class CL_EXPORT UI_Rectangle;
  28.  
  29. class CL_EXPORT UI_Region: public CL_Object {
  30.  
  31. public:
  32.     UI_Region (const UI_Rectangle& r);
  33.     // Create a rectangular region.
  34.  
  35.     UI_Region (UI_Point p[], short nPoints);
  36.     // Create a polygonal region, whose extremities are the given points in
  37.     // order. If the last point is not the same as the first, a line between
  38.     // the first and last point is implicitly assumed.
  39.  
  40.     UI_Region (const UI_Region& r);
  41.     // Copy constructor.
  42.  
  43.  
  44.     bool Includes (const UI_Point& p);
  45.     // Return TRUE if this region includes {\tt p}, FALSE otherwise.
  46.     
  47.     UI_Region operator+ (const UI_Region&);
  48.     // Union of two regions.
  49.  
  50.     void operator+= (const UI_Region& r) {*this = *this + r;}
  51.     
  52.     UI_Region operator* (const UI_Region&);
  53.     // Intersection of two regions.
  54.  
  55.     void operator*= (const UI_Region& r) {*this = *this * r;}
  56.     
  57.     UI_Region operator- (const UI_Region& r);
  58.     // Set difference of two regions: return the region containing those
  59.     // points in this region but not in r.
  60.     
  61.     void operator-= (const UI_Region& r) {*this = *this * r;}
  62.     
  63.     UI_Region operator^ (const UI_Region& r);
  64.     // Exclusive or of two regions: return the region containing those
  65.     // points in this region or in r but not in both.
  66.     
  67.     void operator^= (const UI_Region& r) {*this = *this ^ r;}
  68.     
  69.  
  70.     void operator= (const CL_Object& o);
  71.  
  72.     UI_Region& operator= (const UI_Region& r);
  73.  
  74.  
  75.     UI_RegionHandle Handle () const {return _handle;};
  76.     // [For YACL internal use only]
  77.     
  78. protected:
  79.     UI_RegionHandle _handle;
  80.    
  81.  
  82. };
  83.  
  84.     
  85. #endif /* _region_h_ */
  86.  
  87.