12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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 java.awt.Font; 29 import java.awt.FontMetrics; 30 import java.awt.Graphics; 31 import java.awt.GraphicsDevice; 32 import java.awt.Insets; 33 import java.awt.MenuBar; 34 import java.awt.Point; 35 import java.awt.Window; 36 import sun.awt.CausedFocusEvent; 37 import sun.java2d.SurfaceData; 38 import sun.lwawt.LWWindowPeer; 39 import sun.lwawt.PlatformWindow; 40 41 public class CPlatformLWWindow extends CPlatformWindow { 42 43 @Override 44 public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner) { 45 initializeBase(target, peer, owner, new CPlatformLWView()); 46 } 47 48 @Override 49 public void toggleFullScreen() { 50 } 51 52 @Override 53 public void setMenuBar(MenuBar mb) { 54 } 55 56 @Override 57 public void dispose() { 58 } 59 60 @Override 61 public FontMetrics getFontMetrics(Font f) { 62 return null; 63 } 64 65 @Override 66 public Insets getInsets() { 67 return new Insets(0, 0, 0, 0); 68 } 69 70 @Override 71 public Point getLocationOnScreen() { 72 return null; 73 } 74 75 @Override 76 public GraphicsDevice getGraphicsDevice() { 77 return null; 78 } 79 80 @Override 81 public SurfaceData getScreenSurface() { 82 return null; 83 } 84 85 @Override 86 public SurfaceData replaceSurfaceData() { 87 return null; 88 } 89 90 @Override 91 public void setBounds(int x, int y, int w, int h) { 92 if (getPeer() != null) { 93 getPeer().notifyReshape(x, y, w, h); 94 } 95 } 96 97 @Override 98 public void setVisible(boolean visible) { 99 } 100 182 } 183 184 @Override 185 public void setWindowState(int windowState) { 186 } 187 188 @Override 189 public LWWindowPeer getPeer() { 190 return super.getPeer(); 191 } 192 193 @Override 194 public CPlatformView getContentView() { 195 return super.getContentView(); 196 } 197 198 @Override 199 public long getLayerPtr() { 200 return 0; 201 } 202 } | 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 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 java.awt.Font; 29 import java.awt.FontMetrics; 30 import java.awt.Graphics; 31 import java.awt.GraphicsDevice; 32 import java.awt.GraphicsEnvironment; 33 import java.awt.Insets; 34 import java.awt.MenuBar; 35 import java.awt.Point; 36 import java.awt.Rectangle; 37 import java.awt.Window; 38 import sun.awt.CGraphicsDevice; 39 import sun.awt.CGraphicsEnvironment; 40 import sun.awt.CausedFocusEvent; 41 import sun.awt.LightweightFrame; 42 import sun.java2d.SurfaceData; 43 import sun.lwawt.LWLightweightFramePeer; 44 import sun.lwawt.LWWindowPeer; 45 import sun.lwawt.PlatformWindow; 46 47 public class CPlatformLWWindow extends CPlatformWindow { 48 49 @Override 50 public void initialize(Window target, LWWindowPeer peer, PlatformWindow owner) { 51 initializeBase(target, peer, owner, new CPlatformLWView()); 52 } 53 54 @Override 55 public void toggleFullScreen() { 56 } 57 58 @Override 59 public void setMenuBar(MenuBar mb) { 60 } 61 62 @Override 63 public void dispose() { 64 } 65 66 @Override 67 public FontMetrics getFontMetrics(Font f) { 68 return null; 69 } 70 71 @Override 72 public Insets getInsets() { 73 return new Insets(0, 0, 0, 0); 74 } 75 76 @Override 77 public Point getLocationOnScreen() { 78 return null; 79 } 80 81 @Override 82 public SurfaceData getScreenSurface() { 83 return null; 84 } 85 86 @Override 87 public SurfaceData replaceSurfaceData() { 88 return null; 89 } 90 91 @Override 92 public void setBounds(int x, int y, int w, int h) { 93 if (getPeer() != null) { 94 getPeer().notifyReshape(x, y, w, h); 95 } 96 } 97 98 @Override 99 public void setVisible(boolean visible) { 100 } 101 183 } 184 185 @Override 186 public void setWindowState(int windowState) { 187 } 188 189 @Override 190 public LWWindowPeer getPeer() { 191 return super.getPeer(); 192 } 193 194 @Override 195 public CPlatformView getContentView() { 196 return super.getContentView(); 197 } 198 199 @Override 200 public long getLayerPtr() { 201 return 0; 202 } 203 204 @Override 205 public GraphicsDevice getGraphicsDevice() { 206 CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment. 207 getLocalGraphicsEnvironment(); 208 209 LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer(); 210 int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor(); 211 212 Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds(); 213 for (GraphicsDevice d : ge.getScreenDevices()) { 214 if (d.getDefaultConfiguration().getBounds().intersects(bounds) && 215 ((CGraphicsDevice)d).getScaleFactor() == scale) 216 { 217 return d; 218 } 219 } 220 // We shouldn't be here... 221 return ge.getDefaultScreenDevice(); 222 } 223 } |