]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/region.h
don't crash if (char*)c_str() is used twice in a row on the same string and both...
[wxWidgets.git] / include / wx / os2 / region.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
ec02a2f7 2// Name: wx/os2/region.h
0e320a79 3// Purpose: wxRegion class
409c9842 4// Author: David Webster
0e320a79 5// Modified by:
409c9842 6// Created: 10/15/99
0e320a79 7// RCS-ID: $Id$
409c9842 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
8a16d737
VZ
12#ifndef _WX_OS2_REGION_H_
13#define _WX_OS2_REGION_H_
0e320a79 14
0e320a79 15#include "wx/list.h"
51a7e6af 16#include "wx/os2/private.h"
0e320a79 17
8a16d737 18class WXDLLEXPORT wxRegion : public wxRegionWithCombine
5a56a532 19{
0e320a79 20public:
5a56a532
DW
21 wxRegion( wxCoord x
22 ,wxCoord y
23 ,wxCoord vWidth
24 ,wxCoord vHeight
25 );
26 wxRegion( const wxPoint& rTopLeft
27 ,const wxPoint& rBottomRight
28 );
29 wxRegion(const wxRect& rRect);
19193a2c 30 wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region
ec02a2f7 31 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
85f6b408
VS
32 wxRegion( const wxBitmap& bmp)
33 {
34 Union(bmp);
35 }
36 wxRegion( const wxBitmap& bmp,
37 const wxColour& transColour, int tolerance = 0)
38 {
39 Union(bmp, transColour, tolerance);
40 }
409c9842
DW
41
42 wxRegion();
d3c7fc99 43 virtual ~wxRegion();
409c9842 44
5a56a532
DW
45 //
46 // Modify region
47 //
48
49 //
409c9842 50 // Clear current region
5a56a532 51 //
8a16d737 52 virtual void Clear();
5a56a532
DW
53
54 //
409c9842 55 // Is region empty?
5a56a532 56 //
8a16d737 57 virtual bool IsEmpty() const;
5a56a532
DW
58
59 //
409c9842 60 // Get internal region handle
5a56a532 61 //
8a16d737
VZ
62 WXHRGN GetHRGN() const;
63
5a56a532 64 void SetPS(HPS hPS);
45e0dc94
DW
65
66protected:
67 virtual wxObjectRefData* CreateData(void) const;
107e4338
DW
68 virtual wxObjectRefData* CloneData(const wxObjectRefData* pData) const;
69
8a16d737
VZ
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 DoCombine(const wxRegion& region, wxRegionOp op);
77
45e0dc94
DW
78 friend class WXDLLEXPORT wxRegionIterator;
79 DECLARE_DYNAMIC_CLASS(wxRegion);
80
5a56a532 81}; // end of CLASS wxRegion
0e320a79 82
5a56a532
DW
83class WXDLLEXPORT wxRegionIterator : public wxObject
84{
0e320a79
DW
85DECLARE_DYNAMIC_CLASS(wxRegionIterator);
86public:
409c9842 87 wxRegionIterator();
5a56a532 88 wxRegionIterator(const wxRegion& rRegion);
d3c7fc99 89 virtual ~wxRegionIterator();
0e320a79 90
5a56a532
DW
91 void Reset(void) { m_lCurrent = 0; }
92 void Reset(const wxRegion& rRegion);
0e320a79 93
5a56a532
DW
94 operator bool (void) const { return m_lCurrent < m_lNumRects; }
95 bool HaveRects(void) const { return m_lCurrent < m_lNumRects; }
0e320a79 96
5a56a532 97 void operator ++ (void);
409c9842 98 void operator ++ (int);
0e320a79 99
5a56a532
DW
100 wxCoord GetX(void) const;
101 wxCoord GetY(void) const;
102 wxCoord GetW(void) const;
103 wxCoord GetWidth(void) const { return GetW(); }
104 wxCoord GetH(void) const;
105 wxCoord GetHeight(void) const { return GetH(); }
106 wxRect GetRect(void) const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
0e320a79
DW
107
108private:
5a56a532
DW
109 long m_lCurrent;
110 long m_lNumRects;
111 wxRegion m_vRegion;
112 wxRect* m_pRects;
113}; // end of wxRegionIterator
0e320a79 114
8a16d737 115#endif // _WX_OS2_REGION_H_