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

Print this page




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









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


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




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




 718         return g;
 719     }
 720 
 721     @Override
 722     public void setAlwaysOnTop(boolean isAlwaysOnTop) {
 723         setStyleBits(ALWAYS_ON_TOP, isAlwaysOnTop);
 724     }
 725 
 726     @Override
 727     public void setOpacity(float opacity) {
 728         CWrapper.NSWindow.setAlphaValue(getNSWindowPtr(), opacity);
 729     }
 730 
 731     @Override
 732     public void setOpaque(boolean isOpaque) {
 733         CWrapper.NSWindow.setOpaque(getNSWindowPtr(), isOpaque);
 734         if (!isOpaque) {
 735             long clearColor = CWrapper.NSColor.clearColor();
 736             CWrapper.NSWindow.setBackgroundColor(getNSWindowPtr(), clearColor);
 737         }
 738 
 739         //This is a temporary workaround. Looks like after 7124236 will be fixed
 740         //the correct place for invalidateShadow() is CGLayer.drawInCGLContext.
 741         SwingUtilities.invokeLater(new Runnable() {
 742             @Override
 743             public void run() {
 744                 invalidateShadow();
 745             }
 746         });
 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     public final void invalidateShadow(){
 816         nativeRevalidateNSWindowShadow(getNSWindowPtr());
 817     }
 818 
 819     // ----------------------------------------------------------------------
 820     //                          UTILITY METHODS
 821     // ----------------------------------------------------------------------
 822 
 823     /*
 824      * Find image to install into Title or into Application icon.
 825      * First try icons installed for toplevel. If there is no icon
 826      * use default Duke image.
 827      * This method shouldn't return null.
 828      */
 829     private CImage getImageForTarget() {
 830         List<Image> icons = target.getIconImages();
 831         if (icons == null || icons.size() == 0) {
 832             return null;
 833         }
 834         return CImage.getCreator().createFromImages(icons);
 835     }
 836