comparison dwt/graphics/Device.d @ 17:5b53d338c709

Fixed some errors after latest merge
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 29 Aug 2008 22:04:22 +0200
parents 2952d5604c0a e831403a80a9
children 71b49a659702
comparison
equal deleted inserted replaced
16:fb2555104d70 17:5b53d338c709
30 import dwt.graphics.Drawable; 30 import dwt.graphics.Drawable;
31 31
32 /** 32 /**
33 * This class is the abstract superclass of all device objects, 33 * This class is the abstract superclass of all device objects,
34 * such as the Display device and the Printer device. Devices 34 * such as the Display device and the Printer device. Devices
35 * can have a graphics context (GC) created for them, and they 35 * can have a graphics context cast(GC) created for them, and they
36 * can be drawn on by sending messages to the associated GC. 36 * can be drawn on by sending messages to the associated GC.
37 */ 37 */
38 public abstract class Device : Drawable { 38 public abstract class Device : Drawable {
39 39
40 /* Debugging */ 40 /* Debugging */
94 * @see #create 94 * @see #create
95 * @see #init 95 * @see #init
96 * 96 *
97 * @since 3.1 97 * @since 3.1
98 */ 98 */
99 public Device() { 99 public this() {
100 this(null); 100 this(null);
101 } 101 }
102 102
103 /** 103 /**
104 * Constructs a new instance of this class. 104 * Constructs a new instance of this class.
110 * 110 *
111 * @see #create 111 * @see #create
112 * @see #init 112 * @see #init
113 * @see DeviceData 113 * @see DeviceData
114 */ 114 */
115 public Device(DeviceData data) { 115 public this(DeviceData data) {
116 synchronized (Device.class) { 116 synchronized (Device.class) {
117 if (data !is null) { 117 if (data !is null) {
118 debug = data.debug; 118 debug = data.debug;
119 tracking = data.tracking; 119 tracking = data.tracking;
120 } 120 }
236 */ 236 */
237 public Rectangle getBounds () { 237 public Rectangle getBounds () {
238 checkDevice (); 238 checkDevice ();
239 NSScreen screen = NSScreen.mainScreen(); 239 NSScreen screen = NSScreen.mainScreen();
240 NSRect rect = screen.frame(); 240 NSRect rect = screen.frame();
241 return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); 241 return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height);
242 } 242 }
243 243
244 /** 244 /**
245 * Returns a <code>DeviceData</code> based on the receiver. 245 * Returns a <code>DeviceData</code> based on the receiver.
246 * Modifications made to this <code>DeviceData</code> will not 246 * Modifications made to this <code>DeviceData</code> will not
297 */ 297 */
298 public Rectangle getClientArea () { 298 public Rectangle getClientArea () {
299 checkDevice (); 299 checkDevice ();
300 NSScreen screen = NSScreen.mainScreen(); 300 NSScreen screen = NSScreen.mainScreen();
301 NSRect rect = screen.visibleFrame(); 301 NSRect rect = screen.visibleFrame();
302 return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); 302 return new Rectangle(cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height);
303 } 303 }
304 304
305 /** 305 /**
306 * Returns the bit depth of the screen, which is the number of 306 * Returns the bit depth of the screen, which is the number of
307 * bits it takes to represent the number of unique colors that 307 * bits it takes to represent the number of unique colors that
333 public Point getDPI () { 333 public Point getDPI () {
334 checkDevice (); 334 checkDevice ();
335 NSDictionary dictionary = NSScreen.mainScreen().deviceDescription(); 335 NSDictionary dictionary = NSScreen.mainScreen().deviceDescription();
336 NSValue value = new NSValue(dictionary.objectForKey(new id(OS.NSDeviceResolution())).id); 336 NSValue value = new NSValue(dictionary.objectForKey(new id(OS.NSDeviceResolution())).id);
337 NSSize size = value.sizeValue(); 337 NSSize size = value.sizeValue();
338 return new Point((int)size.width, (int)size.height); 338 return new Point(cast(int)size.width, cast(int)size.height);
339 } 339 }
340 340
341 /** 341 /**
342 * Returns <code>FontData</code> objects which describe 342 * Returns <code>FontData</code> objects which describe
343 * the fonts that match the given arguments. If the 343 * the fonts that match the given arguments. If the