]>
Commit | Line | Data |
---|---|---|
53dbce23 | 1 | ///////////////////////////////////////////////////////////////////////////// |
b3a44e05 | 2 | // Name: src/cocoa/region.mm |
53dbce23 DE |
3 | // Purpose: wxRegion class |
4 | // Author: David Elliott | |
b3a44e05 | 5 | // Modified by: |
53dbce23 | 6 | // Created: 2004/04/12 |
53dbce23 | 7 | // Copyright: (c) 2004 David Elliott |
526954c5 | 8 | // Licence: wxWindows licence |
53dbce23 DE |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
b3a44e05 WS |
11 | // ============================================================================ |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | // For compilers that support precompilation, includes "wx.h". | |
20 | #include "wx/wxprec.h" | |
21 | ||
53dbce23 DE |
22 | #include "wx/region.h" |
23 | ||
e9ec987a DE |
24 | #import <Foundation/NSGeometry.h> |
25 | ||
53dbce23 DE |
26 | IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); |
27 | ||
e9ec987a DE |
28 | inline wxRect NSRectToWxRect(const NSRect& rect) |
29 | { | |
30 | return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y, | |
31 | (wxCoord)rect.size.width, (wxCoord)rect.size.height); | |
32 | } | |
33 | ||
34 | wxRegion::wxRegion(const NSRect& rect) | |
35 | { | |
36 | Union(NSRectToWxRect(rect)); | |
37 | } | |
38 | ||
39 | wxRegion::wxRegion(const NSRect *rects, int count) | |
40 | { | |
41 | for(int i=0; i<count; i++) | |
42 | { | |
43 | Union(NSRectToWxRect(rects[i])); | |
44 | } | |
45 | } |