Created
January 27, 2010 10:53
-
-
Save saikat/287746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * AppController.j | |
| * JakeTextFieldBug | |
| * | |
| * Created by You on January 25, 2010. | |
| * Copyright 2010, Your Company All rights reserved. | |
| */ | |
| @import <Foundation/CPObject.j> | |
| @import <AppKit/CPMenu.j> | |
| @implementation AppController : CPObject | |
| { | |
| } | |
| - (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
| { | |
| var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
| contentView = [theWindow contentView]; | |
| var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; | |
| [label setStringValue:@"Hello World!"]; | |
| [label setFont:[CPFont boldSystemFontOfSize:24.0]]; | |
| [label sizeToFit]; | |
| [label setEditable:YES]; | |
| [label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
| [label setCenter:[contentView center]]; | |
| [contentView addSubview:label]; | |
| [theWindow orderFront:self]; | |
| var menu = [[CPMenu alloc] initWithTitle:@"Menu"]; | |
| [CPApp setMainMenu:menu]; | |
| [CPMenu setMenuBarVisible:YES]; | |
| [[[CPApplication sharedApplication] mainMenu] setAutoenablesItems:NO]; | |
| var editMenu = [[CPMenu alloc] initWithTitle:@"Edit"], | |
| editMenuItem = [[CPMenuItem alloc] initWithTitle:@"Edit" action:nil | |
| keyEquivalent:nil]; | |
| [editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) | |
| keyEquivalent:"x"]]; | |
| [editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) | |
| keyEquivalent:"c"]]; | |
| [editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:) | |
| keyEquivalent:"v"]]; | |
| [editMenuItem setEnabled:YES]; | |
| [editMenuItem setSubmenu:editMenu]; | |
| [menu addItem:editMenuItem]; | |
| // Uncomment the following line to turn on the standard menu bar. | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment