]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/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 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #include "wx/region.h" | |
24 | ||
25 | #import <Foundation/NSGeometry.h> | |
26 | ||
27 | IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); | |
28 | ||
29 | inline wxRect NSRectToWxRect(const NSRect& rect) | |
30 | { | |
31 | return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y, | |
32 | (wxCoord)rect.size.width, (wxCoord)rect.size.height); | |
33 | } | |
34 | ||
35 | wxRegion::wxRegion(const NSRect& rect) | |
36 | { | |
37 | Union(NSRectToWxRect(rect)); | |
38 | } | |
39 | ||
40 | wxRegion::wxRegion(const NSRect *rects, int count) | |
41 | { | |
42 | for(int i=0; i<count; i++) | |
43 | { | |
44 | Union(NSRectToWxRect(rects[i])); | |
45 | } | |
46 | } |