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

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import sun.lwawt.PlatformWindow;
  29 import sun.lwawt.LWWindowPeer;
  30 
  31 import sun.java2d.opengl.CGLLayer;
  32 import sun.java2d.SurfaceData;
  33 
  34 import sun.awt.CGraphicsConfig;
  35 import sun.awt.CGraphicsDevice;
  36 import sun.awt.CausedFocusEvent;
  37 
  38 import java.awt.*;
  39 import java.awt.BufferCapabilities.FlipContents;
  40 
  41 import sun.util.logging.PlatformLogger;
  42 
  43 /*
  44  * Provides a lightweight implementation of the EmbeddedFrame.
  45  */
  46 public class CPlatformEmbeddedFrame implements PlatformWindow {
  47 
  48     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame");
  49 
  50     private CGLLayer windowLayer;
  51     private LWWindowPeer peer;
  52     private CEmbeddedFrame target;
  53 
  54     private volatile int screenX = 0;
  55     private volatile int screenY = 0;
  56 
  57     @Override // PlatformWindow
  58     public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
  59         this.peer = peer;


  93     }
  94 
  95     @Override
  96     public Point getLocationOnScreen() {
  97         return new Point(screenX, screenY);
  98     }
  99 
 100     @Override
 101     public FontMetrics getFontMetrics(Font f) {
 102         throw new RuntimeException("Not implemented");
 103     }
 104 
 105     @Override
 106     public SurfaceData getScreenSurface() {
 107         return windowLayer.getSurfaceData();
 108     }
 109 
 110     @Override
 111     public SurfaceData replaceSurfaceData() {
 112         return windowLayer.replaceSurfaceData();
 113     }
 114 
 115     @Override
 116     public Image createBackBuffer() {
 117         Rectangle r = peer.getBounds();
 118         Image im = null;
 119         if (!r.isEmpty()) {
 120             int transparency = peer.isTranslucent() ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
 121             im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency);
 122         }
 123         return im;
 124     }
 125 
 126     @Override
 127     public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) {
 128         throw new RuntimeException("Not implemented");
 129     }
 130 
 131     @Override
 132     public void setVisible(boolean visible) {}
 133 
 134     @Override
 135     public void setTitle(String title) {}
 136 
 137     @Override
 138     public Insets getInsets() {
 139         return new Insets(0, 0, 0, 0);
 140     }
 141 
 142     @Override
 143     public void toFront() {}
 144 
 145     @Override
 146     public void toBack() {}
 147 
 148     @Override




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.lwawt.macosx;
  27 
  28 import sun.lwawt.PlatformWindow;
  29 import sun.lwawt.LWWindowPeer;
  30 
  31 import sun.java2d.opengl.CGLLayer;
  32 import sun.java2d.SurfaceData;
  33 


  34 import sun.awt.CausedFocusEvent;
  35 
  36 import java.awt.*;

  37 
  38 import sun.util.logging.PlatformLogger;
  39 
  40 /*
  41  * Provides a lightweight implementation of the EmbeddedFrame.
  42  */
  43 public class CPlatformEmbeddedFrame implements PlatformWindow {
  44 
  45     private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame");
  46 
  47     private CGLLayer windowLayer;
  48     private LWWindowPeer peer;
  49     private CEmbeddedFrame target;
  50 
  51     private volatile int screenX = 0;
  52     private volatile int screenY = 0;
  53 
  54     @Override // PlatformWindow
  55     public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
  56         this.peer = peer;


  90     }
  91 
  92     @Override
  93     public Point getLocationOnScreen() {
  94         return new Point(screenX, screenY);
  95     }
  96 
  97     @Override
  98     public FontMetrics getFontMetrics(Font f) {
  99         throw new RuntimeException("Not implemented");
 100     }
 101 
 102     @Override
 103     public SurfaceData getScreenSurface() {
 104         return windowLayer.getSurfaceData();
 105     }
 106 
 107     @Override
 108     public SurfaceData replaceSurfaceData() {
 109         return windowLayer.replaceSurfaceData();
















 110     }
 111 
 112     @Override
 113     public void setVisible(boolean visible) {}
 114 
 115     @Override
 116     public void setTitle(String title) {}
 117 
 118     @Override
 119     public Insets getInsets() {
 120         return new Insets(0, 0, 0, 0);
 121     }
 122 
 123     @Override
 124     public void toFront() {}
 125 
 126     @Override
 127     public void toBack() {}
 128 
 129     @Override