]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/region.h
make it non mach-o carbon savvy
[wxWidgets.git] / include / wx / cocoa / region.h
CommitLineData
a24aff65 1/////////////////////////////////////////////////////////////////////////////
53dbce23 2// Name: wx/cocoa/region.h
a24aff65 3// Purpose: wxRegion class
53dbce23
DE
4// Author: David Elliott
5// Modified by:
6// Created: 2004/04/12
a24aff65 7// RCS-ID: $Id$
53dbce23 8// Copyright: (c) 2004 David Elliott
a24aff65
DE
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
53dbce23
DE
12#ifndef _WX_COCOA_REGION_H__
13#define _WX_COCOA_REGION_H__
a24aff65 14
53dbce23 15#include "wx/generic/region.h"
a24aff65 16
e9ec987a
DE
17typedef struct _NSRect NSRect;
18
53dbce23
DE
19class WXDLLEXPORT wxRegion : public wxRegionGeneric
20{
21 DECLARE_DYNAMIC_CLASS(wxRegion);
a24aff65 22public:
53dbce23
DE
23 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
24 : wxRegionGeneric(x,y,w,h)
25 {}
26 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
27 : wxRegionGeneric(topLeft, bottomRight)
28 {}
29 wxRegion(const wxRect& rect)
30 : wxRegionGeneric(rect)
31 {}
32 wxRegion() {}
33 wxRegion(const wxBitmap& bmp,
34 const wxColour& transColour = wxNullColour,
35 int tolerance = 0)
36 : wxRegionGeneric()
1542ea39
RD
37 {
38 Union(bmp, transColour, tolerance);
39 }
53dbce23 40 ~wxRegion() {}
a24aff65 41 wxRegion(const wxRegion& r)
53dbce23
DE
42 : wxRegionGeneric(r)
43 {}
44 wxRegion& operator= (const wxRegion& r)
45 { return *(wxRegion*)&(this->wxRegionGeneric::operator=(r)); }
1542ea39 46
e9ec987a
DE
47 // Cocoa-specific creation
48 wxRegion(const NSRect& rect);
49 wxRegion(const NSRect *rects, int count);
50
1542ea39
RD
51 // Use the non-transparent pixels of a wxBitmap for the region to combine
52 // with this region. If the bitmap has a mask then it will be used,
53 // otherwise the colour to be treated as transparent may be specified,
54 // along with an optional tolerance value.
53dbce23 55 // NOTE: implemented in common/rgncmn.cpp
1542ea39
RD
56 bool Union(const wxBitmap& bmp,
57 const wxColour& transColour = wxNullColour,
58 int tolerance = 0);
53dbce23
DE
59 /* And because of function hiding: */
60 bool Union(long x, long y, long width, long height)
61 { return wxRegionGeneric::Union(x,y,width,height); }
62 bool Union(const wxRect& rect)
63 { return wxRegionGeneric::Union(rect); }
64 bool Union(const wxRegion& region)
65 { return wxRegionGeneric::Union(region); }
1542ea39 66
53dbce23
DE
67 // Convert the region to a B&W bitmap with the black pixels being inside
68 // the region.
69 // NOTE: implemented in common/rgncmn.cpp
70 wxBitmap ConvertToBitmap() const;
1542ea39 71
a24aff65
DE
72};
73
53dbce23 74class WXDLLEXPORT wxRegionIterator : public wxRegionIteratorGeneric
a24aff65 75{
53dbce23 76// DECLARE_DYNAMIC_CLASS(wxRegionIteratorGeneric);
a24aff65 77public:
53dbce23
DE
78 wxRegionIterator() {}
79 wxRegionIterator(const wxRegion& region)
80 : wxRegionIteratorGeneric(region)
81 {}
82 wxRegionIterator(const wxRegionIterator& iterator)
83 : wxRegionIteratorGeneric(iterator)
84 {}
85 ~wxRegionIterator() {}
86
87 wxRegionIterator& operator=(const wxRegionIterator& iter)
88 { return *(wxRegionIterator*)&(this->wxRegionIteratorGeneric::operator=(iter)); }
a24aff65
DE
89};
90
53dbce23 91#endif //ndef _WX_COCOA_REGION_H__