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

FXRegion.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * C l i p p i n g R e g i o n *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXRegion.h,v 1.20 2006/01/22 17:58:08 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXREGION_H
25 #define FXREGION_H
26 
27 namespace FX {
28 
29 /// Region
30 class FXAPI FXRegion {
31  friend class FXDC;
32  friend class FXDCWindow;
33  friend class FXWindow;
34 private:
35  void *region;
36 public:
37 
38  /// Construct new empty region
39  FXRegion();
40 
41  /// Construct new region copied from region r
42  FXRegion(const FXRegion& r);
43 
44  /// Construct new region from rectangle rect
45  FXRegion(const FXRectangle& rect);
46 
47  /// Construct rectangle region
48  FXRegion(FXint x,FXint y,FXint w,FXint h);
49 
50  /// Construct polygon region
51  FXRegion(const FXPoint* points,FXuint npoints,bool winding=false);
52 
53  /// Assign region r to this one
54  FXRegion &operator=(const FXRegion& r);
55 
56  /// Return true if region is empty
57  bool empty() const;
58 
59  /// Return true if region contains point
60  bool contains(FXint x,FXint y) const;
61 
62  /// Return true if region contains rectangle
63  bool contains(FXint x,FXint y,FXint w,FXint h) const;
64 
65  /// Return bounding box
66  FXRectangle bounds() const;
67 
68  /// Offset region by dx,dy
69  FXRegion& offset(FXint dx,FXint dy);
70 
71  /// Return true if region equal to this one
72  bool operator==(const FXRegion& r) const;
73 
74  /// Return true if region not equal to this one
75  bool operator!=(const FXRegion& r) const;
76 
77  /// Union region r with this one
78  FXRegion& operator+=(const FXRegion& r);
79 
80  /// Intersect region r with this one
81  FXRegion& operator*=(const FXRegion& r);
82 
83  /// Subtract region r from this one
84  FXRegion& operator-=(const FXRegion& r);
85 
86  /// Xor region r with this one
87  FXRegion& operator^=(const FXRegion& r);
88 
89  /// Union of this region and region r
90  FXRegion operator+(const FXRegion& r) const;
91 
92  /// Intersection of this region and region r
93  FXRegion operator*(const FXRegion& r) const;
94 
95  /// Subtract region r from this region
96  FXRegion operator-(const FXRegion& r) const;
97 
98  /// Xor of this region and region r
99  FXRegion operator^(const FXRegion& r) const;
100 
101  /// Reset region to empty
102  void reset();
103 
104  /// Destroy region
105  ~FXRegion();
106  };
107 
108 }
109 
110 #endif
Rectangle.
Definition: FXRectangle.h:37
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:396
#define FXAPI
Definition: fxdefs.h:122
Abstract Device Context.
Definition: FXDC.h:191
int FXint
Definition: fxdefs.h:397
FXDate operator+(const FXDate &d, FXint x)
Definition: FXDate.h:148
Point.
Definition: FXPoint.h:35
FXint operator-(const FXDate &a, const FXDate &b)
Definition: FXDate.h:150
Window Device Context.
Definition: FXDCWindow.h:52
Region.
Definition: FXRegion.h:30
bool operator!=(const FXString &s1, const FXString &s2)
bool operator==(const FXString &s1, const FXString &s2)
FXMat3d operator*(FXdouble x, const FXMat3d &a)

Copyright © 1997-2005 Jeroen van der Zijp