| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // allow for hierarchical menus). The tag is the index into that model for | 21 // allow for hierarchical menus). The tag is the index into that model for |
| 22 // that particular item. It is important that the model outlives this object | 22 // that particular item. It is important that the model outlives this object |
| 23 // as it only maintains weak references. | 23 // as it only maintains weak references. |
| 24 @interface MenuController : NSObject<NSMenuDelegate> { | 24 @interface MenuController : NSObject<NSMenuDelegate> { |
| 25 @protected | 25 @protected |
| 26 ui::MenuModel* model_; // weak | 26 ui::MenuModel* model_; // weak |
| 27 scoped_nsobject<NSMenu> menu_; | 27 scoped_nsobject<NSMenu> menu_; |
| 28 BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank | 28 BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank |
| 29 } | 29 } |
| 30 | 30 |
| 31 @property (nonatomic, assign) ui::MenuModel* model; | 31 @property(nonatomic, assign) ui::MenuModel* model; |
| 32 // Note that changing this will have no effect if you use | 32 // Note that changing this will have no effect if you use |
| 33 // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. | 33 // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. |
| 34 @property (nonatomic) BOOL useWithPopUpButtonCell; | 34 @property(nonatomic) BOOL useWithPopUpButtonCell; |
| 35 | 35 |
| 36 // NIB-based initializer. This does not create a menu. Clients can set the | 36 // NIB-based initializer. This does not create a menu. Clients can set the |
| 37 // properties of the object and the menu will be created upon the first call to | 37 // properties of the object and the menu will be created upon the first call to |
| 38 // |-menu|. Note that the menu will be immutable after creation. | 38 // |-menu|. Note that the menu will be immutable after creation. |
| 39 - (id)init; | 39 - (id)init; |
| 40 | 40 |
| 41 // Builds a NSMenu from the pre-built model (must not be nil). Changes made | 41 // Builds a NSMenu from the pre-built model (must not be nil). Changes made |
| 42 // to the contents of the model after calling this will not be noticed. If | 42 // to the contents of the model after calling this will not be noticed. If |
| 43 // the menu will be displayed by a NSPopUpButtonCell, it needs to be of a | 43 // the menu will be displayed by a NSPopUpButtonCell, it needs to be of a |
| 44 // slightly different form (0th item is empty). Note this attribute of the menu | 44 // slightly different form (0th item is empty). Note this attribute of the menu |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 | 59 |
| 60 // Protected methods that subclassers can override. | 60 // Protected methods that subclassers can override. |
| 61 @interface MenuController (Protected) | 61 @interface MenuController (Protected) |
| 62 - (void)addItemToMenu:(NSMenu*)menu | 62 - (void)addItemToMenu:(NSMenu*)menu |
| 63 atIndex:(NSInteger)index | 63 atIndex:(NSInteger)index |
| 64 fromModel:(ui::MenuModel*)model | 64 fromModel:(ui::MenuModel*)model |
| 65 modelIndex:(int)modelIndex; | 65 modelIndex:(int)modelIndex; |
| 66 @end | 66 @end |
| 67 | 67 |
| 68 #endif // CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ | 68 #endif // CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ |
| OLD | NEW |