]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/region.h
fix aui crash related to SF bug 1531361
[wxWidgets.git] / include / wx / gtk / region.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
5fc7ede9 2// Name: wx/gtk/region.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
58614078
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
5fc7ede9
VZ
10#ifndef _WX_GTK_REGION_H_
11#define _WX_GTK_REGION_H_
c801d85f 12
1e6feb95 13// ----------------------------------------------------------------------------
c801d85f 14// wxRegion
1e6feb95 15// ----------------------------------------------------------------------------
c801d85f 16
8a16d737 17class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
c801d85f 18{
e1208c31 19public:
9fe4c99c 20 wxRegion() { }
1542ea39 21
9fe4c99c
VZ
22 wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
23 {
24 InitRect(x, y, w, h);
25 }
26
27 wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
28 {
29 InitRect(topLeft.x, topLeft.y,
30 bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
31 }
32
33 wxRegion( const wxRect& rect )
34 {
35 InitRect(rect.x, rect.y, rect.width, rect.height);
36 }
37
38 wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
1542ea39 39
85f6b408
VS
40 wxRegion( const wxBitmap& bmp)
41 {
42 Union(bmp);
43 }
1542ea39 44 wxRegion( const wxBitmap& bmp,
85f6b408 45 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
46 {
47 Union(bmp, transColour, tolerance);
48 }
49
d3c7fc99 50 virtual ~wxRegion();
c801d85f 51
8a16d737
VZ
52 // wxRegionBase methods
53 virtual void Clear();
54 virtual bool IsEmpty() const;
1542ea39 55
e1208c31 56public:
331a0b6b
RR
57 // Init with GdkRegion, set ref count to 2 so that
58 // the C++ class will not destroy the region!
59 wxRegion( GdkRegion *region );
1542ea39 60
07818da8 61 GdkRegion *GetRegion() const;
1e6feb95
VZ
62
63protected:
e0f0b197
RR
64 // ref counting code
65 virtual wxObjectRefData *CreateRefData() const;
66 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
1542ea39 67
8a16d737
VZ
68 // wxRegionBase pure virtuals
69 virtual bool DoIsEqual(const wxRegion& region) const;
70 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
71 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
72 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
73
74 virtual bool DoOffset(wxCoord x, wxCoord y);
75 virtual bool DoUnionWithRect(const wxRect& rect);
76 virtual bool DoUnionWithRegion(const wxRegion& region);
77 virtual bool DoIntersect(const wxRegion& region);
78 virtual bool DoSubtract(const wxRegion& region);
79 virtual bool DoXor(const wxRegion& region);
80
9fe4c99c
VZ
81 // common part of ctors for a rectangle region
82 void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
83
e1208c31 84private:
777105f2 85 DECLARE_DYNAMIC_CLASS(wxRegion)
c801d85f
KB
86};
87
1e6feb95
VZ
88// ----------------------------------------------------------------------------
89// wxRegionIterator: decomposes a region into rectangles
90// ----------------------------------------------------------------------------
91
20123d49 92class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
8429bec1 93{
738f9e5a 94public:
07818da8 95 wxRegionIterator();
8429bec1 96 wxRegionIterator(const wxRegion& region);
55ccdb93 97 ~wxRegionIterator();
8429bec1 98
6f2a55e3 99 void Reset() { m_current = 0u; }
8429bec1
RR
100 void Reset(const wxRegion& region);
101
07818da8 102 bool HaveRects() const;
2b5f62a0 103 operator bool () const { return HaveRects(); }
8429bec1 104
2b5f62a0
VZ
105 wxRegionIterator& operator ++ ();
106 wxRegionIterator operator ++ (int);
8429bec1 107
b02da6b1
VZ
108 wxCoord GetX() const;
109 wxCoord GetY() const;
110 wxCoord GetW() const;
111 wxCoord GetWidth() const { return GetW(); }
112 wxCoord GetH() const;
113 wxCoord GetHeight() const { return GetH(); }
1e6feb95 114 wxRect GetRect() const;
8429bec1 115
738f9e5a 116private:
55ccdb93
VZ
117 void Init();
118 void CreateRects( const wxRegion& r );
119
6f2a55e3
VZ
120 size_t m_current;
121 wxRegion m_region;
738f9e5a 122
55ccdb93
VZ
123 wxRect *m_rects;
124 size_t m_numRects;
125
738f9e5a 126private:
777105f2 127 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
8429bec1
RR
128};
129
130
c801d85f 131#endif
5fc7ede9 132 // _WX_GTK_REGION_H_