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