PageRenderTime 30ms CodeModel.GetById 20ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Tools/NativeHost/AppController+MainMenu.m

http://github.com/cacaodev/cappuccino
Objective C | 33 lines | 15 code | 11 blank | 7 comment | 0 complexity | 4b499deaa71dc6233bd6fa4c310b781a MD5 | raw file
 1//
 2//  AppController+MainMenu.m
 3//  NativeHost
 4//
 5//  Created by Francisco Tolmasky on 9/2/09.
 6//  Copyright 2009 280 North, Inc.. All rights reserved.
 7//
 8
 9#import <WebKit/WebKit.h>
10
11#import "MenuBridge.h"
12#import "AppController.h"
13
14
15@interface NSApplication (MenuMethods)
16
17- (void)setAppleMenu:(NSMenu *)aMenu;
18
19@end
20
21@implementation AppController (MainMenu)
22
23- (void)setMainMenuObject:(WebScriptObject *)aMenuObject
24{
25    NSMenu * mainMenu = [[MenuBridge alloc] initWithMenuObject:aMenuObject];
26
27    [NSApp setAppleMenu:[[mainMenu itemArray] objectAtIndex:0]];
28    [NSApp setMainMenu:mainMenu];
29
30    [mainMenu release];
31}
32
33@end