/*
* 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 <AppKit/AppKit.h>
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import "CMenuBar.h"
#import "CMenu.h"
#import "ThreadUtilities.h"
#import "sun_lwawt_macosx_CMenuBar.h"
@"CMenuBarDidReuseItemNotification";
@interface CMenuBar (CMenuBar_Private)
+ (void) addDefaultHelpMenu;
@end
// Remove all Java menus from the main bar.
for (i = menuCount; i > 1; i--) {
continue;
}
}
}
return (sActiveMenuBar == inMenuBar);
}
if (self) {
}
return self;
}
-(void) dealloc {
[super dealloc];
}
if (!menubar) {
return;
}
@synchronized([CMenuBar class]) {
}
@synchronized(menubar) {
}
if ([currMenu isJavaMenu]) {
// Ready to replace, find next candidate
if (cmenuIndex < cmenuCount) {
cmenuIndex++;
if (cmenuIndex < cmenuCount) {
}
}
}
if (newMenu) {
[[NSNotificationCenter defaultCenter] postNotificationName:CMenuBarDidReuseItemNotification object:theMainMenu];
cmenuIndex++;
}
} else {
}
}
}
// Clean up extra items
}
i = cmenuIndex;
// Add all of the menus in the menu list.
for (; i < newMenuListSize; i++) {
}
}
// Add the help menu last.
} else {
}
}
-(void) deactivate {
@synchronized([CMenuBar class]) {
}
@synchronized(self) {
}
}
@synchronized(self) {
}
if (self == sActiveMenuBar) {
[ThreadUtilities performOnMainThread:@selector(nativeAddMenuAtIndex_OnAppKitThread:) on:self withObject:args waitUntilDone:YES];
}
}
// This method is a special case for use by the screen menu bar.
// See ScreenMenuBar.java -- used to implement setVisible(boolean) by
// removing or adding the menu from the current menu bar's list.
@synchronized(self) {
if (index == -1){
}else{
}
}
if (self == sActiveMenuBar) {
[ThreadUtilities performOnMainThread:@selector(nativeAddMenuAtIndex_OnAppKitThread:) on:self withObject:args waitUntilDone:YES];
}
}
if (javaIndex == -1) {
if (fHelpMenu) {
}
} else {
if (requestedMenu == fHelpMenu) {
} else {
for (i = 0; i < menuCount; i++) {
if ([currMenu isJavaMenu]) {
if (javaIndex == currJavaMenuIndex) {
returnValue = i;
break;
}
}
}
}
}
return returnValue;
}
if (nsMenuIndex == -1) {
} else {
}
}
}
if (self == sActiveMenuBar) {
[ThreadUtilities performOnMainThread:@selector(nativeDeleteMenu_OnAppKitThread:) on:self withObject:[NSNumber numberWithInt:index] waitUntilDone:YES];
}
@synchronized(self) {
if (menuToRemove == fHelpMenu) {
}
}
}
if (nsMenuToRemove != -1) {
}
}
@synchronized(self) {
}
}
+ (void) addDefaultHelpMenu {
// Look for a help book tag. If it's there, add the help menu.
@synchronized ([CMenuBar class]) {
if (!sSetupHelpMenu) {
if (sDefaultHelpMenu == nil) {
// If we are embedded, don't make a help menu.
// TODO(cpc): we don't have NSApplicationAWT yet...
//if (![NSApp isKindOfClass:[NSApplicationAWT class]]) {
// sSetupHelpMenu = YES;
// return;
//}
// If the developer specified a NIB, don't make a help menu.
// TODO(cpc): usingDefaultNib only defined on NSApplicationAWT
//if (![NSApp usingDefaultNib]) {
// sSetupHelpMenu = YES;
// return;
//}
// TODO: not implemented
}
}
}
if (sDefaultHelpMenu) {
// Since we're re-using this NSMenu, we need to clear its parent before
// adding it to a new menu item, or else AppKit will complain.
// Add the help menu to the main menu.
// Release it so the main menu owns it.
}
}
}
@end
/*
* Class: sun_lwawt_macosx_CMenuBar
* Method: nativeCreateMenuBar
* Signature: ()J
*/
{
// We use an array here only to be able to get a return value
NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:[NSValue valueWithBytes:&cPeerObjGlobal objCType:@encode(jobject)], nil];
[ThreadUtilities performOnMainThread:@selector(_create_OnAppKitThread:) on:[CMenuBar alloc] withObject:args waitUntilDone:YES];
return 0L;
}
// [args release];
// A strange memory managment after that.
if (aCMenuBar) {
}
return ptr_to_jlong(aCMenuBar);
}
/*
* Class: sun_lwawt_macosx_CMenuBar
* Method: nativeAddAtIndex
* Signature: (JJI)V
*/
{
// Remove the specified item.
[((CMenuBar *) jlong_to_ptr(menuBarObject)) javaAddMenu:(CMenu *) jlong_to_ptr(menuObject) atIndex:index];
}
/*
* Class: sun_lwawt_macosx_CMenuBar
* Method: nativeDelMenu
* Signature: (JI)V
*/
{
// Remove the specified item.
}
/*
* Class: sun_lwawt_macosx_CMenuBar
* Method: nativeSetHelpMenu
* Signature: (JJ)V
*/
{
// Remove the specified item.
}