]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: cocoa/region.mm | |
3 | // Purpose: wxRegion class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2004/04/12 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 David Elliott | |
9 | // Licence: wxWidgets licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/region.h" | |
13 | ||
14 | #import <Foundation/NSGeometry.h> | |
15 | ||
16 | IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); | |
17 | ||
18 | inline wxRect NSRectToWxRect(const NSRect& rect) | |
19 | { | |
20 | return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y, | |
21 | (wxCoord)rect.size.width, (wxCoord)rect.size.height); | |
22 | } | |
23 | ||
24 | wxRegion::wxRegion(const NSRect& rect) | |
25 | { | |
26 | Union(NSRectToWxRect(rect)); | |
27 | } | |
28 | ||
29 | wxRegion::wxRegion(const NSRect *rects, int count) | |
30 | { | |
31 | for(int i=0; i<count; i++) | |
32 | { | |
33 | Union(NSRectToWxRect(rects[i])); | |
34 | } | |
35 | } | |
36 |