Mercurial > projects > dwt-mac
comparison dwt/widgets/Tracker.d @ 90:c7f7f4d7091a
All widgets are ported
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 30 Dec 2008 18:54:31 +0100 |
parents | 102ff2adce19 |
children | 63a09873578e |
comparison
equal
deleted
inserted
replaced
89:8e3c85e1733d | 90:c7f7f4d7091a |
---|---|
35 import dwt.internal.cocoa.NSRect; | 35 import dwt.internal.cocoa.NSRect; |
36 import dwt.internal.cocoa.NSScreen; | 36 import dwt.internal.cocoa.NSScreen; |
37 import dwt.internal.cocoa.NSWindow; | 37 import dwt.internal.cocoa.NSWindow; |
38 import dwt.internal.cocoa.OS; | 38 import dwt.internal.cocoa.OS; |
39 | 39 |
40 import dwt.internal.c.Carbon; | 40 import Carbon = dwt.internal.c.Carbon; |
41 import dwt.internal.objc.cocoa.Cocoa; | 41 import dwt.internal.objc.cocoa.Cocoa; |
42 import dwt.widgets.Composite; | 42 import dwt.widgets.Composite; |
43 import dwt.widgets.Control; | 43 import dwt.widgets.Control; |
44 import dwt.widgets.Display; | 44 import dwt.widgets.Display; |
45 import dwt.widgets.Event; | 45 import dwt.widgets.Event; |
84 * The following values mirror step sizes on Windows | 84 * The following values mirror step sizes on Windows |
85 */ | 85 */ |
86 const static int STEPSIZE_SMALL = 1; | 86 const static int STEPSIZE_SMALL = 1; |
87 const static int STEPSIZE_LARGE = 9; | 87 const static int STEPSIZE_LARGE = 9; |
88 | 88 |
89 static this () | |
90 { | |
91 rectangles = new Rectangle [0]; | |
92 proportions = rectangles; | |
93 } | |
94 | |
95 /** | 89 /** |
96 * Constructs a new instance of this class given its parent | 90 * Constructs a new instance of this class given its parent |
97 * and a style value describing its behavior and appearance. | 91 * and a style value describing its behavior and appearance. |
98 * <p> | 92 * <p> |
99 * The style value is either one of the style constants defined in | 93 * The style value is either one of the style constants defined in |
123 * @see DWT#RESIZE | 117 * @see DWT#RESIZE |
124 * @see Widget#checkSubclass | 118 * @see Widget#checkSubclass |
125 * @see Widget#getStyle | 119 * @see Widget#getStyle |
126 */ | 120 */ |
127 public this (Composite parent, int style) { | 121 public this (Composite parent, int style) { |
122 rectangles = new Rectangle [0]; | |
123 proportions = rectangles; | |
124 | |
128 super (parent, checkStyle (style)); | 125 super (parent, checkStyle (style)); |
129 this.parent = parent; | 126 this.parent = parent; |
130 } | 127 } |
131 | 128 |
132 /** | 129 /** |
162 * @see DWT#RIGHT | 159 * @see DWT#RIGHT |
163 * @see DWT#UP | 160 * @see DWT#UP |
164 * @see DWT#DOWN | 161 * @see DWT#DOWN |
165 */ | 162 */ |
166 public this (Display display, int style) { | 163 public this (Display display, int style) { |
164 rectangles = new Rectangle [0]; | |
165 proportions = rectangles; | |
166 | |
167 if (display is null) display = Display.getCurrent (); | 167 if (display is null) display = Display.getCurrent (); |
168 if (display is null) display = Display.getDefault (); | 168 if (display is null) display = Display.getDefault (); |
169 if (!display.isValidThread ()) { | 169 if (!display.isValidThread ()) { |
170 error (DWT.ERROR_THREAD_INVALID_ACCESS); | 170 error (DWT.ERROR_THREAD_INVALID_ACCESS); |
171 } | 171 } |
740 checkWidget (); | 740 checkWidget (); |
741 cancelled = false; | 741 cancelled = false; |
742 tracking = true; | 742 tracking = true; |
743 window = cast(NSWindow)(new NSWindow()).alloc(); | 743 window = cast(NSWindow)(new NSWindow()).alloc(); |
744 NSArray screens = NSScreen.screens(); | 744 NSArray screens = NSScreen.screens(); |
745 CGFloat minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE; | 745 Carbon.CGFloat minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE; |
746 CGFloat minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE; | 746 Carbon.CGFloat minY = Float.MAX_VALUE, maxY = Float.MIN_VALUE; |
747 int count = cast(int)/*64*/screens.count(); | 747 int count = cast(int)/*64*/screens.count(); |
748 for (int i = 0; i < count; i++) { | 748 for (int i = 0; i < count; i++) { |
749 NSScreen screen = new NSScreen(screens.objectAtIndex(i)); | 749 NSScreen screen = new NSScreen(screens.objectAtIndex(i)); |
750 NSRect frame = screen.frame(); | 750 NSRect frame = screen.frame(); |
751 CGFloat x1 = frame.x, x2 = frame.x + frame.width; | 751 Carbon.CGFloat x1 = frame.x, x2 = frame.x + frame.width; |
752 CGFloat y1 = frame.y, y2 = frame.y + frame.height; | 752 Carbon.CGFloat y1 = frame.y, y2 = frame.y + frame.height; |
753 if (x1 < minX) minX = x1; | 753 if (x1 < minX) minX = x1; |
754 if (x2 < minX) minX = x2; | 754 if (x2 < minX) minX = x2; |
755 if (x1 > maxX) maxX = x1; | 755 if (x1 > maxX) maxX = x1; |
756 if (x2 > maxX) maxX = x2; | 756 if (x2 > maxX) maxX = x2; |
757 if (y1 < minY) minY = y1; | 757 if (y1 < minY) minY = y1; |