< prev index next >

src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java

Print this page


   1 /*
   2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   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


 156     }
 157 
 158     @Override
 159     public void notifyReshape(int x, int y, int w, int h) {
 160     }
 161 
 162     @Override
 163     public void notifyUpdateCursor() {
 164     }
 165 
 166     @Override
 167     public void notifyActivation(boolean activation, LWWindowPeer opposite) {
 168     }
 169 
 170     @Override
 171     public void notifyNCMouseDown() {
 172     }
 173 
 174     @Override
 175     public void notifyMouseEvent(int id, long when, int button, int x, int y,
 176                                  int screenX, int screenY, int modifiers,
 177                                  int clickCount, boolean popupTrigger,
 178                                  byte[] bdata) {
 179         LWWindowPeer peer = ownerPeer.get();
 180         if (id == MouseEvent.MOUSE_EXITED) {
 181             if (peer != null) {
 182                 peer.updateSecurityWarningVisibility();
 183             }
 184         } else if(id == MouseEvent.MOUSE_ENTERED) {
 185             if (peer != null) {
 186                 peer.updateSecurityWarningVisibility();
 187             }
 188         }
 189     }
 190 
 191     public Rectangle getBounds() {
 192         synchronized (lock) {
 193             return bounds.getBounds();
 194         }
 195     }
 196 


 222                 CWrapper.NSWindow.orderOut(nsWindowPtr);
 223             }
 224 
 225             this.visible = visible;
 226 
 227             // Manage parent-child relationship when showing
 228             if (visible) {
 229                 // Add myself as a child
 230                 if (owner != null && owner.isVisible()) {
 231                     CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
 232                             nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
 233 
 234                     // do not allow security warning to be obscured by other windows
 235                     applyWindowLevel(ownerWindow);
 236                 }
 237             }
 238         }
 239     }
 240 
 241     @Override
 242     public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
 243                                       int scrollType, int scrollAmount,
 244                                       int wheelRotation, double preciseWheelRotation,

 245                                       byte[] bdata) {
 246     }
 247 
 248     @Override
 249     public void notifyKeyEvent(int id, long when, int modifiers, int keyCode,
 250                                char keyChar, int keyLocation) {
 251     }
 252 
 253     protected int getInitialStyleBits() {
 254         int styleBits = 0;
 255         CPlatformWindow.SET(styleBits, CPlatformWindow.UTILITY, true);
 256         return styleBits;
 257     }
 258 
 259     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
 260                                           boolean byUser) {
 261 
 262         boolean isResize;
 263         synchronized (lock) {
 264             isResize = (bounds.width != width || bounds.height != height);


   1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   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


 156     }
 157 
 158     @Override
 159     public void notifyReshape(int x, int y, int w, int h) {
 160     }
 161 
 162     @Override
 163     public void notifyUpdateCursor() {
 164     }
 165 
 166     @Override
 167     public void notifyActivation(boolean activation, LWWindowPeer opposite) {
 168     }
 169 
 170     @Override
 171     public void notifyNCMouseDown() {
 172     }
 173 
 174     @Override
 175     public void notifyMouseEvent(int id, long when, int button, int x, int y,
 176                                  int absX, int absY, int modifiers,
 177                                  int clickCount, boolean popupTrigger,
 178                                  byte[] bdata) {
 179         LWWindowPeer peer = ownerPeer.get();
 180         if (id == MouseEvent.MOUSE_EXITED) {
 181             if (peer != null) {
 182                 peer.updateSecurityWarningVisibility();
 183             }
 184         } else if(id == MouseEvent.MOUSE_ENTERED) {
 185             if (peer != null) {
 186                 peer.updateSecurityWarningVisibility();
 187             }
 188         }
 189     }
 190 
 191     public Rectangle getBounds() {
 192         synchronized (lock) {
 193             return bounds.getBounds();
 194         }
 195     }
 196 


 222                 CWrapper.NSWindow.orderOut(nsWindowPtr);
 223             }
 224 
 225             this.visible = visible;
 226 
 227             // Manage parent-child relationship when showing
 228             if (visible) {
 229                 // Add myself as a child
 230                 if (owner != null && owner.isVisible()) {
 231                     CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(),
 232                             nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
 233 
 234                     // do not allow security warning to be obscured by other windows
 235                     applyWindowLevel(ownerWindow);
 236                 }
 237             }
 238         }
 239     }
 240 
 241     @Override
 242     public void notifyMouseWheelEvent(long when, int x, int y, int absX,
 243                                       int absY, int modifiers, int scrollType,
 244                                       int scrollAmount, int wheelRotation,
 245                                       double preciseWheelRotation,
 246                                       byte[] bdata) {
 247     }
 248 
 249     @Override
 250     public void notifyKeyEvent(int id, long when, int modifiers, int keyCode,
 251                                char keyChar, int keyLocation) {
 252     }
 253 
 254     protected int getInitialStyleBits() {
 255         int styleBits = 0;
 256         CPlatformWindow.SET(styleBits, CPlatformWindow.UTILITY, true);
 257         return styleBits;
 258     }
 259 
 260     protected void deliverMoveResizeEvent(int x, int y, int width, int height,
 261                                           boolean byUser) {
 262 
 263         boolean isResize;
 264         synchronized (lock) {
 265             isResize = (bounds.width != width || bounds.height != height);


< prev index next >