src/macosx/native/sun/awt/CMenuItem.m

Print this page


   1 /*
   2  * Copyright (c) 2011, 2013, 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


 242     unichar macKey = 0;
 243 
 244     if ((awtKey >= java_awt_event_KeyEvent_VK_0 && awtKey <= java_awt_event_KeyEvent_VK_9) ||
 245         (awtKey >= java_awt_event_KeyEvent_VK_A && awtKey <= java_awt_event_KeyEvent_VK_Z))
 246     {
 247         // These ranges are the same in ASCII
 248         macKey = awtKey;
 249     } else if (awtKey >= java_awt_event_KeyEvent_VK_F1 && awtKey <= java_awt_event_KeyEvent_VK_F12) {
 250         // Support for F1 - F12 has been around since Java 1.0 and fall into a lower range.
 251         macKey = awtKey - java_awt_event_KeyEvent_VK_F1 + NSF1FunctionKey;
 252     } else if (awtKey >= java_awt_event_KeyEvent_VK_F13 && awtKey <= java_awt_event_KeyEvent_VK_F24) {
 253         // Support for F13-F24 came in Java 1.2 and are at a different range.
 254         macKey = awtKey - java_awt_event_KeyEvent_VK_F13 + NSF13FunctionKey;
 255     } else {
 256         // Special characters
 257         switch (awtKey) {
 258         case java_awt_event_KeyEvent_VK_BACK_QUOTE      : macKey = '`'; break;
 259         case java_awt_event_KeyEvent_VK_QUOTE           : macKey = '\''; break;
 260 
 261         case java_awt_event_KeyEvent_VK_ESCAPE          : macKey = 0x1B; break;
 262 //        case java_awt_event_KeyEvent_VK_SPACE           : macKey = kMenuSpaceGlyph; break;
 263         case java_awt_event_KeyEvent_VK_PAGE_UP         : macKey = NSPageUpFunctionKey; break;
 264         case java_awt_event_KeyEvent_VK_PAGE_DOWN       : macKey = NSPageDownFunctionKey; break;
 265         case java_awt_event_KeyEvent_VK_END             : macKey = NSEndFunctionKey; break;
 266         case java_awt_event_KeyEvent_VK_HOME            : macKey = NSHomeFunctionKey; break;
 267 
 268         case java_awt_event_KeyEvent_VK_LEFT            : macKey = NSLeftArrowFunctionKey; break;
 269         case java_awt_event_KeyEvent_VK_UP              : macKey = NSUpArrowFunctionKey; break;
 270         case java_awt_event_KeyEvent_VK_RIGHT           : macKey = NSRightArrowFunctionKey; break;
 271         case java_awt_event_KeyEvent_VK_DOWN            : macKey = NSDownArrowFunctionKey; break;
 272 
 273         case java_awt_event_KeyEvent_VK_COMMA           : macKey = ','; break;
 274 
 275         // Mac OS doesn't distinguish between the two '-' keys...
 276         case java_awt_event_KeyEvent_VK_MINUS           :
 277         case java_awt_event_KeyEvent_VK_SUBTRACT        : macKey = '-'; break;
 278 
 279         // or the two '.' keys...
 280         case java_awt_event_KeyEvent_VK_DECIMAL         :
 281         case java_awt_event_KeyEvent_VK_PERIOD          : macKey = '.'; break;
 282 


   1 /*
   2  * Copyright (c) 2011, 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


 242     unichar macKey = 0;
 243 
 244     if ((awtKey >= java_awt_event_KeyEvent_VK_0 && awtKey <= java_awt_event_KeyEvent_VK_9) ||
 245         (awtKey >= java_awt_event_KeyEvent_VK_A && awtKey <= java_awt_event_KeyEvent_VK_Z))
 246     {
 247         // These ranges are the same in ASCII
 248         macKey = awtKey;
 249     } else if (awtKey >= java_awt_event_KeyEvent_VK_F1 && awtKey <= java_awt_event_KeyEvent_VK_F12) {
 250         // Support for F1 - F12 has been around since Java 1.0 and fall into a lower range.
 251         macKey = awtKey - java_awt_event_KeyEvent_VK_F1 + NSF1FunctionKey;
 252     } else if (awtKey >= java_awt_event_KeyEvent_VK_F13 && awtKey <= java_awt_event_KeyEvent_VK_F24) {
 253         // Support for F13-F24 came in Java 1.2 and are at a different range.
 254         macKey = awtKey - java_awt_event_KeyEvent_VK_F13 + NSF13FunctionKey;
 255     } else {
 256         // Special characters
 257         switch (awtKey) {
 258         case java_awt_event_KeyEvent_VK_BACK_QUOTE      : macKey = '`'; break;
 259         case java_awt_event_KeyEvent_VK_QUOTE           : macKey = '\''; break;
 260 
 261         case java_awt_event_KeyEvent_VK_ESCAPE          : macKey = 0x1B; break;
 262         case java_awt_event_KeyEvent_VK_SPACE           : macKey = ' '; break;
 263         case java_awt_event_KeyEvent_VK_PAGE_UP         : macKey = NSPageUpFunctionKey; break;
 264         case java_awt_event_KeyEvent_VK_PAGE_DOWN       : macKey = NSPageDownFunctionKey; break;
 265         case java_awt_event_KeyEvent_VK_END             : macKey = NSEndFunctionKey; break;
 266         case java_awt_event_KeyEvent_VK_HOME            : macKey = NSHomeFunctionKey; break;
 267 
 268         case java_awt_event_KeyEvent_VK_LEFT            : macKey = NSLeftArrowFunctionKey; break;
 269         case java_awt_event_KeyEvent_VK_UP              : macKey = NSUpArrowFunctionKey; break;
 270         case java_awt_event_KeyEvent_VK_RIGHT           : macKey = NSRightArrowFunctionKey; break;
 271         case java_awt_event_KeyEvent_VK_DOWN            : macKey = NSDownArrowFunctionKey; break;
 272 
 273         case java_awt_event_KeyEvent_VK_COMMA           : macKey = ','; break;
 274 
 275         // Mac OS doesn't distinguish between the two '-' keys...
 276         case java_awt_event_KeyEvent_VK_MINUS           :
 277         case java_awt_event_KeyEvent_VK_SUBTRACT        : macKey = '-'; break;
 278 
 279         // or the two '.' keys...
 280         case java_awt_event_KeyEvent_VK_DECIMAL         :
 281         case java_awt_event_KeyEvent_VK_PERIOD          : macKey = '.'; break;
 282