src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page




 720         return g;
 721     }
 722 
 723     @Override
 724     public void setAlwaysOnTop(boolean isAlwaysOnTop) {
 725         setStyleBits(ALWAYS_ON_TOP, isAlwaysOnTop);
 726     }
 727 
 728     @Override
 729     public void setOpacity(float opacity) {
 730         CWrapper.NSWindow.setAlphaValue(getNSWindowPtr(), opacity);
 731     }
 732 
 733     @Override
 734     public void setOpaque(boolean isOpaque) {
 735         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
 736         if (!isOpaque) {
 737             long clearColor = CWrapper.NSColor.clearColor();
 738             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
 739         }









 740     }
 741 
 742     @Override
 743     public void enterFullScreenMode() {
 744         isFullScreenMode = true;
 745         contentView.enterFullScreenMode(getNSWindowPtr());
 746     }
 747 
 748     @Override
 749     public void exitFullScreenMode() {
 750         contentView.exitFullScreenMode();
 751         isFullScreenMode = false;
 752     }
 753 
 754     @Override
 755     public void setWindowState(int windowState) {
 756         if (!peer.isVisible()) {
 757             // setVisible() applies the state
 758             return;
 759         }


 786                     zoom();
 787                 }
 788                 break;
 789             default:
 790                 throw new RuntimeException("Unknown window state: " + windowState);
 791         }
 792 
 793         nativeSynthesizeMouseEnteredExitedEvents(nsWindowPtr);
 794 
 795         // NOTE: the SWP.windowState field gets updated to the newWindowState
 796         //       value when the native notification comes to us
 797     }
 798 
 799     @Override
 800     public void setModalBlocked(boolean blocked) {
 801         if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) {
 802             return;
 803         }
 804 
 805         nativeSetEnabled(getNSWindowPtr(), !blocked);




 806     }
 807 
 808     // ----------------------------------------------------------------------
 809     //                          UTILITY METHODS
 810     // ----------------------------------------------------------------------
 811 
 812     /*
 813      * Find image to install into Title or into Application icon.
 814      * First try icons installed for toplevel. If there is no icon
 815      * use default Duke image.
 816      * This method shouldn't return null.
 817      */
 818     private CImage getImageForTarget() {
 819         List<Image> icons = target.getIconImages();
 820         if (icons == null || icons.size() == 0) {
 821             return null;
 822         }
 823         return CImage.getCreator().createFromImages(icons);
 824     }
 825 




 720         return g;
 721     }
 722 
 723     @Override
 724     public void setAlwaysOnTop(boolean isAlwaysOnTop) {
 725         setStyleBits(ALWAYS_ON_TOP, isAlwaysOnTop);
 726     }
 727 
 728     @Override
 729     public void setOpacity(float opacity) {
 730         CWrapper.NSWindow.setAlphaValue(getNSWindowPtr(), opacity);
 731     }
 732 
 733     @Override
 734     public void setOpaque(boolean isOpaque) {
 735         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
 736         if (!isOpaque) {
 737             long clearColor = CWrapper.NSColor.clearColor();
 738             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
 739         }
 740 
 741         //This is a temporary workaround. Looks like after 7124236 will be fixed
 742         //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
 743         SwingUtilities.invokeLater(new Runnable() {
 744             @Override
 745             public void run() {
 746                 invalidateShadow();
 747             }
 748         });
 749     }
 750 
 751     @Override
 752     public void enterFullScreenMode() {
 753         isFullScreenMode = true;
 754         contentView.enterFullScreenMode(getNSWindowPtr());
 755     }
 756 
 757     @Override
 758     public void exitFullScreenMode() {
 759         contentView.exitFullScreenMode();
 760         isFullScreenMode = false;
 761     }
 762 
 763     @Override
 764     public void setWindowState(int windowState) {
 765         if (!peer.isVisible()) {
 766             // setVisible() applies the state
 767             return;
 768         }


 795                     zoom();
 796                 }
 797                 break;
 798             default:
 799                 throw new RuntimeException("Unknown window state: " + windowState);
 800         }
 801 
 802         nativeSynthesizeMouseEnteredExitedEvents(nsWindowPtr);
 803 
 804         // NOTE: the SWP.windowState field gets updated to the newWindowState
 805         //       value when the native notification comes to us
 806     }
 807 
 808     @Override
 809     public void setModalBlocked(boolean blocked) {
 810         if (target.getModalExclusionType() == Dialog.ModalExclusionType.APPLICATION_EXCLUDE) {
 811             return;
 812         }
 813 
 814         nativeSetEnabled(getNSWindowPtr(), !blocked);
 815     }
 816 
 817     public final void invalidateShadow(){
 818         nativeRevalidateNSWindowShadow(getNSWindowPtr());
 819     }
 820 
 821     // ----------------------------------------------------------------------
 822     //                          UTILITY METHODS
 823     // ----------------------------------------------------------------------
 824 
 825     /*
 826      * Find image to install into Title or into Application icon.
 827      * First try icons installed for toplevel. If there is no icon
 828      * use default Duke image.
 829      * This method shouldn't return null.
 830      */
 831     private CImage getImageForTarget() {
 832         List<Image> icons = target.getIconImages();
 833         if (icons == null || icons.size() == 0) {
 834             return null;
 835         }
 836         return CImage.getCreator().createFromImages(icons);
 837     }
 838