1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/region.h
3 // Purpose:     generic wxRegion class
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2004/04/12
7 // RCS-ID:      $Id: region.h 41429 2006-09-25 11:47:23Z VZ $
8 // Copyright:   (c) 2004 David Elliott
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef _WX_GENERIC_REGION_H__
13 #define _WX_GENERIC_REGION_H__
14 
15 class WXDLLEXPORT wxRegionGeneric : public wxRegionBase
16 {
17 public:
18     wxRegionGeneric(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
19     wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRight);
20     wxRegionGeneric(const wxRect& rect);
21     wxRegionGeneric();
22     virtual ~wxRegionGeneric();
23 
24     // wxRegionBase pure virtuals
25     virtual void Clear();
26     virtual bool IsEmpty() const;
27 
28 protected:
29     virtual wxObjectRefData *CreateRefData() const;
30     virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
31 
32     // wxRegionBase pure virtuals
33     virtual bool DoIsEqual(const wxRegion& region) const;
34     virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
35     virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
36     virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
37 
38     virtual bool DoOffset(wxCoord x, wxCoord y);
39     virtual bool DoUnionWithRect(const wxRect& rect);
40     virtual bool DoUnionWithRegion(const wxRegion& region);
41     virtual bool DoIntersect(const wxRegion& region);
42     virtual bool DoSubtract(const wxRegion& region);
43     virtual bool DoXor(const wxRegion& region);
44 
45     friend class WXDLLEXPORT wxRegionIteratorGeneric;
46 };
47 
48 class WXDLLEXPORT wxRegionIteratorGeneric : public wxObject
49 {
50 public:
51     wxRegionIteratorGeneric();
52     wxRegionIteratorGeneric(const wxRegionGeneric& region);
53     wxRegionIteratorGeneric(const wxRegionIteratorGeneric& iterator);
54     virtual ~wxRegionIteratorGeneric();
55 
56     wxRegionIteratorGeneric& operator=(const wxRegionIteratorGeneric& iterator);
57 
Reset()58     void Reset() { m_current = 0; }
59     void Reset(const wxRegionGeneric& region);
60 
61     operator bool () const { return HaveRects(); }
62     bool HaveRects() const;
63 
64     wxRegionIteratorGeneric& operator++();
65     wxRegionIteratorGeneric operator++(int);
66 
67     long GetX() const;
68     long GetY() const;
69     long GetW() const;
GetWidth()70     long GetWidth() const { return GetW(); }
71     long GetH() const;
GetHeight()72     long GetHeight() const { return GetH(); }
73     wxRect GetRect() const;
74 private:
75     long     m_current;
76     wxRegionGeneric m_region;
77 };
78 
79 #endif // _WX_GENERIC_REGION_H__
80