]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/region.h
add an assert indicating that old code overriding OnExecute() must be updated with 2.9
[wxWidgets.git] / include / wx / gtk1 / region.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/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
c801d85f 13#include "wx/list.h"
c801d85f 14
1e6feb95 15// ----------------------------------------------------------------------------
c801d85f 16// wxRegion
1e6feb95 17// ----------------------------------------------------------------------------
c801d85f 18
8a16d737 19class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
c801d85f 20{
e1208c31 21public:
9fe4c99c 22 wxRegion() { }
1542ea39 23
9fe4c99c
VZ
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 );
1542ea39 41
85f6b408
VS
42 wxRegion( const wxBitmap& bmp)
43 {
44 Union(bmp);
45 }
1542ea39 46 wxRegion( const wxBitmap& bmp,
85f6b408 47 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
48 {
49 Union(bmp, transColour, tolerance);
50 }
51
d3c7fc99 52 virtual ~wxRegion();
c801d85f 53
8a16d737
VZ
54 // wxRegionBase methods
55 virtual void Clear();
56 virtual bool IsEmpty() const;
1542ea39 57
e1208c31 58public:
331a0b6b
RR
59 // Init with GdkRegion, set ref count to 2 so that
60 // the C++ class will not destroy the region!
61 wxRegion( GdkRegion *region );
1542ea39 62
07818da8 63 GdkRegion *GetRegion() const;
1e6feb95
VZ
64
65protected:
8f884a0d
VZ
66 virtual wxGDIRefData *CreateGDIRefData() const;
67 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
1542ea39 68
8a16d737
VZ
69 // wxRegionBase pure virtuals
70 virtual bool DoIsEqual(const wxRegion& region) const;
71 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
72 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
73 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
74
75 virtual bool DoOffset(wxCoord x, wxCoord y);
76 virtual bool DoUnionWithRect(const wxRect& rect);
77 virtual bool DoUnionWithRegion(const wxRegion& region);
78 virtual bool DoIntersect(const wxRegion& region);
79 virtual bool DoSubtract(const wxRegion& region);
80 virtual bool DoXor(const wxRegion& region);
81
9fe4c99c
VZ
82 // common part of ctors for a rectangle region
83 void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
84
e1208c31 85private:
777105f2 86 DECLARE_DYNAMIC_CLASS(wxRegion)
c801d85f
KB
87};
88
1e6feb95
VZ
89// ----------------------------------------------------------------------------
90// wxRegionIterator: decomposes a region into rectangles
91// ----------------------------------------------------------------------------
92
20123d49 93class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
8429bec1 94{
738f9e5a 95public:
07818da8 96 wxRegionIterator();
8429bec1
RR
97 wxRegionIterator(const wxRegion& region);
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:
6f2a55e3
VZ
117 size_t m_current;
118 wxRegion m_region;
738f9e5a
RR
119
120private:
777105f2 121 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
8429bec1
RR
122};
123
124
c801d85f 125#endif
5fc7ede9 126 // _WX_GTK_REGION_H_