summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/autoseparating_menu.m
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa/autoseparating_menu.m')
-rw-r--r--chrome/browser/cocoa/autoseparating_menu.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/autoseparating_menu.m b/chrome/browser/cocoa/autoseparating_menu.m
new file mode 100644
index 0000000..e0f36a7
--- /dev/null
+++ b/chrome/browser/cocoa/autoseparating_menu.m
@@ -0,0 +1,26 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/cocoa/autoseparating_menu.h"
+
+@implementation AutoseparatingMenu
+
+- (NSMenuItem *)insertItemWithTitle:(NSString *)aString
+ action:(SEL)aSelector
+ keyEquivalent:(NSString *)keyEquiv
+ atIndex:(NSInteger)index {
+ if ([aString isEqualToString:@"-"]) {
+ NSMenuItem* separator = [NSMenuItem separatorItem];
+ [self insertItem:separator
+ atIndex:index];
+ return separator;
+ } else {
+ return [super insertItemWithTitle:aString
+ action:aSelector
+ keyEquivalent:keyEquiv
+ atIndex:index];
+ }
+}
+
+@end