nsmenuitem

Reverse engineering an NSMenu for a Status Bar Item

99封情书 提交于 2019-11-28 05:35:34
I'm want to create a menu for a status bar item like the one seen in Tapbot's PastebotSync application: Does anyone have any ideas how to achieve the custom area at the top of the menu which is flush with the top? I've tried/thought of a few potential ways of doing it: Standard NSMenuItem with a view - isn't flush with the top of the menu Some hack-ish code to place an NSWindow over the area at the top of the menu - not great as it doesn't fade out nicely with the menu when it closes Abandoning an NSMenu entirely and using an NSView instead - haven't tried this yet but I don't really want to

How does Apple update the Airport menu while it is open? (How to change NSMenu when it is already open)

社会主义新天地 提交于 2019-11-27 06:30:25
I've got a statusbar item that pops open an NSMenu, and I have a delegate set and it's hooked up correctly ( -(void)menuNeedsUpdate:(NSMenu *)menu works fine). That said, that method is setup to be called before the menu is displayed, I need to listen for that and trigger an asynchronous request, later updating the menu while it is open, and I can't figure out how that's supposed to be done. Thanks :) EDIT Ok, I'm now here: When you click on the menu item (in the status bar), a selector is called that runs an NSTask. I use the notification center to listen for when that task is finished, and

Gap above NSMenuItem custom view

和自甴很熟 提交于 2019-11-27 03:41:45
I am using the setView: method on an NSMenuItem to set a custom view. In this custom view there is an image which takes the whole of the view. The NSMenuItem with this custom view is the first in the menu but the problem is it doesn't sit flush with the top of the menu, there is a big gap as you can see here: Why is this happening and how can I stop it? EDIT I am using this code now but I am getting EXC_BAD_ACCESS on the line InstallControlEventHandler . -(void)applicationDidFinishLaunching:(NSNotification *)aNotification { HIViewRef contentView; MenuRef menuRef = [statusMenu carbonMenuRef];

How does Apple update the Airport menu while it is open? (How to change NSMenu when it is already open)

筅森魡賤 提交于 2019-11-26 12:00:37
问题 I\'ve got a statusbar item that pops open an NSMenu, and I have a delegate set and it\'s hooked up correctly ( -(void)menuNeedsUpdate:(NSMenu *)menu works fine). That said, that method is setup to be called before the menu is displayed, I need to listen for that and trigger an asynchronous request, later updating the menu while it is open, and I can\'t figure out how that\'s supposed to be done. Thanks :) EDIT Ok, I\'m now here: When you click on the menu item (in the status bar), a selector

Gap above NSMenuItem custom view

孤街浪徒 提交于 2019-11-26 10:36:11
问题 I am using the setView: method on an NSMenuItem to set a custom view. In this custom view there is an image which takes the whole of the view. The NSMenuItem with this custom view is the first in the menu but the problem is it doesn\'t sit flush with the top of the menu, there is a big gap as you can see here: Why is this happening and how can I stop it? EDIT I am using this code now but I am getting EXC_BAD_ACCESS on the line InstallControlEventHandler . -(void)applicationDidFinishLaunching: