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

Print this page




  37 import sun.java2d.opengl.CGLLayer;
  38 import sun.java2d.opengl.CGLSurfaceData;
  39 
  40 public class CPlatformView extends CFRetainedResource {
  41     private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr);
  42     private static native void nativeSetAutoResizable(long awtView, boolean toResize);
  43     private static native int nativeGetNSViewDisplayID(long awtView);
  44     private static native Rectangle2D nativeGetLocationOnScreen(long awtView);
  45     private static native boolean nativeIsViewUnderMouse(long ptr);
  46 
  47     private LWWindowPeer peer;
  48     private SurfaceData surfaceData;
  49     private CGLLayer windowLayer;
  50     private CPlatformResponder responder;
  51 
  52     public CPlatformView() {
  53         super(0, true);
  54     }
  55 
  56     public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
  57         this.peer = peer;
  58         this.responder = responder;
  59 
  60         if (!LWCToolkit.getSunAwtDisableCALayers()) {
  61             this.windowLayer = new CGLLayer(peer);
  62         }
  63         setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
  64     }
  65 





  66     public long getAWTView() {
  67         return ptr;
  68         }
  69 
  70     public boolean isOpaque() {
  71         return !peer.isTranslucent();
  72     }
  73 
  74     /*
  75      * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard
  76      * Cocoa coordinates).
  77      */
  78     public void setBounds(int x, int y, int width, int height) {
  79         CWrapper.NSView.setFrame(ptr, x, y, width, height);
  80     }
  81 
  82     // REMIND: CGLSurfaceData expects top-level's size
  83     public Rectangle getBounds() {
  84         return peer.getBounds();
  85     }




  37 import sun.java2d.opengl.CGLLayer;
  38 import sun.java2d.opengl.CGLSurfaceData;
  39 
  40 public class CPlatformView extends CFRetainedResource {
  41     private native long nativeCreateView(int x, int y, int width, int height, long windowLayerPtr);
  42     private static native void nativeSetAutoResizable(long awtView, boolean toResize);
  43     private static native int nativeGetNSViewDisplayID(long awtView);
  44     private static native Rectangle2D nativeGetLocationOnScreen(long awtView);
  45     private static native boolean nativeIsViewUnderMouse(long ptr);
  46 
  47     private LWWindowPeer peer;
  48     private SurfaceData surfaceData;
  49     private CGLLayer windowLayer;
  50     private CPlatformResponder responder;
  51 
  52     public CPlatformView() {
  53         super(0, true);
  54     }
  55 
  56     public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
  57         initializeBase(peer, responder);

  58 
  59         if (!LWCToolkit.getSunAwtDisableCALayers()) {
  60             this.windowLayer = new CGLLayer(peer);
  61         }
  62         setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
  63     }
  64     
  65     protected void initializeBase(LWWindowPeer peer, CPlatformResponder responder) {
  66         this.peer = peer;
  67         this.responder = responder;        
  68     }
  69 
  70     public long getAWTView() {
  71         return ptr;
  72         }
  73 
  74     public boolean isOpaque() {
  75         return !peer.isTranslucent();
  76     }
  77 
  78     /*
  79      * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard
  80      * Cocoa coordinates).
  81      */
  82     public void setBounds(int x, int y, int width, int height) {
  83         CWrapper.NSView.setFrame(ptr, x, y, width, height);
  84     }
  85 
  86     // REMIND: CGLSurfaceData expects top-level's size
  87     public Rectangle getBounds() {
  88         return peer.getBounds();
  89     }