Skip to content

Instantly share code, notes, and snippets.

@maxsteenbergen
Created May 13, 2013 12:33
Show Gist options
  • Save maxsteenbergen/5568001 to your computer and use it in GitHub Desktop.
Save maxsteenbergen/5568001 to your computer and use it in GitHub Desktop.
//
// WOMAppDelegate.m
// PopoverMenulet
//
// Created by Julián Romero on 10/26/11.
// Copyright (c) 2011 Wuonm Web Services S.L. All rights reserved.
//
#import "WOMAppDelegate.h"
#import "WOMMenulet.h"
#import "WOMController.h"
@implementation WOMAppDelegate
@synthesize window = _window;
@synthesize menulet;
@synthesize statusItem;
@synthesize statusImage;
@synthesize controller;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//SET UP NSSTATUSITEM
self.statusImage = [NSImage imageNamed:@"basket"];
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:18];
[self.statusItem setImage:statusImage];
//[self.statusItem setHighlightMode:YES];
[self.statusItem setEnabled:YES];
self.menulet = [[WOMMenulet alloc] init]; /* square item */
self.controller = [[WOMController alloc] init];
self.menulet.delegate = controller;
//AS SOON AS THIS CODE IS CALLED, THE ICON IS RELEASED
[self.statusItem setView:menulet];
}
@end
//
// WOMAppDelegate.h
// PopoverMenulet
//
// Created by Julián Romero on 10/26/11.
// Copyright (c) 2011 Wuonm Web Services S.L. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class WOMMenulet;
@class WOMController;
@interface WOMAppDelegate : NSObject <NSApplicationDelegate>
@property (unsafe_unretained) IBOutlet NSWindow *window;
@property (nonatomic, strong) WOMMenulet *menulet;
@property (strong) NSStatusItem *statusItem;
@property (strong) NSImage *statusImage;
@property (nonatomic, strong) WOMController *controller;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment