Last active
December 17, 2015 06:39
-
-
Save maxsteenbergen/5567362 to your computer and use it in GitHub Desktop.
Updated NSStatusItem code
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
// | |
// 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 controller; | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
NSLog(@"Started"); | |
//SET UP NSSTATUSITEM | |
NSImage *statusImage = [NSImage imageNamed:@"basket"]; | |
NSLog(@"%@", statusImage); | |
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:18]; | |
[self.statusItem setImage:statusImage]; | |
[self.statusItem setHighlightMode:YES]; | |
[self.statusItem setEnabled:YES]; | |
//CGFloat thickness = [[NSStatusBar systemStatusBar] thickness]; | |
//self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:18]; | |
self.menulet = [[WOMMenulet alloc] initWithFrame:(NSRect){}]; /* square item */ | |
self.controller = [[WOMController alloc] init]; | |
self.menulet.delegate = self.controller; | |
[self.statusItem setView:self.menulet]; | |
} | |
@end |
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
// | |
// 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 (nonatomic, strong) NSStatusItem *statusItem; | |
@property (nonatomic, strong) WOMController *controller; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment