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

Print this page




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



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


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





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




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


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