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

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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.BufferCapabilities.FlipContents;
  29 import java.awt.*;
  30 import java.awt.Dialog.ModalityType;
  31 import java.awt.event.*;
  32 import java.awt.peer.WindowPeer;
  33 import java.beans.*;
  34 import java.util.List;
  35 
  36 import javax.swing.*;
  37 
  38 import sun.awt.*;
  39 import sun.java2d.SurfaceData;
  40 import sun.java2d.opengl.CGLSurfaceData;
  41 import sun.lwawt.*;
  42 import sun.lwawt.LWWindowPeer.PeerType;
  43 import sun.util.logging.PlatformLogger;
  44 
  45 import com.apple.laf.*;
  46 import com.apple.laf.ClientPropertyApplicator.Property;
  47 import com.sun.awt.AWTUtilities;
  48 


 385     }
 386 
 387     private native void _toggleFullScreenMode(final long model);
 388 
 389     public void toggleFullScreen() {
 390         _toggleFullScreenMode(getNSWindowPtr());
 391     }
 392 
 393     @Override // PlatformWindow
 394     public void setMenuBar(MenuBar mb) {
 395         final long nsWindowPtr = getNSWindowPtr();
 396         CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);
 397         if (mbPeer != null) {
 398             nativeSetNSWindowMenuBar(nsWindowPtr, mbPeer.getModel());
 399         } else {
 400             nativeSetNSWindowMenuBar(nsWindowPtr, 0);
 401         }
 402     }
 403 
 404     @Override // PlatformWindow
 405     public Image createBackBuffer() {
 406         return contentView.createBackBuffer();
 407     }
 408 
 409     @Override // PlatformWindow
 410     public void dispose() {
 411         if (owner != null) {
 412             CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr());
 413         }
 414         contentView.dispose();
 415         nativeDispose(getNSWindowPtr());
 416         CPlatformWindow.super.dispose();
 417     }
 418 
 419     @Override // PlatformWindow
 420     public void flip(int x1, int y1, int x2, int y2, FlipContents flipAction) {
 421         // TODO: not implemented
 422         (new RuntimeException("unimplemented")).printStackTrace();
 423     }
 424 
 425     @Override // PlatformWindow
 426     public FontMetrics getFontMetrics(Font f) {
 427         // TODO: not implemented
 428         (new RuntimeException("unimplemented")).printStackTrace();
 429         return null;
 430     }
 431 
 432     @Override // PlatformWindow
 433     public Insets getInsets() {
 434         final Insets insets = nativeGetNSWindowInsets(getNSWindowPtr());
 435         return insets;
 436     }
 437 
 438     @Override // PlatformWindow
 439     public Point getLocationOnScreen() {
 440         return new Point(nativeBounds.x, nativeBounds.y);
 441     }
 442 




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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.*;
  29 import java.awt.Dialog.ModalityType;
  30 import java.awt.event.*;
  31 import java.awt.peer.WindowPeer;
  32 import java.beans.*;
  33 import java.util.List;
  34 
  35 import javax.swing.*;
  36 
  37 import sun.awt.*;
  38 import sun.java2d.SurfaceData;
  39 import sun.java2d.opengl.CGLSurfaceData;
  40 import sun.lwawt.*;
  41 import sun.lwawt.LWWindowPeer.PeerType;
  42 import sun.util.logging.PlatformLogger;
  43 
  44 import com.apple.laf.*;
  45 import com.apple.laf.ClientPropertyApplicator.Property;
  46 import com.sun.awt.AWTUtilities;
  47 


 384     }
 385 
 386     private native void _toggleFullScreenMode(final long model);
 387 
 388     public void toggleFullScreen() {
 389         _toggleFullScreenMode(getNSWindowPtr());
 390     }
 391 
 392     @Override // PlatformWindow
 393     public void setMenuBar(MenuBar mb) {
 394         final long nsWindowPtr = getNSWindowPtr();
 395         CMenuBar mbPeer = (CMenuBar)LWToolkit.targetToPeer(mb);
 396         if (mbPeer != null) {
 397             nativeSetNSWindowMenuBar(nsWindowPtr, mbPeer.getModel());
 398         } else {
 399             nativeSetNSWindowMenuBar(nsWindowPtr, 0);
 400         }
 401     }
 402 
 403     @Override // PlatformWindow





 404     public void dispose() {
 405         if (owner != null) {
 406             CWrapper.NSWindow.removeChildWindow(owner.getNSWindowPtr(), getNSWindowPtr());
 407         }
 408         contentView.dispose();
 409         nativeDispose(getNSWindowPtr());
 410         CPlatformWindow.super.dispose();






 411     }
 412 
 413     @Override // PlatformWindow
 414     public FontMetrics getFontMetrics(Font f) {
 415         // TODO: not implemented
 416         (new RuntimeException("unimplemented")).printStackTrace();
 417         return null;
 418     }
 419 
 420     @Override // PlatformWindow
 421     public Insets getInsets() {
 422         final Insets insets = nativeGetNSWindowInsets(getNSWindowPtr());
 423         return insets;
 424     }
 425 
 426     @Override // PlatformWindow
 427     public Point getLocationOnScreen() {
 428         return new Point(nativeBounds.x, nativeBounds.y);
 429     }
 430