]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/region.h
Use wxRound instead of wxCoordRound
[wxWidgets.git] / include / wx / msw / region.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/region.h
3// Purpose: wxRegion class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) 1997-2002 wxWidgets team
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_MSW_REGION_H_
13#define _WX_MSW_REGION_H_
14
15class WXDLLEXPORT wxRegion : public wxRegionWithCombine
16{
17public:
18 wxRegion();
19 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
20 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
21 wxRegion(const wxRect& rect);
22 wxRegion(WXHRGN hRegion); // Hangs on to this region
23 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
24 wxRegion( const wxBitmap& bmp)
25 {
26 Union(bmp);
27 }
28 wxRegion( const wxBitmap& bmp,
29 const wxColour& transColour, int tolerance = 0)
30 {
31 Union(bmp, transColour, tolerance);
32 }
33
34 virtual ~wxRegion();
35
36 // wxRegionBase methods
37 virtual void Clear();
38 virtual bool IsEmpty() const;
39
40 // Get internal region handle
41 WXHRGN GetHRGN() const;
42
43protected:
44 virtual wxObjectRefData *CreateRefData() const;
45 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
46
47 virtual bool DoIsEqual(const wxRegion& region) const;
48 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
49 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
50 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
51
52 virtual bool DoOffset(wxCoord x, wxCoord y);
53 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
54
55 friend class WXDLLEXPORT wxRegionIterator;
56
57 DECLARE_DYNAMIC_CLASS(wxRegion)
58};
59
60class WXDLLEXPORT wxRegionIterator : public wxObject
61{
62public:
63 wxRegionIterator() { Init(); }
64 wxRegionIterator(const wxRegion& region);
65 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
66
67 wxRegionIterator& operator=(const wxRegionIterator& ri);
68
69 virtual ~wxRegionIterator();
70
71 void Reset() { m_current = 0; }
72 void Reset(const wxRegion& region);
73
74 bool HaveRects() const { return (m_current < m_numRects); }
75
76 operator bool () const { return HaveRects(); }
77
78 wxRegionIterator& operator++();
79 wxRegionIterator operator++(int);
80
81 wxCoord GetX() const;
82 wxCoord GetY() const;
83 wxCoord GetW() const;
84 wxCoord GetWidth() const { return GetW(); }
85 wxCoord GetH() const;
86 wxCoord GetHeight() const { return GetH(); }
87
88 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
89
90private:
91 // common part of all ctors
92 void Init();
93
94 long m_current;
95 long m_numRects;
96 wxRegion m_region;
97 wxRect* m_rects;
98
99 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
100};
101
102#endif // _WX_MSW_REGION_H_