Skip to content

Commit a74c371

Browse files
committed
View commands checked state on MacOS.
1 parent 914224c commit a74c371

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Sources/MacOSAppSupport/MAS_CocoaAppUtils.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ - (ContextMenu*) addGroupMenuItem : (NSString*) name
2626
return subMenu;
2727
}
2828

29-
- (void) addMenuItem : (NSString*) name : (int) tag : (ContextMenu*) target
29+
- (void) addMenuItem : (NSString*) name : (bool) isChecked : (int) tag : (ContextMenu*) target
3030
{
3131
NSMenuItem* item = [self addItemWithTitle : name action : @selector(onItemSelected:) keyEquivalent : @""];
32+
[item setState : isChecked ? NSControlStateValueOn : NSControlStateValueOff];
3233
[item setTarget : target];
3334
[item setTag : tag];
3435
}
@@ -124,7 +125,7 @@ static void AddCommandToMenu (const NUIE::MenuCommandPtr& command, std::unordere
124125
});
125126
currentMenu = oldMenu;
126127
} else {
127-
[currentMenu addMenuItem:StdWStringToNSString (command->GetName ()) : currentCommandId : originalMenu];
128+
[currentMenu addMenuItem:StdWStringToNSString (command->GetName ()) : command->IsChecked () : currentCommandId : originalMenu];
128129
commandTable.insert ({ currentCommandId, command });
129130
currentCommandId += 1;
130131
}

0 commit comments

Comments
 (0)