comparison dwt/internal/cocoa/NSRect.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children cfa563df4fdd
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others. 2 * Copyright (c) 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSRect; 14 module dwt.internal.cocoa.NSRect;
15 15
16 import dwt.internal.cocoa.CGFloat; 16 import dwt.dwthelper.utils;
17 import dwt.internal.cocoa.NSInteger;
18 import dwt.internal.cocoa.NSPoint; 17 import dwt.internal.cocoa.NSPoint;
19 import dwt.internal.cocoa.NSSize; 18 import dwt.internal.cocoa.NSSize;
20 19
21 extern (C):
22 20
23 alias NSRect* NSRectArray; 21 public struct NSRect {
24 alias NSRect* NSRectPointer; 22 /** @field accessor=origin.x */
25 23 public alias origin.x x;
26 enum NSRectEdge : NSUInteger 24 /** @field accessor=origin.y */
27 { 25 public alias origin.y y;
28 NSMinXEdge = 0, 26 /** @field accessor=size.width */
29 NSMinYEdge = 1, 27 public alias size.width width;
30 NSMaxXEdge = 2, 28 /** @field accessor=size.height */
31 NSMaxYEdge = 3 29 public alias size.height height;
32 } 30
33
34 alias NSRectEdge.NSMinXEdge NSMinXEdge;
35 alias NSRectEdge.NSMinYEdge NSMinYEdge;
36 alias NSRectEdge.NSMaxXEdge NSMaxXEdge;
37 alias NSRectEdge.NSMaxYEdge NSMaxYEdge;
38
39 struct NSRect
40 {
41 NSPoint origin; 31 NSPoint origin;
42 NSSize size; 32 NSSize size;
43
44 // for dwt compatibility
45
46 CGFloat x ()
47 {
48 return origin.x;
49 }
50
51 CGFloat x (CGFloat x)
52 {
53 return origin.x = x;
54 }
55
56 CGFloat y ()
57 {
58 return origin.y;
59 }
60
61 CGFloat y (CGFloat y)
62 {
63 return origin.y = y;
64 }
65
66 CGFloat width ()
67 {
68 return size.width;
69 }
70
71 CGFloat width (CGFloat width)
72 {
73 return size.width = width;
74 }
75
76 CGFloat height ()
77 {
78 return size.height;
79 }
80
81 CGFloat height (CGFloat height)
82 {
83 return size.height = height;
84 }
85
86 /*alias origin.x x;
87 alias origin.y y;
88 alias size.width width;
89 alias size.height height;*/
90 } 33 }