Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRegion.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                      C l i p p i n g   R e g i o n                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,2002 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXRegion.h,v 1.6 2002/01/18 22:42:54 jeroen Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXREGION_H
00025 #define FXREGION_H
00026 
00027 
00028 /// Region
00029 class FXAPI FXRegion {
00030   friend class FXDC;
00031   friend class FXDCWindow;
00032 private:
00033   void *region;
00034 public:
00035 
00036   /// Construct new empty region
00037   FXRegion();
00038 
00039   /// Construct new region copied from region r
00040   FXRegion(const FXRegion& r);
00041 
00042   /// Construct new region set to given rectangle
00043   FXRegion(FXint x,FXint y,FXint w,FXint h);
00044 
00045   /// Assign region r to this one
00046   FXRegion &operator=(const FXRegion& r);
00047 
00048   /// Return TRUE if region is empty
00049   FXbool empty() const;
00050 
00051   /// Return TRUE if region contains point
00052   FXbool contains(FXint x,FXint y) const;
00053 
00054   /// Return TRUE if region contains rectangle
00055   FXbool contains(FXint x,FXint y,FXint w,FXint h) const;
00056 
00057   /// Return bounding box
00058   void bounds(FXRectangle& r) const;
00059 
00060   /// Offset region by dx,dy
00061   FXRegion& offset(FXint dx,FXint dy);
00062 
00063   /// Union region r with this one
00064   FXRegion& operator+=(const FXRegion& r);
00065 
00066   /// Intersect region r with this one
00067   FXRegion& operator*=(const FXRegion& r);
00068 
00069   /// Substract region r from this one
00070   FXRegion& operator-=(const FXRegion& r);
00071 
00072   /// Xor region r with this one
00073   FXRegion& operator^=(const FXRegion& r);
00074 
00075   /// Union of region r1 and region r2
00076   friend FXAPI FXRegion operator+(const FXRegion& r1,const FXRegion& r2);
00077 
00078   /// Intersection of region r1 and region r2
00079   friend FXAPI FXRegion operator*(const FXRegion& r1,const FXRegion& r2);
00080 
00081   /// Substract region r2 from region r1
00082   friend FXAPI FXRegion operator-(const FXRegion& r1,const FXRegion& r2);
00083 
00084   /// Xor of region r1 and region r2
00085   friend FXAPI FXRegion operator^(const FXRegion& r1,const FXRegion& r2);
00086 
00087   /// Return TRUE if region equal to this one
00088   friend FXAPI FXbool operator==(const FXRegion& r1,const FXRegion& r2);
00089 
00090   /// Return TRUE if region not equal to this one
00091   friend FXAPI FXbool operator!=(const FXRegion& r1,const FXRegion& r2);
00092 
00093   /// Destroy region
00094  ~FXRegion();
00095   };
00096 
00097 
00098 #endif