Permalink
Browse files

[OSX] Fix mnemonics support

  • Loading branch information...
milani committed Nov 6, 2012
1 parent 0c6a9eb commit 8b53576d6c65b97e3d2d94381a37c55e89526d37
Showing with 9 additions and 0 deletions.
  1. +8 −0 lib/menu.js
  2. +1 −0 src/native_menu/native_menu_mac.mm
View
@@ -29,6 +29,14 @@ var normalizeItems = function(options){
var normalizeMnemonic = function(options){
+ // OSX does not support mnemonics for menu,
+ // it only supports submenu mnemonics
+ if( process.platform = 'darwin') {
+ for(i in options) {
+ options[i]['label'] = options[i]['label'].replace(/(&)(\w)/g,'$2');
+ }
+ }
+
if( process.platform != 'linux') {
return;
}
@@ -91,6 +91,7 @@ - (void)handleAction:(id)sender {
[menuItem setImage:[[NSImage alloc] initByReferencingFile:icon]];
}
[menuItem setEnabled:YES];
+ [menuItem setTitleWithMnemonic:label];
Settings* subsettings = new Settings(item->getObject("submenu"));
NSMenu* submenu = [[NSMenu alloc] initWithTitle:label];

0 comments on commit 8b53576

Please sign in to comment.