Updated NSMenu API.
This commit is contained in:
parent
981bdb3ab4
commit
cf74dc5cc2
@ -12,9 +12,6 @@
|
|||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<menu title="AMainMenu" systemMenu="main" id="29">
|
|
||||||
<point key="canvasLocation" x="139" y="155"/>
|
|
||||||
</menu>
|
|
||||||
<customObject id="494" customClass="MPMacAppDelegate">
|
<customObject id="494" customClass="MPMacAppDelegate">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="createUserItem" destination="757" id="763"/>
|
<outlet property="createUserItem" destination="757" id="763"/>
|
||||||
@ -241,6 +238,9 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
</items>
|
</items>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="494" id="Slu-zT-yO4"/>
|
||||||
|
</connections>
|
||||||
<point key="canvasLocation" x="140" y="23"/>
|
<point key="canvasLocation" x="140" y="23"/>
|
||||||
</menu>
|
</menu>
|
||||||
</objects>
|
</objects>
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
#import "MPSitesWindowController.h"
|
#import "MPSitesWindowController.h"
|
||||||
#import "MPInitialWindowController.h"
|
#import "MPInitialWindowController.h"
|
||||||
|
|
||||||
@interface MPMacAppDelegate : MPAppDelegate_Shared<NSApplicationDelegate>
|
@interface MPMacAppDelegate : MPAppDelegate_Shared<NSApplicationDelegate, NSMenuDelegate>
|
||||||
|
|
||||||
@property(nonatomic, strong) NSStatusItem *statusView;
|
@property(nonatomic, strong) NSStatusItem *statusItem;
|
||||||
@property(nonatomic, strong) MPSitesWindowController *sitesWindowController;
|
@property(nonatomic, strong) MPSitesWindowController *sitesWindowController;
|
||||||
@property(nonatomic, strong) MPInitialWindowController *initialWindowController;
|
@property(nonatomic, strong) MPInitialWindowController *initialWindowController;
|
||||||
@property(nonatomic, weak) IBOutlet NSMenuItem *lockItem;
|
@property(nonatomic, weak) IBOutlet NSMenuItem *lockItem;
|
||||||
|
@ -158,12 +158,10 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
} forKeyPath:@"activeUser" options:0 context:nil];
|
} forKeyPath:@"activeUser" options:0 context:nil];
|
||||||
|
|
||||||
// Status item.
|
// Status item.
|
||||||
self.statusView = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
||||||
self.statusView.image = [NSImage imageNamed:@"menu-icon"];
|
self.statusItem.menu = self.statusMenu;
|
||||||
self.statusView.image.template = YES;
|
self.statusItem.button.image = [NSImage imageNamed:@"menu-icon"];
|
||||||
self.statusView.menu = self.statusMenu;
|
self.statusItem.button.image.template = YES;
|
||||||
self.statusView.target = self;
|
|
||||||
self.statusView.action = @selector( showMenu );
|
|
||||||
|
|
||||||
PearlAddNotificationObserver( NSPersistentStoreCoordinatorStoresWillChangeNotification, self.storeCoordinator, nil,
|
PearlAddNotificationObserver( NSPersistentStoreCoordinatorStoresWillChangeNotification, self.storeCoordinator, nil,
|
||||||
^(id self, NSNotification *note) {
|
^(id self, NSNotification *note) {
|
||||||
@ -502,7 +500,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
|
|
||||||
- (IBAction)showPopup:(id)sender {
|
- (IBAction)showPopup:(id)sender {
|
||||||
|
|
||||||
[self.statusView popUpStatusItemMenu:self.statusView.menu];
|
[[self.statusItem button] performClick:sender];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)showPasswordWindow:(id)sender {
|
- (IBAction)showPasswordWindow:(id)sender {
|
||||||
@ -682,13 +680,6 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
[self updateMenuItems];
|
[self updateMenuItems];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showMenu {
|
|
||||||
|
|
||||||
[self updateMenuItems];
|
|
||||||
|
|
||||||
[self.statusView popUpStatusItemMenu:self.statusView.menu];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)updateMenuItems {
|
- (void)updateMenuItems {
|
||||||
|
|
||||||
MPUserEntity *activeUser = [self activeUserForMainThread];
|
MPUserEntity *activeUser = [self activeUserForMainThread];
|
||||||
@ -743,6 +734,13 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - NSMenuDelegate
|
||||||
|
|
||||||
|
- (void)menuNeedsUpdate:(NSMenu *)menu {
|
||||||
|
|
||||||
|
[self updateMenuItems];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - PearlConfigDelegate
|
#pragma mark - PearlConfigDelegate
|
||||||
|
|
||||||
- (void)didUpdateConfigForKey:(SEL)configKey fromValue:(id)oldValue {
|
- (void)didUpdateConfigForKey:(SEL)configKey fromValue:(id)oldValue {
|
||||||
|
Loading…
Reference in New Issue
Block a user