]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/region.mm
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / cocoa / region.mm
CommitLineData
53dbce23 1/////////////////////////////////////////////////////////////////////////////
b3a44e05 2// Name: src/cocoa/region.mm
53dbce23
DE
3// Purpose: wxRegion class
4// Author: David Elliott
b3a44e05 5// Modified by:
53dbce23
DE
6// Created: 2004/04/12
7// RCS-ID: $Id$
8// Copyright: (c) 2004 David Elliott
526954c5 9// Licence: wxWindows licence
53dbce23
DE
10/////////////////////////////////////////////////////////////////////////////
11
b3a44e05
WS
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
53dbce23
DE
23#include "wx/region.h"
24
e9ec987a
DE
25#import <Foundation/NSGeometry.h>
26
53dbce23
DE
27IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
28
e9ec987a
DE
29inline 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
35wxRegion::wxRegion(const NSRect& rect)
36{
37 Union(NSRectToWxRect(rect));
38}
39
40wxRegion::wxRegion(const NSRect *rects, int count)
41{
42 for(int i=0; i<count; i++)
43 {
44 Union(NSRectToWxRect(rects[i]));
45 }
46}