jdk/src/share/classes/sun/awt/LightweightFrame.java
changeset 25195 9de77f5b0df2
parent 15983 26a673dec5b2
child 26342 3637212ae8f2
--- a/jdk/src/share/classes/sun/awt/LightweightFrame.java	Thu Jun 12 00:19:00 2014 +0400
+++ b/jdk/src/share/classes/sun/awt/LightweightFrame.java	Thu Jun 12 00:32:33 2014 +0400
@@ -31,6 +31,7 @@
 import java.awt.Image;
 import java.awt.MenuBar;
 import java.awt.MenuComponent;
+import java.awt.Rectangle;
 import java.awt.Toolkit;
 import java.awt.peer.FramePeer;
 
@@ -124,4 +125,48 @@
      * @see SunToolkit#ungrab(java.awt.Window)
      */
     public abstract void ungrabFocus();
+
+    /**
+     * Returns the scale factor of this frame. The default value is 1.
+     *
+     * @return the scale factor
+     * @see #notifyDisplayChanged(int)
+     */
+    public abstract int getScaleFactor();
+
+    /**
+     * Called when display of the hosted frame is changed.
+     *
+     * @param scaleFactor the scale factor
+     */
+    public abstract void notifyDisplayChanged(int scaleFactor);
+
+    /**
+     * Host window absolute bounds.
+     */
+    private int hostX, hostY, hostW, hostH;
+
+    /**
+     * Returns the absolute bounds of the host (embedding) window.
+     *
+     * @return the host window bounds
+     */
+    public Rectangle getHostBounds() {
+        if (hostX == 0 && hostY == 0 && hostW == 0 && hostH == 0) {
+            // The client app is probably unaware of the setHostBounds.
+            // A safe fall-back:
+            return getBounds();
+        }
+        return new Rectangle(hostX, hostY, hostW, hostH);
+    }
+
+    /**
+     * Sets the absolute bounds of the host (embedding) window.
+     */
+    public void setHostBounds(int x, int y, int w, int h) {
+        hostX = x;
+        hostY = y;
+        hostW = w;
+        hostH = h;
+    }
 }