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

Print this page




 655     @Override  // PlatformWindow
 656     public void toBack() {
 657         final long nsWindowPtr = getNSWindowPtr();
 658         nativePushNSWindowToBack(nsWindowPtr);
 659     }
 660 
 661     @Override  // PlatformWindow
 662     public void toFront() {
 663         final long nsWindowPtr = getNSWindowPtr();
 664         updateFocusabilityForAutoRequestFocus(false);
 665         nativePushNSWindowToFront(nsWindowPtr);
 666         updateFocusabilityForAutoRequestFocus(true);
 667     }
 668 
 669     @Override
 670     public void setResizable(boolean resizable) {
 671         setStyleBits(RESIZABLE, resizable);
 672 
 673         // Re-apply the size constraints and the size to ensure the space
 674         // occupied by the grow box is counted properly
 675         setMinimumSize(1, 1); // the method ignores its arguments
 676 
 677         Rectangle bounds = peer.getBounds();
 678         setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 679     }
 680 
 681     @Override
 682     public void setMinimumSize(int width, int height) {
 683         //TODO width, height should be used
 684         //NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below
 685         final long nsWindowPtr = getNSWindowPtr();

 686         final Dimension min = target.getMinimumSize();



 687         final Dimension max = target.getMaximumSize();



 688         nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight());
 689     }
 690 
 691     @Override
 692     public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
 693         // Cross-app activation requests are not allowed.
 694         if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
 695             !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
 696         {
 697             focusLogger.fine("the app is inactive, so the request is rejected");
 698             return true;
 699         }
 700         return false;
 701     }
 702 
 703     @Override
 704     public boolean requestWindowFocus() {
 705 
 706         long ptr = getNSWindowPtr();
 707         if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) {




 655     @Override  // PlatformWindow
 656     public void toBack() {
 657         final long nsWindowPtr = getNSWindowPtr();
 658         nativePushNSWindowToBack(nsWindowPtr);
 659     }
 660 
 661     @Override  // PlatformWindow
 662     public void toFront() {
 663         final long nsWindowPtr = getNSWindowPtr();
 664         updateFocusabilityForAutoRequestFocus(false);
 665         nativePushNSWindowToFront(nsWindowPtr);
 666         updateFocusabilityForAutoRequestFocus(true);
 667     }
 668 
 669     @Override
 670     public void setResizable(boolean resizable) {
 671         setStyleBits(RESIZABLE, resizable);
 672 
 673         // Re-apply the size constraints and the size to ensure the space
 674         // occupied by the grow box is counted properly
 675         peer.updateMinimumSize();
 676 
 677         Rectangle bounds = peer.getBounds();
 678         setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 679     }
 680 
 681     @Override
 682     public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {


 683         final long nsWindowPtr = getNSWindowPtr();
 684         
 685         final Dimension min = target.getMinimumSize();
 686         min.width = Math.max(min.width, minW);
 687         min.height = Math.max(min.height, minH);
 688 
 689         final Dimension max = target.getMaximumSize();
 690         max.width = Math.min(max.width, maxW);
 691         max.height = Math.min(max.height, maxH);
 692 
 693         nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight());
 694     }
 695 
 696     @Override
 697     public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) {
 698         // Cross-app activation requests are not allowed.
 699         if (cause != CausedFocusEvent.Cause.MOUSE_EVENT &&
 700             !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive())
 701         {
 702             focusLogger.fine("the app is inactive, so the request is rejected");
 703             return true;
 704         }
 705         return false;
 706     }
 707 
 708     @Override
 709     public boolean requestWindowFocus() {
 710 
 711         long ptr = getNSWindowPtr();
 712         if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) {