modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacWindow.java

Print this page




  35 
  36 import java.util.Map;
  37 
  38 /**
  39  * MacOSX platform implementation class for Window.
  40  */
  41 final class MacWindow extends Window {
  42 
  43     private native static void _initIDs();
  44     static {
  45         _initIDs();
  46     }
  47 
  48     protected MacWindow(Window owner, Screen screen, int styleMask) {
  49         super(owner, screen, styleMask);
  50     }
  51     protected MacWindow(long parent) {
  52         super(parent);
  53     }
  54 
  55     @Override
  56     protected void setScreen(Screen screen) {
  57         // SceneState will be called to update with new scale values
  58         // before we return from super.setScreen()...
  59         super.setScreen(screen);
  60         notifyScaleChanged(1.0f, 1.0f,
  61                            screen.getRecommendedOutputScaleX(),
  62                            screen.getRecommendedOutputScaleY());
  63     }
  64 
  65     @Override native protected long _createWindow(long ownerPtr, long screenPtr, int mask);
  66     @Override native protected long _createChildWindow(long parent);
  67     @Override native protected boolean _close(long ptr);
  68     @Override native protected boolean _setView(long ptr, View view);
  69     @Override native protected boolean _setMenubar(long ptr, long menubarPtr);
  70     @Override native protected boolean _minimize(long ptr, boolean minimize);
  71     @Override native protected boolean _maximize(long ptr, boolean maximize, boolean wasMaximized);
  72     @Override protected void _setBounds(long ptr,
  73                                         int x, int y, boolean xSet, boolean ySet,
  74                                         int w, int h, int cw, int ch,
  75                                         float xGravity, float yGravity)
  76     {
  77         float sx = getPlatformScaleX();
  78         float sy = getPlatformScaleY();
  79         if (xSet)    x = Math.round( x / sx);
  80         if (ySet)    y = Math.round( y / sy);
  81         if ( w > 0)  w = Math.round( w / sx);
  82         if ( h > 0)  h = Math.round( h / sy);
  83         if (cw > 0) cw = Math.round(cw / sx);
  84         if (ch > 0) ch = Math.round(ch / sy);




  35 
  36 import java.util.Map;
  37 
  38 /**
  39  * MacOSX platform implementation class for Window.
  40  */
  41 final class MacWindow extends Window {
  42 
  43     private native static void _initIDs();
  44     static {
  45         _initIDs();
  46     }
  47 
  48     protected MacWindow(Window owner, Screen screen, int styleMask) {
  49         super(owner, screen, styleMask);
  50     }
  51     protected MacWindow(long parent) {
  52         super(parent);
  53     }
  54 










  55     @Override native protected long _createWindow(long ownerPtr, long screenPtr, int mask);
  56     @Override native protected long _createChildWindow(long parent);
  57     @Override native protected boolean _close(long ptr);
  58     @Override native protected boolean _setView(long ptr, View view);
  59     @Override native protected boolean _setMenubar(long ptr, long menubarPtr);
  60     @Override native protected boolean _minimize(long ptr, boolean minimize);
  61     @Override native protected boolean _maximize(long ptr, boolean maximize, boolean wasMaximized);
  62     @Override protected void _setBounds(long ptr,
  63                                         int x, int y, boolean xSet, boolean ySet,
  64                                         int w, int h, int cw, int ch,
  65                                         float xGravity, float yGravity)
  66     {
  67         float sx = getPlatformScaleX();
  68         float sy = getPlatformScaleY();
  69         if (xSet)    x = Math.round( x / sx);
  70         if (ySet)    y = Math.round( y / sy);
  71         if ( w > 0)  w = Math.round( w / sx);
  72         if ( h > 0)  h = Math.round( h / sy);
  73         if (cw > 0) cw = Math.round(cw / sx);
  74         if (ch > 0) ch = Math.round(ch / sy);