comparison dwt/widgets/Display.d @ 62:10eaa644646f

Ported dwt.widgets.Combo
author Jacob Carlborg <doob@me.com>
date Tue, 23 Dec 2008 22:21:02 +0100
parents c74ba20de292
children c7f7f4d7091a
comparison
equal deleted inserted replaced
61:c74ba20de292 62:10eaa644646f
213 int loopCounter = 0; 213 int loopCounter = 0;
214 bool idle; 214 bool idle;
215 static const short SWT_IDLE_TYPE = 1; 215 static const short SWT_IDLE_TYPE = 1;
216 216
217 int[] screenID; 217 int[] screenID;
218 NSPoint[] screenCascade; 218 NSPoint*[] screenCascade;
219 219
220 /* Menus */ 220 /* Menus */
221 // Menu menuBar; 221 // Menu menuBar;
222 // static final int ID_TEMPORARY = 1000; 222 // static final int ID_TEMPORARY = 1000;
223 // static final int ID_START = 1001; 223 // static final int ID_START = 1001;
557 NSDictionary dictionary = screen.deviceDescription(); 557 NSDictionary dictionary = screen.deviceDescription();
558 int screenNumber = (new NSNumber(dictionary.objectForKey(NSString.stringWith("NSScreenNumber")).id)).intValue(); 558 int screenNumber = (new NSNumber(dictionary.objectForKey(NSString.stringWith("NSScreenNumber")).id)).intValue();
559 int index = 0; 559 int index = 0;
560 while (screenID[index] !is 0 && screenID[index] !is screenNumber) index++; 560 while (screenID[index] !is 0 && screenID[index] !is screenNumber) index++;
561 screenID[index] = screenNumber; 561 screenID[index] = screenNumber;
562 NSPoint cascade = screenCascade[index]; 562 NSPoint* cascade = screenCascade[index];
563 //FIXME Jacob Carlborg 563 if (cascade is null) {
564 /*if (cascade is null) { 564 NSRect frame = screen.frame();
565 NSRect frame = screen.frame(); 565 cascade = &NSPoint();
566 cascade = NSPoint(); 566 cascade.x = frame.x;
567 cascade.x = frame.x; 567 cascade.y = frame.y + frame.height;
568 cascade.y = frame.y + frame.height; 568 }
569 }*/ 569 screenCascade[index] = &window.cascadeTopLeftFromPoint(*cascade);
570 screenCascade[index] = window.cascadeTopLeftFromPoint(cascade);
571 } 570 }
572 571
573 protected void checkDevice () { 572 protected void checkDevice () {
574 if (thread is null) error (DWT.ERROR_WIDGET_DISPOSED); 573 if (thread is null) error (DWT.ERROR_WIDGET_DISPOSED);
575 if (thread !is Thread.getThis ()) error (DWT.ERROR_THREAD_INVALID_ACCESS); 574 if (thread !is Thread.getThis ()) error (DWT.ERROR_THREAD_INVALID_ACCESS);
621 * @param data the device data 620 * @param data the device data
622 */ 621 */
623 public this (DeviceData data) { 622 public this (DeviceData data) {
624 super (data); 623 super (data);
625 screenID = new int[32]; 624 screenID = new int[32];
626 screenCascade = new NSPoint[32]; 625 screenCascade = new NSPoint*[32];
627 cursors = new Cursor [DWT.CURSOR_HAND + 1]; 626 cursors = new Cursor [DWT.CURSOR_HAND + 1];
628 timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init(); 627 timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init();
629 628
630 caretTimer = new class(currentCaret) Runnable { 629 caretTimer = new class(currentCaret) Runnable {
631 Caret currentCaret; 630 Caret currentCaret;
1768 */ 1767 */
1769 protected void init_ () { 1768 protected void init_ () {
1770 super.init_ (); 1769 super.init_ ();
1771 initClasses (); 1770 initClasses ();
1772 1771
1773 /*if (!isEmbedded) { 1772 if (!isEmbedded) {
1774 initApplicationDelegate(); 1773 initApplicationDelegate();
1775 application.finishLaunching(); 1774 application.finishLaunching();
1776 } 1775 }
1777 1776
1778 timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init(); 1777 timerDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init();
1779 1778
1780 NSTextView textView = cast(NSTextView)(new NSTextView()).alloc(); 1779 NSTextView textView = cast(NSTextView)(new NSTextView()).alloc();
1781 textView.initWithFrame (NSRect ()); 1780 textView.initWithFrame (NSRect ());
1782 markedAttributes = textView.markedTextAttributes (); 1781 markedAttributes = textView.markedTextAttributes ();
1783 markedAttributes.retain (); 1782 markedAttributes.retain ();
1784 textView.release ();*/ 1783 textView.release ();
1785 } 1784 }
1786 1785
1787 void initApplicationDelegate() { 1786 void initApplicationDelegate() {
1788 String className = "SWTApplicationDelegate"; 1787 String className = "SWTApplicationDelegate";
1789 if (OS.objc_lookUpClass (className) is null) { 1788 if (OS.objc_lookUpClass (className) is null) {