]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/region.h
fix gcc warning about possibly uninitialized variables
[wxWidgets.git] / include / wx / x11 / region.h
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
8a16d737 2// Name: wx/x11/region.h
83df96d6
JS
3// Purpose: wxRegion class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
1934d291 8// Copyright: (c) Julian Smart, Robert Roebling
8a16d737 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_REGION_H_
13#define _WX_REGION_H_
14
83df96d6 15#include "wx/list.h"
83df96d6 16
1934d291
RR
17// ----------------------------------------------------------------------------
18// wxRegion
19// ----------------------------------------------------------------------------
20
8a16d737 21class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
1934d291 22{
83df96d6 23public:
1934d291
RR
24 wxRegion() { }
25
26 wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
27 {
28 InitRect(x, y, w, h);
29 }
30
31 wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
32 {
33 InitRect(topLeft.x, topLeft.y,
34 bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
35 }
36
37 wxRegion( const wxRect& rect )
38 {
39 InitRect(rect.x, rect.y, rect.width, rect.height);
40 }
41
42 wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
1542ea39 43
85f6b408
VS
44 wxRegion( const wxBitmap& bmp)
45 {
46 Union(bmp);
47 }
1542ea39 48 wxRegion( const wxBitmap& bmp,
85f6b408 49 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
50 {
51 Union(bmp, transColour, tolerance);
52 }
53
d3c7fc99 54 virtual ~wxRegion();
1934d291 55
8a16d737
VZ
56 // wxRegionBase methods
57 virtual void Clear();
58 virtual bool IsEmpty() const;
1542ea39 59
1934d291
RR
60public:
61 WXRegion *GetX11Region() const;
62
63protected:
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
1934d291
RR
81 // common part of ctors for a rectangle region
82 void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
83
84private:
777105f2 85 DECLARE_DYNAMIC_CLASS(wxRegion)
83df96d6
JS
86};
87
1934d291
RR
88// ----------------------------------------------------------------------------
89// wxRegionIterator: decomposes a region into rectangles
90// ----------------------------------------------------------------------------
91
968eb2ef 92class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
1934d291 93{
83df96d6
JS
94public:
95 wxRegionIterator();
96 wxRegionIterator(const wxRegion& region);
1934d291
RR
97
98 void Reset() { m_current = 0u; }
83df96d6 99 void Reset(const wxRegion& region);
1934d291
RR
100
101 operator bool () const;
102 bool HaveRects() const;
103
83df96d6
JS
104 void operator ++ ();
105 void operator ++ (int);
1934d291 106
83df96d6
JS
107 wxCoord GetX() const;
108 wxCoord GetY() const;
109 wxCoord GetW() const;
110 wxCoord GetWidth() const { return GetW(); }
111 wxCoord GetH() const;
112 wxCoord GetHeight() const { return GetH(); }
1934d291
RR
113 wxRect GetRect() const;
114
83df96d6 115private:
1934d291 116 size_t m_current;
83df96d6 117 wxRegion m_region;
1934d291
RR
118
119private:
777105f2 120 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
83df96d6
JS
121};
122
123#endif
124// _WX_REGION_H_