// // AppDelegate.m // MenuletPreview // // Created by Andrew Pennebaker on 4/23/09. // Copyright 2009 YelloSoft. All rights reserved. #import "AppDelegate.h" @implementation AppDelegate -(void) awakeFromNib { statusItem=[[[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength] retain]; [statusItem setMenu:menu]; [statusItem setHighlightMode:YES]; [statusItem setImage:[NSImage imageNamed:@"torii-small.png"]]; [statusItem setEnabled:YES]; } -(IBAction) browseAndSetImage: (id) sender { NSApplication *app=[NSApplication sharedApplication]; [app activateIgnoringOtherApps:YES]; NSOpenPanel *dialog=[NSOpenPanel openPanel]; [dialog setCanChooseFiles:YES]; if ([dialog runModalForDirectory:nil file:nil]==NSOKButton) { NSString *filename=[dialog filename]; NSImage *image=[[NSImage alloc] initByReferencingFile:filename]; if (image!=NULL) { [statusItem setImage:image]; } } } -(IBAction) about: (id) sender { NSApplication *app=[NSApplication sharedApplication]; [app activateIgnoringOtherApps:YES]; [app orderFrontStandardAboutPanel:NULL]; } @end