]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/region.h
changed Remove/InsertDir() parameter type to size_t from int; added RemoveLastDir()
[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
65571936 9// Licence: wxWindows licence
a24aff65
DE
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() {}
85f6b408
VS
33 wxRegion(const wxBitmap& bmp)
34 : wxRegionGeneric()
35 { Union(bmp); }
53dbce23 36 wxRegion(const wxBitmap& bmp,
85f6b408 37 const wxColour& transColour, int tolerance = 0)
53dbce23 38 : wxRegionGeneric()
85f6b408 39 { Union(bmp, transColour, tolerance); }
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 51 // Use the non-transparent pixels of a wxBitmap for the region to combine
85f6b408
VS
52 // with this region. First version takes transparency from bitmap's mask,
53 // second lets the user specify the colour to be treated as transparent
1542ea39 54 // along with an optional tolerance value.
53dbce23 55 // NOTE: implemented in common/rgncmn.cpp
85f6b408 56 bool Union(const wxBitmap& bmp);
1542ea39 57 bool Union(const wxBitmap& bmp,
85f6b408 58 const wxColour& transColour, 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__