Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSScreen.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | cfa563df4fdd |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 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.NSScreen; | 14 module dwt.internal.cocoa.NSScreen; |
15 | 15 |
16 import dwt.internal.cocoa.CGFloat; | 16 import dwt.dwthelper.utils; |
17 import cocoa = dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | 18 import dwt.internal.cocoa.NSArray; |
18 import dwt.internal.cocoa.NSDictionary; | 19 import dwt.internal.cocoa.NSDictionary; |
20 import dwt.internal.cocoa.NSGraphics; | |
19 import dwt.internal.cocoa.NSObject; | 21 import dwt.internal.cocoa.NSObject; |
20 import dwt.internal.cocoa.NSRect; | 22 import dwt.internal.cocoa.NSRect; |
21 import dwt.internal.cocoa.NSWindow : NSWindowDepth; | |
22 import dwt.internal.cocoa.OS; | 23 import dwt.internal.cocoa.OS; |
23 import objc = dwt.internal.objc.runtime; | 24 import objc = dwt.internal.objc.runtime; |
24 | 25 |
25 public class NSScreen : NSObject | 26 public class NSScreen : NSObject { |
26 { | |
27 | 27 |
28 public this () | 28 public this() { |
29 { | 29 super(); |
30 super(); | 30 } |
31 } | |
32 | 31 |
33 public this (objc.id id) | 32 public this(objc.id id) { |
34 { | 33 super(id); |
35 super(id); | 34 } |
36 } | |
37 | 35 |
38 public static NSScreen deepestScreen () | 36 public this(cocoa.id id) { |
39 { | 37 super(id); |
40 objc.id result = OS.objc_msgSend(OS.class_NSScreen, OS.sel_deepestScreen); | 38 } |
41 return result !is null ? new NSScreen(result) : null; | |
42 } | |
43 | 39 |
44 public NSWindowDepth depth () | 40 public NSWindowDepth depth() { |
45 { | 41 return cast(NSWindowDepth)/*64*/OS.objc_msgSend(this.id, OS.sel_depth); |
46 return cast(NSWindowDepth) OS.objc_msgSend(this.id_, OS.sel_depth); | 42 } |
47 } | |
48 | 43 |
49 public NSDictionary deviceDescription () | 44 public NSDictionary deviceDescription() { |
50 { | 45 objc.id result = OS.objc_msgSend(this.id, OS.sel_deviceDescription); |
51 objc.id result = OS.objc_msgSend(this.id_, OS.sel_deviceDescription); | 46 return result !is null ? new NSDictionary(result) : null; |
52 return result !is null ? new NSDictionary(result) : null; | 47 } |
53 } | |
54 | 48 |
55 public NSRect frame () | 49 public NSRect frame() { |
56 { | 50 NSRect result = NSRect(); |
57 NSRect result; | 51 OS.objc_msgSend_stret(result, this.id, OS.sel_frame); |
58 OS.objc_msgSend_stret(&result, this.id_, OS.sel_frame); | 52 return result; |
59 return result; | 53 } |
60 } | |
61 | 54 |
62 public static NSScreen mainScreen () | 55 public static NSScreen mainScreen() { |
63 { | 56 objc.id result = OS.objc_msgSend(OS.class_NSScreen, OS.sel_mainScreen); |
64 objc.id result = OS.objc_msgSend(OS.class_NSScreen, OS.sel_mainScreen); | 57 return result !is null ? new NSScreen(result) : null; |
65 return result !is null ? new NSScreen(result) : null; | 58 } |
66 } | |
67 | 59 |
68 public static NSArray screens () | 60 public static NSArray screens() { |
69 { | 61 objc.id result = OS.objc_msgSend(OS.class_NSScreen, OS.sel_screens); |
70 objc.id result = OS.objc_msgSend(OS.class_NSScreen, OS.sel_screens); | 62 return result !is null ? new NSArray(result) : null; |
71 return result !is null ? new NSArray(result) : null; | 63 } |
72 } | |
73 | 64 |
74 public /*const*/NSWindowDepth* supportedWindowDepths () | 65 public NSRect visibleFrame() { |
75 { | 66 NSRect result = NSRect(); |
76 return cast(/*const*/NSWindowDepth*)OS.objc_msgSend(this.id_, OS.sel_supportedWindowDepths); | 67 OS.objc_msgSend_stret(result, this.id, OS.sel_visibleFrame); |
77 } | 68 return result; |
78 | 69 } |
79 public CGFloat userSpaceScaleFactor () | |
80 { | |
81 return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_userSpaceScaleFactor); | |
82 } | |
83 | |
84 public NSRect visibleFrame () | |
85 { | |
86 NSRect result; | |
87 OS.objc_msgSend_stret(&result, this.id_, OS.sel_visibleFrame); | |
88 return result; | |
89 } | |
90 | 70 |
91 } | 71 } |