]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/region.h
New API for wxdataViewCtrl (doesn't run yet).
[wxWidgets.git] / include / wx / msw / region.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
5549e9f7 2// Name: wx/msw/region.h
2bda0e17 3// Purpose: wxRegion class
371a5b4e 4// Author: Julian Smart
2bda0e17
KB
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) 1997-2002 wxWidgets team
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
8a16d737
VZ
12#ifndef _WX_MSW_REGION_H_
13#define _WX_MSW_REGION_H_
2bda0e17 14
8a16d737 15class WXDLLEXPORT wxRegion : public wxRegionWithCombine
5549e9f7 16{
2bda0e17 17public:
5549e9f7 18 wxRegion();
9b1801c1 19 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
2bda0e17
KB
20 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
21 wxRegion(const wxRect& rect);
81d66cf3 22 wxRegion(WXHRGN hRegion); // Hangs on to this region
5549e9f7 23 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
85f6b408
VS
24 wxRegion( const wxBitmap& bmp)
25 {
26 Union(bmp);
27 }
1542ea39 28 wxRegion( const wxBitmap& bmp,
85f6b408 29 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
30 {
31 Union(bmp, transColour, tolerance);
32 }
2bda0e17 33
5549e9f7 34 virtual ~wxRegion();
2bda0e17 35
8a16d737
VZ
36 // wxRegionBase methods
37 virtual void Clear();
38 virtual bool IsEmpty() const;
a724d789
JS
39
40 // Get internal region handle
41 WXHRGN GetHRGN() const;
5549e9f7 42
0fb067bb 43protected:
02576308 44 virtual wxObjectRefData *CreateRefData() const;
b8027888 45 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
0fb067bb 46
8a16d737
VZ
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
5549e9f7 55 friend class WXDLLEXPORT wxRegionIterator;
0fb067bb
VZ
56
57 DECLARE_DYNAMIC_CLASS(wxRegion)
2bda0e17
KB
58};
59
5549e9f7
VZ
60class WXDLLEXPORT wxRegionIterator : public wxObject
61{
2bda0e17 62public:
2b5f62a0 63 wxRegionIterator() { Init(); }
5549e9f7 64 wxRegionIterator(const wxRegion& region);
4dddb8a2 65 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
2bda0e17 66
2b5f62a0
VZ
67 wxRegionIterator& operator=(const wxRegionIterator& ri);
68
69 virtual ~wxRegionIterator();
70
71 void Reset() { m_current = 0; }
5549e9f7 72 void Reset(const wxRegion& region);
2bda0e17 73
2b5f62a0
VZ
74 bool HaveRects() const { return (m_current < m_numRects); }
75
2b5f62a0 76 operator bool () const { return HaveRects(); }
a3ef5bf5 77
2b5f62a0
VZ
78 wxRegionIterator& operator++();
79 wxRegionIterator operator++(int);
2bda0e17 80
2b5f62a0
VZ
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(); }
2bda0e17 87
2b5f62a0 88 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
2bda0e17
KB
89
90private:
2b5f62a0
VZ
91 // common part of all ctors
92 void Init();
93
5549e9f7
VZ
94 long m_current;
95 long m_numRects;
96 wxRegion m_region;
2bda0e17 97 wxRect* m_rects;
5549e9f7 98
57de2373 99 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
2bda0e17
KB
100};
101
8a16d737 102#endif // _WX_MSW_REGION_H_