]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/region.h
Don't create multiple parent-less top level frames in layout sample.
[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
53a2db12 15class WXDLLIMPEXP_CORE 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
94a007ec 23 wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
a8ff046b 24#if wxUSE_IMAGE
85f6b408
VS
25 wxRegion( const wxBitmap& bmp)
26 {
27 Union(bmp);
28 }
1542ea39 29 wxRegion( const wxBitmap& bmp,
85f6b408 30 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
31 {
32 Union(bmp, transColour, tolerance);
33 }
a8ff046b 34#endif // wxUSE_IMAGE
2bda0e17 35
5549e9f7 36 virtual ~wxRegion();
2bda0e17 37
8a16d737
VZ
38 // wxRegionBase methods
39 virtual void Clear();
40 virtual bool IsEmpty() const;
a724d789
JS
41
42 // Get internal region handle
43 WXHRGN GetHRGN() const;
5549e9f7 44
0fb067bb 45protected:
8f884a0d
VZ
46 virtual wxGDIRefData *CreateGDIRefData() const;
47 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
0fb067bb 48
8a16d737
VZ
49 virtual bool DoIsEqual(const wxRegion& region) const;
50 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
51 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
52 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
53
54 virtual bool DoOffset(wxCoord x, wxCoord y);
55 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
56
b5dbe15d 57 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
0fb067bb
VZ
58
59 DECLARE_DYNAMIC_CLASS(wxRegion)
2bda0e17
KB
60};
61
53a2db12 62class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
5549e9f7 63{
2bda0e17 64public:
2b5f62a0 65 wxRegionIterator() { Init(); }
5549e9f7 66 wxRegionIterator(const wxRegion& region);
4dddb8a2 67 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
2bda0e17 68
2b5f62a0
VZ
69 wxRegionIterator& operator=(const wxRegionIterator& ri);
70
71 virtual ~wxRegionIterator();
72
73 void Reset() { m_current = 0; }
5549e9f7 74 void Reset(const wxRegion& region);
2bda0e17 75
2b5f62a0
VZ
76 bool HaveRects() const { return (m_current < m_numRects); }
77
2b5f62a0 78 operator bool () const { return HaveRects(); }
a3ef5bf5 79
2b5f62a0
VZ
80 wxRegionIterator& operator++();
81 wxRegionIterator operator++(int);
2bda0e17 82
2b5f62a0
VZ
83 wxCoord GetX() const;
84 wxCoord GetY() const;
85 wxCoord GetW() const;
86 wxCoord GetWidth() const { return GetW(); }
87 wxCoord GetH() const;
88 wxCoord GetHeight() const { return GetH(); }
2bda0e17 89
2b5f62a0 90 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
2bda0e17
KB
91
92private:
2b5f62a0
VZ
93 // common part of all ctors
94 void Init();
95
5549e9f7
VZ
96 long m_current;
97 long m_numRects;
98 wxRegion m_region;
2bda0e17 99 wxRect* m_rects;
5549e9f7 100
57de2373 101 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
2bda0e17
KB
102};
103
8a16d737 104#endif // _WX_MSW_REGION_H_