comparison dwt/widgets/Shell.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) 2000, 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.widgets.Shell; 14 module dwt.widgets.Shell;
15 15
16 import dwt.DWT; 16 import dwt.DWT;
17 import dwt.DWTException; 17 import dwt.DWTException;
19 import dwt.graphics.Cursor; 19 import dwt.graphics.Cursor;
20 import dwt.graphics.GC; 20 import dwt.graphics.GC;
21 import dwt.graphics.Point; 21 import dwt.graphics.Point;
22 import dwt.graphics.Rectangle; 22 import dwt.graphics.Rectangle;
23 import dwt.graphics.Region; 23 import dwt.graphics.Region;
24 import dwt.internal.cocoa.NSEvent; 24 import dwt.internal.Callback;
25 import dwt.internal.cocoa.NSApplication;
26 import dwt.internal.cocoa.NSBezierPath;
27 import dwt.internal.cocoa.NSColor;
28 import dwt.internal.cocoa.NSGraphicsContext;
25 import dwt.internal.cocoa.NSPoint; 29 import dwt.internal.cocoa.NSPoint;
26 import dwt.internal.cocoa.NSRect; 30 import dwt.internal.cocoa.NSRect;
31 import dwt.internal.cocoa.NSScreen;
27 import dwt.internal.cocoa.NSScrollView; 32 import dwt.internal.cocoa.NSScrollView;
28 import dwt.internal.cocoa.NSSize; 33 import dwt.internal.cocoa.NSSize;
29 import dwt.internal.cocoa.NSString; 34 import dwt.internal.cocoa.NSString;
30 import dwt.internal.cocoa.NSView; 35 import dwt.internal.cocoa.NSView;
31 import dwt.internal.cocoa.NSWindow; 36 import dwt.internal.cocoa.NSWindow;
32 import dwt.internal.cocoa.OS; 37 import dwt.internal.cocoa.OS;
33 import dwt.internal.cocoa.SWTWindow; 38 import dwt.internal.cocoa.SWTWindow;
34 import dwt.internal.cocoa.SWTWindowDelegate; 39 import dwt.internal.cocoa.SWTWindowDelegate;
40 import dwt.internal.cocoa.id;
35 41
36 import dwt.dwthelper.utils; 42 import dwt.dwthelper.utils;
37 import dwt.internal.cocoa.NSInteger; 43 import dwt.internal.cocoa.NSInteger;
38 import objc = dwt.internal.objc.runtime; 44 import objc = dwt.internal.objc.runtime;
39 import dwt.widgets.Composite; 45 import dwt.widgets.Composite;
142 * IMPORTANT: This class is not intended to be subclassed. 148 * IMPORTANT: This class is not intended to be subclassed.
143 * </p> 149 * </p>
144 * 150 *
145 * @see Decorations 151 * @see Decorations
146 * @see DWT 152 * @see DWT
153 * @see <a href="http://www.eclipse.org/swt/snippets/#shell">Shell snippets</a>
154 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample</a>
155 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
147 */ 156 */
148 public class Shell : Decorations { 157 public class Shell : Decorations {
149 NSWindow window; 158 NSWindow window;
150 SWTWindowDelegate windowDelegate; 159 SWTWindowDelegate windowDelegate;
160 NSBezierPath regionPath;
151 bool opened, moved, resized, fullScreen; 161 bool opened, moved, resized, fullScreen;
152 // bool resized, moved, drawing, reshape, update, deferDispose, active, disposed, opened, fullScreen; 162 // bool resized, moved, drawing, reshape, update, deferDispose, active, disposed, opened, fullScreen;
153 Control lastActive; 163 Control lastActive;
154 Region region;
155 Rectangle normalBounds; 164 Rectangle normalBounds;
156 165
157 static int DEFAULT_CLIENT_WIDTH = -1; 166 static int DEFAULT_CLIENT_WIDTH = -1;
158 static int DEFAULT_CLIENT_HEIGHT = -1; 167 static int DEFAULT_CLIENT_HEIGHT = -1;
159 168
379 */ 388 */
380 public this (Shell parent, int style) { 389 public this (Shell parent, int style) {
381 this (parent !is null ? parent.display : null, parent, style, null, false); 390 this (parent !is null ? parent.display : null, parent, style, null, false);
382 } 391 }
383 392
384 public static Shell internal_new (Display display, objc.id handle) { 393 /**
394 * Invokes platform specific functionality to allocate a new shell
395 * that is not embedded.
396 * <p>
397 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
398 * API for <code>Shell</code>. It is marked public only so that it
399 * can be shared within the packages provided by DWT. It is not
400 * available on all platforms, and should never be called from
401 * application code.
402 * </p>
403 *
404 * @param display the display for the shell
405 * @param handle the handle for the shell
406 * @return a new shell object containing the specified display and handle
407 *
408 * @since 3.3
409 */
385 return new Shell (display, null, DWT.NO_TRIM, handle, false); 410 return new Shell (display, null, DWT.NO_TRIM, handle, false);
411 }
412
413 /**
414 * Invokes platform specific functionality to allocate a new shell
415 * that is 'embedded'. In this case, the handle represents an NSView
416 * that acts as an embedded DWT Shell in an AWT Canvas.
417 * <p>
418 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
419 * API for <code>Shell</code>. It is marked public only so that it
420 * can be shared within the packages provided by DWT. It is not
421 * available on all platforms, and should never be called from
422 * application code.
423 * </p>
424 *
425 * @param display the display for the shell
426 * @param handle the handle for the shell
427 * @return a new shell object containing the specified display and handle
428 *
429 * @since 3.5
430 */
431 public static Shell cocoa_new (Display display, int /*long*/ handle) {
432 return new Shell (display, null, DWT.NO_TRIM, handle, true);
386 } 433 }
387 434
388 static int checkStyle (int style) { 435 static int checkStyle (int style) {
389 style = Decorations.checkStyle (style); 436 style = Decorations.checkStyle (style);
390 style &= ~DWT.TRANSPARENT; 437 style &= ~DWT.TRANSPARENT;
394 if ((style & DWT.APPLICATION_MODAL) !is 0) return bits | DWT.APPLICATION_MODAL; 441 if ((style & DWT.APPLICATION_MODAL) !is 0) return bits | DWT.APPLICATION_MODAL;
395 if ((style & DWT.PRIMARY_MODAL) !is 0) return bits | DWT.PRIMARY_MODAL; 442 if ((style & DWT.PRIMARY_MODAL) !is 0) return bits | DWT.PRIMARY_MODAL;
396 return bits; 443 return bits;
397 } 444 }
398 445
446 bool accessibilityIsIgnored(int /*long*/ id, int /*long*/ sel) {
447 // The content view of a shell is always ignored.
448 if (id is view.id) return true;
449 return super.accessibilityIsIgnored(id, sel);
450 }
451
399 /** 452 /**
400 * Adds the listener to the collection of listeners who will 453 * Adds the listener to the collection of listeners who will
401 * be notified when operations are performed on the receiver, 454 * be notified when operations are performed on the receiver,
402 * by sending the listener one of the messages defined in the 455 * by sending the listener one of the messages defined in the
403 * <code>ShellListener</code> interface. 456 * <code>ShellListener</code> interface.
433 } else { 486 } else {
434 setActive (); 487 setActive ();
435 } 488 }
436 } 489 }
437 490
491 bool canBecomeKeyWindow (int /*long*/ id, int /*long*/ sel) {
492 if (window.styleMask () is OS.NSBorderlessWindowMask) return true;
493 return super.canBecomeKeyWindow (id, sel);
494 }
495
438 void checkOpen () { 496 void checkOpen () {
439 if (!opened) resized = false; 497 if (!opened) resized = false;
498 }
499
500 void clearLevel() {
501 window.setLevel(0);
440 } 502 }
441 503
442 /** 504 /**
443 * Requests that the window manager close the receiver in 505 * Requests that the window manager close the receiver in
444 * the same way it would be closed when the user clicks on 506 * the same way it would be closed when the user clicks on
471 NSRect rect = NSRect (); 533 NSRect rect = NSRect ();
472 rect.x = trim.x; 534 rect.x = trim.x;
473 rect.y = trim.y; 535 rect.y = trim.y;
474 rect.width = trim.width; 536 rect.width = trim.width;
475 rect.height = trim.height; 537 rect.height = trim.height;
476 rect = NSWindow.static_frameRectForContentRect_styleMask_(rect, window.styleMask()); 538 NSWindow myWindow = (window !is null ? window : view.window());
477 return new Rectangle (cast(int)rect.x, cast(int)rect.y, cast(int)rect.width, cast(int)rect.height); 539 rect = myWindow.frameRectForContentRect(rect);
478 } 540 }
479 541
480 void createHandle () { 542 void createHandle () {
481 state |= CANVAS;// | GRAB | HIDDEN; 543 state |= HIDDEN;
482 if (window !is null) { 544 if (window is null) {
483 view = window.contentView(); 545 window = (NSWindow) new SWTWindow ().alloc ();
484 return;
485 } else {
486 SWTWindow swtWindow = cast(SWTWindow) (new SWTWindow ()).alloc ();
487 swtWindow.setTag(jniRef);
488 window = cast(NSWindow)swtWindow;
489 NSRect rect = NSRect();
490 dwt.widgets.Monitor.Monitor monitor = getMonitor ();
491 Rectangle clientArea = monitor.getClientArea ();
492 rect.width = clientArea.width * 5 / 8;
493 rect.height = clientArea.height * 5 / 8;
494 NSUInteger styleMask = NSBorderlessWindowMask; 546 NSUInteger styleMask = NSBorderlessWindowMask;
495 if ((style & DWT.NO_TRIM) is 0) { 547 if ((style & DWT.NO_TRIM) is 0) {
496 styleMask = OS.NSTitledWindowMask; 548 if ((style & DWT.TITLE) !is 0) styleMask |= OS.NSTitledWindowMask;
497 if ((style & DWT.CLOSE) !is 0) styleMask |= NSClosableWindowMask; 549 if ((style & DWT.CLOSE) !is 0) styleMask |= NSClosableWindowMask;
498 if ((style & DWT.MIN) !is 0) styleMask |= NSMiniaturizableWindowMask; 550 if ((style & DWT.MIN) !is 0) styleMask |= NSMiniaturizableWindowMask;
499 if ((style & DWT.MAX) !is 0) styleMask |= NSResizableWindowMask; 551 if ((style & DWT.MAX) !is 0) styleMask |= NSResizableWindowMask;
500 if ((style & DWT.RESIZE) !is 0) styleMask |= NSResizableWindowMask; 552 if ((style & DWT.RESIZE) !is 0) styleMask |= NSResizableWindowMask;
501 } 553 }
502 window = window.initWithContentRect_styleMask_backing_defer_(rect, styleMask, NSBackingStoreBuffered, false); 554 NSScreen screen = null;
503 display.cascade = window.cascadeTopLeftFromPoint(display.cascade); 555 NSScreen primaryScreen = new NSScreen(NSScreen.screens().objectAtIndex(0));
556 if (parent !is null) screen = parent.getShell().window.screen();
557 if (screen is null) screen = primaryScreen;
558 window = window.initWithContentRect(new NSRect(), styleMask, OS.NSBackingStoreBuffered, false, screen);
559 if ((style & (DWT.NO_TRIM | DWT.BORDER | DWT.SHELL_TRIM)) is 0) {
560 window.setHasShadow (true);
561 }
562 display.cascadeWindow(window, screen);
563 NSRect screenFrame = screen.frame();
564 float /*double*/ width = screenFrame.width * 5 / 8, height = screenFrame.height * 5 / 8;;
565 NSRect frame = window.frame();
566 NSRect primaryFrame = primaryScreen.frame();
567 frame.y = primaryFrame.height - ((primaryFrame.height - (frame.y + frame.height)) + height);
568 frame.width = width;
569 frame.height = height;
570 window.setFrame(frame, false);
504 if ((style & DWT.ON_TOP) !is 0) { 571 if ((style & DWT.ON_TOP) !is 0) {
505 window.setLevel(OS.NSFloatingWindowLevel); 572 window.setLevel(OS.NSStatusWindowLevel);
506 } 573 }
507 } 574 super.createHandle ();
508 575 topView ().setHidden (true);
509 (cast(Composite)this).createHandle (null); 576 } else {
510 577 // OS.object_setClass (window.id, OS.objc_getClass("SWTWindow"));
511 window.setContentView (topView()); 578 state &= ~HIDDEN;
512 windowDelegate = cast(SWTWindowDelegate)(new SWTWindowDelegate()).alloc().init(); 579 //TODO - get the content of the foreign window instead of creating it
513 windowDelegate.setTag(jniRef); 580 super.createHandle ();
581 style |= DWT.NO_BACKGROUND;
582 }
583 window.setAcceptsMouseMovedEvents(true);
584 windowDelegate = (SWTWindowDelegate)new SWTWindowDelegate().alloc().init();
514 window.setDelegate(windowDelegate); 585 window.setDelegate(windowDelegate);
586 window.disableCursorRects();
587 id id = window.fieldEditor (true, null);
588 if (id !is null) {
589 OS.object_setClass (id.id, OS.objc_getClass ("SWTEditorView"));
590 }
591 }
592
593 /*
594 * Feature in Cocoa. An NSWindow that is the child window of another NSWindow
595 * will track the movement of its parent window. The work around is to adjust
596 * the window's level.
597 */
598 void fixLevel() {
599 Shell topShell = this;
600 while (topShell.parent !is null) {
601 if (topShell.parent !is null) topShell = (Shell) topShell.parent;
602 }
603 Shell[] shells = display.getShells ();
604 for (int i = 0; i < shells.length; i++) {
605 Shell shell = shells [i];
606 if ((shell.style & DWT.ON_TOP) is 0) {
607 int level = 0;
608 Shell pShell = shell;
609 while (pShell.parent !is null) {
610 pShell = (Shell) pShell.parent;
611 level++;
612 }
613 int newLevel = pShell is topShell ? level : 0;
614 newLevel = Math.min (newLevel, OS.NSModalPanelWindowLevel - 1);
615 shell.window.setLevel (newLevel);
616 }
617 }
618 }
619
620 void deregister () {
621 super.deregister ();
622 if (window !is null) display.removeWidget (window);
623 if (windowDelegate !is null) display.removeWidget (windowDelegate);
515 } 624 }
516 625
517 void destroyWidget () { 626 void destroyWidget () {
518 NSWindow window = this.window; 627 NSWindow window = this.window;
628 Display display = this.display;
519 releaseHandle (); 629 releaseHandle ();
520 if (window !is null) window.close(); 630 if (window !is null) {
631 window.close();
632 }
633 //If another shell is not going to become active, clear the menu bar.
634 if (!display.isDisposed () && display.getShells ().length is 0) {
635 display.setMenuBar (null);
636 }
637 }
638
639 void drawWidget (int /*long*/ id, NSRect rect) {
640 if (regionPath !is null && background is null) {
641 NSGraphicsContext context = NSGraphicsContext.currentContext();
642 context.saveGraphicsState();
643 NSColor.windowBackgroundColor().setFill();
644 NSBezierPath.fillRect(rect);
645 context.restoreGraphicsState();
646 }
647 super.drawWidget (id, rect);
521 } 648 }
522 649
523 Control findBackgroundControl () { 650 Control findBackgroundControl () {
524 return background !is null || backgroundImage !is null ? this : null; 651 return background !is null || backgroundImage !is null ? this : null;
525 } 652 }
532 return cursor; 659 return cursor;
533 } 660 }
534 661
535 void fixShell (Shell newShell, Control control) { 662 void fixShell (Shell newShell, Control control) {
536 if (this is newShell) return; 663 if (this is newShell) return;
537 // if (control is lastActive) setActiveControl (null); 664 if (control is lastActive) setActiveControl (null);
538 }
539
540 void flagsChanged(objc.id theEvent) {
541 Display display = this.display;
542 NSEvent nsEvent = new NSEvent(theEvent);
543 NSUInteger modifiers = nsEvent.modifierFlags();
544 int lastModifiers = display.lastModifiers;
545 // int chord = OS.GetCurrentEventButtonState ();
546 int type = DWT.KeyUp;
547 if ((modifiers & OS.NSAlphaShiftKeyMask) !is 0 && (lastModifiers & OS.NSAlphaShiftKeyMask) is 0) type = DWT.KeyDown;
548 if ((modifiers & OS.NSAlternateKeyMask) !is 0 && (lastModifiers & OS.NSAlternateKeyMask) is 0) type = DWT.KeyDown;
549 if ((modifiers & OS.NSShiftKeyMask) !is 0 && (lastModifiers & OS.NSShiftKeyMask) is 0) type = DWT.KeyDown;
550 if ((modifiers & OS.NSControlKeyMask) !is 0 && (lastModifiers & OS.NSControlKeyMask) is 0) type = DWT.KeyDown;
551 if ((modifiers & OS.NSCommandKeyMask) !is 0 && (lastModifiers & OS.NSCommandKeyMask) is 0) type = DWT.KeyDown;
552 Control target = display.getFocusControl();
553 if (type is DWT.KeyUp && (modifiers & OS.NSAlphaShiftKeyMask) is 0 && (lastModifiers & OS.NSAlphaShiftKeyMask) !is 0) {
554 if (target !is null) {
555 Event event = new Event ();
556 event.keyCode = DWT.CAPS_LOCK;
557 // setInputState (event, DWT.KeyDown, chord, modifiers);
558 (cast(Widget)target).sendKeyEvent (DWT.KeyDown, event);
559 }
560 }
561 Event event = new Event ();
562 // setInputState (event, type, chord, modifiers);
563 if (event.keyCode is 0 && event.character is 0) return;
564 bool result = (cast(Widget)this).sendKeyEvent (type, event);
565 if (type is DWT.KeyDown && (modifiers & OS.NSAlphaShiftKeyMask) !is 0 && (lastModifiers & OS.NSAlphaShiftKeyMask) is 0) {
566 if (target !is null) {
567 event = new Event ();
568 event.keyCode = DWT.CAPS_LOCK;
569 // setInputState (event, DWT.KeyUp, chord, modifiers);
570 (cast(Widget)target).sendKeyEvent (DWT.KeyUp, event);
571 }
572 }
573 display.lastModifiers = modifiers;
574 } 665 }
575 666
576 /** 667 /**
577 * If the receiver is visible, moves it to the top of the 668 * If the receiver is visible, moves it to the top of the
578 * drawing order for the display on which it was created 669 * drawing order for the display on which it was created
594 * @see Shell#open 685 * @see Shell#open
595 * @see Shell#setActive 686 * @see Shell#setActive
596 */ 687 */
597 public void forceActive () { 688 public void forceActive () {
598 checkWidget (); 689 checkWidget ();
599 if (!isVisible ()) return; 690 if (!isVisible()) return;
600 // OS.SelectWindow (shellHandle); 691 if (window is null) return;
601 // OS.SetFrontProcessWithOptions (new int [] {0, OS.kCurrentProcess}, OS.kSetFrontProcessFrontWindowOnly); 692 window.makeKeyAndOrderFront (null);
602 } 693 NSApplication application = NSApplication.sharedApplication ();
603 694 application.activateIgnoringOtherApps (true);
695 }
696
697 /**
698 * Returns the receiver's alpha value. The alpha value
699 * is between 0 (transparent) and 255 (opaque).
700 *
701 * @return the alpha value
702 *
703 * @exception DWTException <ul>
704 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
705 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
706 * </ul>
707 *
708 * @since 3.4
709 */
604 public int getAlpha () { 710 public int getAlpha () {
605 checkWidget (); 711 checkWidget ();
606 return cast(int)(window.alphaValue() * 255); 712 // TODO: Should we support embedded frame alpha?
713 if (window is null) return 255;
607 } 714 }
608 715
609 public Rectangle getBounds () { 716 public Rectangle getBounds () {
610 checkWidget(); 717 checkWidget();
611 NSRect frame = window.frame (); 718 NSRect frame = (window is null ? view.frame() : window.frame());
612 return new Rectangle (cast(int)frame.x, cast(int) frame.y, cast(int) frame.width, cast(int) frame.height); 719 GCFloat y = display.getPrimaryFrame().height - cast(int)(frame.y + frame.height);
720 return new Rectangle (cast(int)frame.x, cast(int)y, cast(int)frame.width, cast(int)frame.height);
613 } 721 }
614 722
615 public Rectangle getClientArea () { 723 public Rectangle getClientArea () {
616 checkWidget(); 724 checkWidget();
617 //TODO why super implementation fails 725 //TODO why super implementation fails
618 NSRect rect = window.contentRectForFrameRect_(window.frame()); 726 if (window is null) {
619 int width = cast(int)rect.width, height = cast(int)rect.height; 727 // In embedded frames, the whole view is the client area.
728 NSRect rect = view.frame();
729 int width = (int)rect.width, height = (int)rect.height;
730 return new Rectangle (0, 0, width, height);
731 }
732
733 NSRect rect = window.contentRectForFrameRect(window.frame());
620 if (scrollView !is null) { 734 if (scrollView !is null) {
621 NSSize size = NSSize(); 735 NSSize size = NSSize();
622 size.width = width; 736 size.width = width;
623 size.height = height; 737 size.height = height;
624 size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, NSNoBorder); 738 size = NSScrollView.contentSizeForFrameSize(size, (style & DWT.H_SCROLL) !is 0, (style & DWT.V_SCROLL) !is 0, NSNoBorder);
626 height = cast(int)size.height; 740 height = cast(int)size.height;
627 } 741 }
628 return new Rectangle (0, 0, width, height); 742 return new Rectangle (0, 0, width, height);
629 } 743 }
630 744
631 int getDrawCount (int control) { 745 NSBezierPath getClipping() {
632 if (!isTrimHandle (control)) return drawCount; 746 return regionPath;
633 return 0; 747 }
634 } 748
635 749 /**
750 * Returns <code>true</code> if the receiver is currently
751 * in fullscreen state, and false otherwise.
752 * <p>
753 *
754 * @return the fullscreen state
755 *
756 * @exception DWTException <ul>
757 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
758 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
759 * </ul>
760 *
761 * @since 3.4
762 */
636 public bool getFullScreen () { 763 public bool getFullScreen () {
637 checkWidget(); 764 checkWidget();
638 return fullScreen; 765 return fullScreen;
639 } 766 }
640 767
660 return DWT.NONE; 787 return DWT.NONE;
661 } 788 }
662 789
663 public Point getLocation () { 790 public Point getLocation () {
664 checkWidget(); 791 checkWidget();
665 NSRect frame = window.frame (); 792 // TODO: frame is relative to superview. What does getLocation mean in the embedded case?
666 return new Point (cast(int) frame.x, cast(int) frame.y); 793 NSRect frame = (window !is null ? window.frame() : view.frame());
794 float /*double*/ y = display.getPrimaryFrame().height - (int)(frame.y + frame.height);
795 return new Point ((int)frame.x, (int)y);
667 } 796 }
668 797
669 public bool getMaximized () { 798 public bool getMaximized () {
670 checkWidget(); 799 checkWidget();
671 //NOT DONE 800 //NOT DONE
672 return !fullScreen && super.getMaximized (); 801 return !fullScreen && super.getMaximized ();
802 }
803
804 Shell getModalShell () {
805 Shell shell = null;
806 Shell [] modalShells = display.modalShells;
807 if (modalShells !is null) {
808 int bits = DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL;
809 int index = modalShells.length;
810 while (--index >= 0) {
811 Shell modal = modalShells [index];
812 if (modal !is null) {
813 if ((modal.style & bits) !is 0) {
814 Control control = this;
815 while (control !is null) {
816 if (control is modal) break;
817 control = control.parent;
818 }
819 if (control !is modal) return modal;
820 break;
821 }
822 if ((modal.style & DWT.PRIMARY_MODAL) !is 0) {
823 if (shell is null) shell = getShell ();
824 if (modal.parent is shell) return modal;
825 }
826 }
827 }
828 }
829 return null;
673 } 830 }
674 831
675 public bool getMinimized () { 832 public bool getMinimized () {
676 checkWidget(); 833 checkWidget();
677 if (!getVisible ()) return super.getMinimized (); 834 if (!getVisible ()) return super.getMinimized ();
771 return result; 928 return result;
772 } 929 }
773 930
774 public Point getSize () { 931 public Point getSize () {
775 checkWidget(); 932 checkWidget();
776 NSRect frame = window.frame (); 933 NSRect frame = (window !is null ? window.frame() : view.frame());
777 return new Point (cast(int) frame.width, cast(int) frame.height); 934 return new Point (cast(int) frame.width, cast(int) frame.height);
935 }
936
937 float getThemeAlpha () {
938 return 1;
778 } 939 }
779 940
780 bool hasBorder () { 941 bool hasBorder () {
781 return false; 942 return false;
782 } 943 }
783 944
784 void helpRequested(int theEvent) { 945 void helpRequested(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
785 Control control = display.getFocusControl(); 946 Control control = display.getFocusControl();
786 while (control !is null) { 947 while (control !is null) {
787 if (control.hooks (DWT.Help)) { 948 if (control.hooks (DWT.Help)) {
788 control.postEvent (DWT.Help); 949 control.postEvent (DWT.Help);
789 break; 950 break;
804 public bool isVisible () { 965 public bool isVisible () {
805 checkWidget(); 966 checkWidget();
806 return getVisible (); 967 return getVisible ();
807 } 968 }
808 969
970 bool makeFirstResponder (int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
971 if (display.focusControl is null) display.focusControl = display.getFocusControl ();
972 bool result = super.makeFirstResponder(id, sel, notification);
973 if (result) {
974 Control newFocus = display.getFocusControl ();
975 if (newFocus !is null && newFocus !is display.focusControl) {
976 Control oldFocus = display.focusControl;
977 display.focusControl = newFocus;
978 if (oldFocus !is null && !oldFocus.isDisposed ()) oldFocus.sendFocusEvent (DWT.FocusOut, false);
979 if (newFocus !is null && !newFocus.isDisposed ()) newFocus.sendFocusEvent (DWT.FocusIn, false);
980 }
981 }
982 return result;
983 }
984
809 /** 985 /**
810 * Moves the receiver to the top of the drawing order for 986 * Moves the receiver to the top of the drawing order for
811 * the display on which it was created (so that all other 987 * the display on which it was created (so that all other
812 * shells on that display, which are not the receiver's 988 * shells on that display, which are not the receiver's
813 * children will be drawn behind it), marks it visible, 989 * children will be drawn behind it), marks it visible,
827 * @see Shell#setActive 1003 * @see Shell#setActive
828 * @see Shell#forceActive 1004 * @see Shell#forceActive
829 */ 1005 */
830 public void open () { 1006 public void open () {
831 checkWidget(); 1007 checkWidget();
1008 int mask = DWT.PRIMARY_MODAL | DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL;
1009 if ((style & mask) !is 0) {
1010 display.setModalShell (this);
1011 } else {
1012 updateModal ();
1013 }
832 setWindowVisible (true, true); 1014 setWindowVisible (true, true);
833 if (isDisposed ()) return; 1015 if (isDisposed ()) return;
834 // if (active) { 1016 // if (active) {
835 if (!restoreFocus () && !traverseGroup (true)) setFocus (); 1017 if (!restoreFocus () && !traverseGroup (true)) setFocus ();
836 // } 1018 // }
854 // } 1036 // }
855 // return true; 1037 // return true;
856 return false; 1038 return false;
857 } 1039 }
858 1040
1041 void register () {
1042 super.register ();
1043 if (window !is null) display.addWidget (window, this);
1044 if (windowDelegate !is null) display.addWidget (windowDelegate, this);
1045 }
1046
859 void releaseChildren (bool destroy) { 1047 void releaseChildren (bool destroy) {
860 Shell [] shells = getShells (); 1048 Shell [] shells = getShells ();
861 for (int i=0; i<shells.length; i++) { 1049 for (int i=0; i<shells.length; i++) {
862 Shell shell = shells [i]; 1050 Shell shell = shells [i];
863 if (shell !is null && !shell.isDisposed ()) { 1051 if (shell !is null && !shell.isDisposed ()) {
866 } 1054 }
867 super.releaseChildren (destroy); 1055 super.releaseChildren (destroy);
868 } 1056 }
869 1057
870 void releaseHandle () { 1058 void releaseHandle () {
871 window.setDelegate(null); 1059 if (window !is null) window.setDelegate(null);
872 if (windowDelegate !is null) windowDelegate.release(); 1060 if (windowDelegate !is null) windowDelegate.release();
873 windowDelegate = null; 1061 windowDelegate = null;
874 super.releaseHandle (); 1062 super.releaseHandle ();
875 window = null; 1063 window = null;
876 } 1064 }
879 /* Do nothing */ 1067 /* Do nothing */
880 } 1068 }
881 1069
882 void releaseWidget () { 1070 void releaseWidget () {
883 super.releaseWidget (); 1071 super.releaseWidget ();
1072 display.clearModal (this);
884 // disposed = true; 1073 // disposed = true;
885 lastActive = null; 1074 lastActive = null;
1075 if (regionPath !is null) regionPath.release();
1076 regionPath = null;
886 } 1077 }
887 1078
888 /** 1079 /**
889 * Removes the listener from the collection of listeners who will 1080 * Removes the listener from the collection of listeners who will
890 * be notified when operations are performed on the receiver. 1081 * be notified when operations are performed on the receiver.
933 * @see Decorations#setDefaultButton(Button) 1124 * @see Decorations#setDefaultButton(Button)
934 * @see Shell#open 1125 * @see Shell#open
935 * @see Shell#setActive 1126 * @see Shell#setActive
936 */ 1127 */
937 public void setActive () { 1128 public void setActive () {
1129 if (window is null) return;
938 checkWidget (); 1130 checkWidget ();
939 if (!isVisible ()) return; 1131 if (!isVisible()) return;
940 // OS.SelectWindow (shellHandle); 1132 window.makeKeyAndOrderFront (null);
941 } 1133 }
942 1134
943 void setActiveControl (Control control) { 1135 void setActiveControl (Control control) {
944 if (control !is null && control.isDisposed ()) control = null; 1136 if (control !is null && control.isDisposed ()) control = null;
945 if (lastActive !is null && lastActive.isDisposed ()) lastActive = null; 1137 if (lastActive !is null && lastActive.isDisposed ()) lastActive = null;
975 activate [i].sendEvent (DWT.Activate); 1167 activate [i].sendEvent (DWT.Activate);
976 } 1168 }
977 } 1169 }
978 } 1170 }
979 1171
1172 /**
1173 * Sets the receiver's alpha value which must be
1174 * between 0 (transparent) and 255 (opaque).
1175 * <p>
1176 * This operation requires the operating system's advanced
1177 * widgets subsystem which may not be available on some
1178 * platforms.
1179 * </p>
1180 * @param alpha the alpha value
1181 *
1182 * @exception DWTException <ul>
1183 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1184 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1185 * </ul>
1186 *
1187 * @since 3.4
1188 */
980 public void setAlpha (int alpha) { 1189 public void setAlpha (int alpha) {
1190 if (window is null) return;
981 checkWidget (); 1191 checkWidget ();
982 alpha &= 0xFF; 1192 alpha &= 0xFF;
983 window.setAlphaValue (alpha / 255f); 1193 window.setAlphaValue (alpha / 255f);
984 } 1194 }
985 1195
986 int setBounds (int x, int y, int width, int height, bool move, bool resize) { 1196 void setBounds (int x, int y, int width, int height, bool move, bool resize) {
987 // if (fullScreen) setFullScreen (false); 1197 // Embedded Shells are not resizable.
988 if (move && resize) { 1198 if (window is null) return;
989 NSRect rect = NSRect (); 1199 if (fullScreen) setFullScreen (false);
990 rect.x = x; 1200 int screenHeight = (int) display.getPrimaryFrame().height;
991 //TODO - get the screen for the point 1201 NSRect frame = window.frame();
992 int screenHeight = cast(int) window.screen().frame().height; 1202 if (!move) {
993 rect.y = screenHeight - y; 1203 x = (int)frame.x;
994 rect.width = width; 1204 y = screenHeight - (int)(frame.y + frame.height);
995 rect.height = height; 1205 }
996 window.setFrame_display_(rect, false); 1206 if (!resize) {
997 } else { 1207 width = (int)frame.width;
998 if (move) { 1208 height = (int)frame.height;
999 NSPoint point = NSPoint(); 1209 }
1000 point.x = x; 1210 frame.x = x;
1001 //TODO - get the screen for the point 1211 frame.y = screenHeight - (int)(y + height);
1002 int screenHeight = cast(int) window.screen().frame().height; 1212 frame.width = width;
1003 point.y = screenHeight - y; 1213 frame.height = height;
1004 window.setFrameTopLeftPoint (point); 1214 window.setFrame(frame, false);
1005 } else {
1006 if (resize) {
1007 NSRect rect = window.frame();
1008 rect.width = width;
1009 rect.height = height;
1010 window.setFrame_display_(rect, false);
1011 }
1012 }
1013 }
1014 return 0;
1015 } 1215 }
1016 1216
1017 public void setEnabled (bool enabled) { 1217 public void setEnabled (bool enabled) {
1018 checkWidget(); 1218 checkWidget();
1019 if (((state & DISABLED) is 0) is enabled) return; 1219 if (((state & DISABLED) is 0) is enabled) return;
1021 // if (enabled && OS.IsWindowActive (shellHandle)) { 1221 // if (enabled && OS.IsWindowActive (shellHandle)) {
1022 // if (!restoreFocus ()) traverseGroup (false); 1222 // if (!restoreFocus ()) traverseGroup (false);
1023 // } 1223 // }
1024 } 1224 }
1025 1225
1226 /**
1227 * Sets the full screen state of the receiver.
1228 * If the argument is <code>true</code> causes the receiver
1229 * to switch to the full screen state, and if the argument is
1230 * <code>false</code> and the receiver was previously switched
1231 * into full screen state, causes the receiver to switch back
1232 * to either the maximmized or normal states.
1233 * <p>
1234 * Note: The result of intermixing calls to <code>setFullScreen(true)</code>,
1235 * <code>setMaximized(true)</code> and <code>setMinimized(true)</code> will
1236 * vary by platform. Typically, the behavior will match the platform user's
1237 * expectations, but not always. This should be avoided if possible.
1238 * </p>
1239 *
1240 * @param fullScreen the new fullscreen state
1241 *
1242 * @exception DWTException <ul>
1243 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1244 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1245 * </ul>
1246 *
1247 * @since 3.4
1248 */
1026 public void setFullScreen (bool fullScreen) { 1249 public void setFullScreen (bool fullScreen) {
1027 checkWidget (); 1250 checkWidget ();
1028 this.fullScreen = fullScreen; 1251 this.fullScreen = fullScreen;
1029 // if (fullScreen) { 1252 // if (fullScreen) {
1030 // normalBounds = getBounds (); 1253 // normalBounds = getBounds ();
1202 * 1425 *
1203 */ 1426 */
1204 public void setRegion (Region region) { 1427 public void setRegion (Region region) {
1205 checkWidget (); 1428 checkWidget ();
1206 if ((style & DWT.NO_TRIM) is 0) return; 1429 if ((style & DWT.NO_TRIM) is 0) return;
1430 if (window is null) return;
1207 if (region !is null && region.isDisposed()) error (DWT.ERROR_INVALID_ARGUMENT); 1431 if (region !is null && region.isDisposed()) error (DWT.ERROR_INVALID_ARGUMENT);
1208 // if (region is null) { 1432 this.region = region;
1209 // rgnRect = null; 1433 if (regionPath !is null) regionPath.release();
1210 // } else { 1434 regionPath = getPath(region);
1211 // if (rgnRect is null) { 1435 if (region !is null) {
1212 // rgnRect = new Rect (); 1436 window.setBackgroundColor(NSColor.clearColor());
1213 // OS.GetWindowBounds (shellHandle, cast(short) OS.kWindowStructureRgn, rgnRect); 1437 window.setOpaque(false);
1214 // OS.SetRect (rgnRect, cast(short) 0, cast(short) 0, cast(short) (rgnRect.right - rgnRect.left), cast(short) (rgnRect.bottom - rgnRect.top)); 1438 } else {
1215 // } 1439 window.setBackgroundColor(NSColor.windowBackgroundColor());
1216 // } 1440 window.setOpaque(true);
1217 // this.region = region; 1441 }
1218 // /* 1442 window.contentView().setNeedsDisplay(true);
1219 // * Bug in the Macintosh. Calling ReshapeCustomWindow() from a 1443 }
1220 // * kEventWindowDrawContent handler originating from ShowWindow() 1444
1221 // * will deadlock. The fix is to detected this case and only call 1445 NSBezierPath getPath(Region region) {
1222 // * ReshapeCustomWindow() after the default handler is done. 1446 if (region is null) return null;
1223 // */ 1447 Callback callback = new Callback(this, "regionToRects", 4);
1224 // if (drawing) { 1448 if (callback.getAddress() is 0) DWT.error(DWT.ERROR_NO_MORE_CALLBACKS);
1225 // reshape = true; 1449 NSBezierPath path = NSBezierPath.bezierPath();
1226 // } else { 1450 path.retain();
1227 // OS.ReshapeCustomWindow (shellHandle); 1451 OS.QDRegionToRects(region.handle, OS.kQDParseRegionFromTopLeft, callback.getAddress(), path.id);
1228 // redrawWidget (handle, true); 1452 callback.dispose();
1229 // } 1453 if (path.isEmpty()) path.appendBezierPathWithRect(new NSRect());
1454 return path;
1455 }
1456
1457 int /*long*/ regionToRects(int /*long*/ message, int /*long*/ rgn, int /*long*/ r, int /*long*/ path) {
1458 NSPoint pt = new NSPoint();
1459 short[] rect = new short[4];
1460 if (message is OS.kQDRegionToRectsMsgParse) {
1461 OS.memmove(rect, r, rect.length * 2);
1462 pt.x = rect[1];
1463 pt.y = rect[0];
1464 OS.objc_msgSend(path, OS.sel_moveToPoint_, pt);
1465 pt.x = rect[3];
1466 OS.objc_msgSend(path, OS.sel_lineToPoint_, pt);
1467 pt.x = rect[3];
1468 pt.y = rect[2];
1469 OS.objc_msgSend(path, OS.sel_lineToPoint_, pt);
1470 pt.x = rect[1];
1471 OS.objc_msgSend(path, OS.sel_lineToPoint_, pt);
1472 OS.objc_msgSend(path, OS.sel_closePath);
1473 }
1474 return 0;
1230 } 1475 }
1231 1476
1232 public void setText (String str) { 1477 public void setText (String str) {
1233 checkWidget(); 1478 checkWidget();
1234 if (str is null) error (DWT.ERROR_NULL_ARGUMENT); 1479 if (str is null) error (DWT.ERROR_NULL_ARGUMENT);
1235 super.setText (str); 1480 if (window is null) return;
1236 NSString nsStr = NSString.stringWith(str); 1481 NSString nsStr = NSString.stringWith(str);
1237 window.setTitle(nsStr); 1482 window.setTitle(nsStr);
1238 // str.release();
1239 } 1483 }
1240 1484
1241 public void setVisible (bool visible) { 1485 public void setVisible (bool visible) {
1242 checkWidget(); 1486 checkWidget();
1243 setWindowVisible (visible, false); 1487 int mask = DWT.PRIMARY_MODAL | DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL;
1488 if ((style & mask) !is 0) {
1489 if (visible) {
1490 display.setModalShell (this);
1491 } else {
1492 display.clearModal (this);
1493 }
1494 } else {
1495 updateModal ();
1496 }
1497 if (window is null) {
1498 super.setVisible(visible);
1499 } else {
1500 setWindowVisible (visible, false);
1501 }
1244 } 1502 }
1245 1503
1246 void setWindowVisible (bool visible, bool key) { 1504 void setWindowVisible (bool visible, bool key) {
1247 if (window.isVisible() is visible) return; 1505 if (visible) {
1506 if ((state & HIDDEN) is 0) return;
1507 state &= ~HIDDEN;
1508 } else {
1509 if ((state & HIDDEN) !is 0) return;
1510 state |= HIDDEN;
1511 }
1512 if (window !is null && (window.isVisible() is visible)) return;
1248 if (visible) { 1513 if (visible) {
1249 sendEvent (DWT.Show); 1514 sendEvent (DWT.Show);
1250 if (isDisposed ()) return; 1515 if (isDisposed ()) return;
1516 topView ().setHidden (false);
1251 if (key) { 1517 if (key) {
1252 window.makeKeyAndOrderFront (null); 1518 window.makeKeyAndOrderFront (null);
1253 } else { 1519 } else {
1254 window.orderFront (null); 1520 window.orderFront (null);
1255 } 1521 }
1268 updateLayout (false); 1534 updateLayout (false);
1269 } 1535 }
1270 } 1536 }
1271 } else { 1537 } else {
1272 window.orderOut (null); 1538 window.orderOut (null);
1539 topView ().setHidden (true);
1273 sendEvent (DWT.Hide); 1540 sendEvent (DWT.Hide);
1274 } 1541 }
1275 } 1542 }
1276 1543
1277 void setZOrder () { 1544 void setZOrder () {
1278 // if (scrolledHandle !is 0) OS.HIViewAddSubview (scrolledHandle, handle); 1545 if (scrollView !is null) scrollView.setDocumentView (view);
1546 if (window is null) return;
1547 window.setContentView (scrollView !is null ? scrollView : view);
1279 } 1548 }
1280 1549
1281 void setZOrder (Control control, bool above) { 1550 void setZOrder (Control control, bool above) {
1282 // if (above) { 1551 // if (above) {
1283 // //NOT DONE - move one window above another 1552 // //NOT DONE - move one window above another
1291 bool traverseEscape () { 1560 bool traverseEscape () {
1292 if (parent is null) return false; 1561 if (parent is null) return false;
1293 if (!isVisible () || !isEnabled ()) return false; 1562 if (!isVisible () || !isEnabled ()) return false;
1294 close (); 1563 close ();
1295 return true; 1564 return true;
1565 }
1566
1567 void updateModal () {
1568 // do nothing
1296 } 1569 }
1297 1570
1298 void updateSystemUIMode () { 1571 void updateSystemUIMode () {
1299 if (!getMonitor ().equals (display.getPrimaryMonitor ())) return; 1572 if (!getMonitor ().equals (display.getPrimaryMonitor ())) return;
1300 bool isActive = false; 1573 bool isActive = false;
1317 // } else { 1590 // } else {
1318 // OS.SetSystemUIMode (OS.kUIModeNormal, 0); 1591 // OS.SetSystemUIMode (OS.kUIModeNormal, 0);
1319 // } 1592 // }
1320 } 1593 }
1321 1594
1322 void windowDidBecomeKey(int notification) { 1595 void windowDidBecomeKey(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1323 super.windowDidBecomeKey(notification); 1596 super.windowDidBecomeKey(id, sel, notification);
1324 Display display = this.display; 1597 Display display = this.display;
1325 display.setMenuBar (menuBar); 1598 display.setMenuBar (menuBar);
1326 sendEvent (DWT.Activate); 1599 sendEvent (DWT.Activate);
1600 fixLevel();
1327 // if (!isDisposed ()) { 1601 // if (!isDisposed ()) {
1328 // if (!restoreFocus () && !traverseGroup (true)) setFocus (); 1602 // if (!restoreFocus () && !traverseGroup (true)) setFocus ();
1329 // } 1603 // }
1330 } 1604 }
1331 1605
1332 void windowDidMove(int notification) { 1606 void windowDidMove(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1333 moved = true; 1607 moved = true;
1334 sendEvent(DWT.Move); 1608 sendEvent(DWT.Move);
1335 } 1609 }
1336 1610
1337 void windowDidResize(int notification) { 1611 void windowDidResize(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1338 resized = true; 1612 resized = true;
1339 sendEvent (DWT.Resize); 1613 sendEvent (DWT.Resize);
1340 if (isDisposed ()) return; 1614 if (isDisposed ()) return;
1341 if (layout_ !is null) { 1615 if (layout_ !is null) {
1342 markLayout (false, false); 1616 markLayout (false, false);
1343 updateLayout (false); 1617 updateLayout (false);
1344 } 1618 }
1345 } 1619 }
1346 1620
1347 void windowDidResignKey(int notification) { 1621 void windowDidResignKey(int /*long*/ id, int /*long*/ sel, int /*long*/ notification) {
1348 super.windowDidResignKey(notification); 1622 super.windowDidResignKey(id, sel, notification);
1349 Display display = this.display; 1623 // Display display = this.display;
1350 sendEvent (DWT.Deactivate); 1624 sendEvent (DWT.Deactivate);
1351 if (isDisposed ()) return; 1625 if (isDisposed ()) return;
1352 // saveFocus (); 1626 // saveFocus ();
1353 // if (savedFocus !is null) { 1627 // if (savedFocus !is null) {
1354 // /* 1628 // /*
1360 // display.ignoreFocus = true; 1634 // display.ignoreFocus = true;
1361 // OS.ClearKeyboardFocus (shellHandle); 1635 // OS.ClearKeyboardFocus (shellHandle);
1362 // display.ignoreFocus = false; 1636 // display.ignoreFocus = false;
1363 // if (!savedFocus.isDisposed ()) savedFocus.sendFocusEvent (DWT.FocusOut, false); 1637 // if (!savedFocus.isDisposed ()) savedFocus.sendFocusEvent (DWT.FocusOut, false);
1364 // } 1638 // }
1365 display.setMenuBar (null); 1639 }
1366 } 1640
1367 1641 bool windowShouldClose(int /*long*/ id, int /*long*/ sel, int /*long*/ window) {
1368 bool windowShouldClose(int window) {
1369 closeWidget (); 1642 closeWidget ();
1370 return false; 1643 return false;
1371 } 1644 }
1372 1645
1373 void windowWillClose(int notification) { 1646 }
1374 }
1375
1376 void windowSendEvent(objc.id ID, objc.id event) {
1377 NSEvent nsEvent = new NSEvent(event);
1378 NSEventType type = nsEvent.type();
1379 if (type is OS.NSKeyDown || type is OS.NSKeyUp) {
1380 Control eventTarget = display.getFocusControl();
1381 if (eventTarget !is null) {
1382 if (type is OS.NSKeyDown) {
1383 bool[] consume = new bool[1];
1384 short key = nsEvent.keyCode();
1385 if (eventTarget.translateTraversal(key, nsEvent, consume)) return;
1386 if (consume[0]) return;
1387 if (eventTarget.isDisposed()) return;
1388 }
1389 if (!eventTarget.sendKeyEvent(nsEvent, type is OS.NSKeyDown ? DWT.KeyDown : DWT.KeyUp)) return;
1390 }
1391 }
1392 super.windowSendEvent(ID, event);
1393 }
1394
1395 }