/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import "CMenuItem.h"
#import "CMenu.h"
#import "AWTEvent.h"
#import "ThreadUtilities.h"
#import "java_awt_Event.h"
#import "java_awt_event_KeyEvent.h"
#import "sun_lwawt_macosx_CMenuItem.h"
if (self) {
if ([asSeparator boolValue]) {
} else {
}
fIsCheckbox = NO;
fIsEnabled = YES;
}
return self;
}
// This is because NSApplication doesn't check the target's window when sending
// actions; they only check the target itself. We always return YES,
// since we shouldn't even be installed unless our window is active.
- (BOOL) worksWhenModal {
return YES;
}
// Events
// If we are called as a result of user pressing a shorcut, do nothing,
// because AWTView has already sent corresponding key event to the Java
// layer from performKeyEquivalent
// Apple uses characters from private Unicode range for some of the
// keys, so we need to do the same translation here that we do
// for the regular key down events
}
return;
}
}
if (fIsCheckbox) {
// Send the opposite of what's currently checked -- the action
// indicates what state we're going to.
} else {
static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event)
JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event)
}
}
- (void) setJavaLabel:(NSString *)theLabel shortcut:(NSString *)theKeyEquivalent modifierMask:(jint)modifiers {
// Force the key equivalent to lower case if not using the shift key.
// Otherwise AppKit will draw a Shift glyph in the menu.
}
// Hack for the question mark -- SHIFT and / means use the question mark.
{
theKeyEquivalent = @"?";
}
}
}];
}
}];
}
}];
}
@synchronized(self) {
// Warning: This won't work if the parent menu is disabled.
// See [CMenu syncFromJava]. We still need to call it here so
// the NSMenuItem itself gets properly updated.
}
}];
}
@synchronized(self) {
}
return enabled;
}
}];
}
- (void)cleanup {
}
- (void)dealloc {
[super dealloc];
}
}
- (NSMenuItem *)menuItem {
}
- (void)setIsCheckbox {
fIsCheckbox = YES;
}
}
- (NSString *)description {
}
@end
/** Convert a Java keycode for SetMenuItemCmd */
{
// These ranges are the same in ASCII
// Support for F1 - F12 has been around since Java 1.0 and fall into a lower range.
// Support for F13-F24 came in Java 1.2 and are at a different range.
} else {
// Special characters
switch (awtKey) {
// case java_awt_event_KeyEvent_VK_SPACE : macKey = kMenuSpaceGlyph; break;
// Mac OS doesn't distinguish between the two '-' keys...
// or the two '.' keys...
// or the two '/' keys.
}
}
return macKey;
}
/*
* Class: sun_lwawt_macosx_CMenuItem
* Method: nativeSetLabel
*/
{
if (macKey == 0) {
}
if (macKey != 0) {
} else {
theKeyEquivalent = @"";
}
[((CMenuItem *)jlong_to_ptr(menuItemObj)) setJavaLabel:theLabel shortcut:theKeyEquivalent modifierMask:mods];
}
/*
* Class: sun_lwawt_macosx_CMenuItem
* Method: nativeSetTooltip
*/
{
}
/*
* Class: sun_lwawt_macosx_CMenuItem
* Method: nativeSetImage
* Signature: (JJ)V
*/
{
}
/*
* Class: sun_lwawt_macosx_CMenuItem
* Method: nativeCreate
* Signature: (JZ)J
*/
{
// Create a new item....
if (isSeparator == JNI_TRUE) {
args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], [NSNumber numberWithBool:YES], nil];
} else {
args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], [NSNumber numberWithBool:NO], nil];
}
[ThreadUtilities performOnMainThread:@selector(_createMenuItem_OnAppKitThread:) on:[CMenuItem alloc] withObject:args waitUntilDone:YES];
if (aCMenuItem == nil) {
return 0L;
}
// and add it to the parent item.
// setLabel will be called after creation completes.
if (aCMenuItem) {
}
return ptr_to_jlong(aCMenuItem);
}
/*
* Class: sun_lwawt_macosx_CMenuItem
* Method: nativeSetEnabled
* Signature: (JZ)V
*/
{
}
/*
* Class: sun_lwawt_macosx_CCheckboxMenuItem
* Method: nativeSetState
* Signature: (IZ)V
*/
{
}
/*
* Class: sun_lwawt_macosx_CCheckboxMenuItem
* Method: nativeSetState
* Signature: (IZ)V
*/
{
}