1 /******************************************************************************* 2 / 3 / File: Region.h 4 / 5 / Description: BRegion represents an area that's composed of individual 6 / rectangles. 7 / 8 / Copyright 1992-98, Be Incorporated, All Rights Reserved 9 / 10 *******************************************************************************/ 11 12 #ifndef _REGION_H 13 #define _REGION_H 14 15 #include <BeBuild.h> 16 #include <Rect.h> 17 18 namespace BPrivate { 19 class ServerLink; 20 class LinkReceiver; 21 }; 22 23 /* Integer rect used to define a clipping rectangle. All bounds are inclusive. */ 24 /* Moved from DirectWindow.h */ 25 typedef struct { 26 int32 left; 27 int32 top; 28 int32 right; 29 int32 bottom; 30 } clipping_rect; 31 32 33 /*----- BRegion class --------------------------------------------*/ 34 35 class BRegion { 36 public: 37 BRegion(); 38 BRegion(const BRegion ®ion); 39 BRegion(const BRect rect); 40 virtual ~BRegion(); 41 42 BRegion &operator=(const BRegion &from); 43 44 BRect Frame() const; 45 clipping_rect FrameInt() const; 46 BRect RectAt(int32 index); 47 clipping_rect RectAtInt(int32 index); 48 int32 CountRects(); 49 void Set(BRect newBounds); 50 void Set(clipping_rect newBounds); 51 bool Intersects(BRect r) const; 52 bool Intersects(clipping_rect r) const; 53 bool Contains(BPoint pt) const; 54 bool Contains(int32 x, int32 y); 55 void PrintToStream() const; 56 void OffsetBy(int32 dh, int32 dv); 57 void MakeEmpty(); 58 void Include(BRect r); 59 void Include(clipping_rect r); 60 void Include(const BRegion*); 61 void Exclude(BRect r); 62 void Exclude(clipping_rect r); 63 void Exclude(const BRegion*); 64 void IntersectWith(const BRegion*); 65 66 /*----- Private or reserved -----------------------------------------*/ 67 class Support; 68 69 private: 70 friend class BView; 71 friend class BDirectWindow; 72 friend class Support; 73 friend class BPrivate::ServerLink; 74 friend class BPrivate::LinkReceiver; 75 76 void _AddRect(clipping_rect r); 77 void set_size(long new_size); 78 79 private: 80 long count; 81 long data_size; 82 clipping_rect bound; 83 clipping_rect *data; 84 }; 85 86 #endif /* _REGION_H */ 87