OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_BASE_COCOA_MENU_CONTROLLER_H_ | 5 #ifndef UI_BASE_COCOA_MENU_CONTROLLER_H_ |
6 #define UI_BASE_COCOA_MENU_CONTROLLER_H_ | 6 #define UI_BASE_COCOA_MENU_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 base::scoped_nsobject<NSMenu> menu_; | 28 base::scoped_nsobject<NSMenu> menu_; |
29 BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank | 29 BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank |
30 BOOL isMenuOpen_; | 30 BOOL isMenuOpen_; |
31 } | 31 } |
32 | 32 |
33 @property(nonatomic, assign) ui::MenuModel* model; | 33 @property(nonatomic, assign) ui::MenuModel* model; |
34 // Note that changing this will have no effect if you use | 34 // Note that changing this will have no effect if you use |
35 // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. | 35 // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. |
36 @property(nonatomic) BOOL useWithPopUpButtonCell; | 36 @property(nonatomic) BOOL useWithPopUpButtonCell; |
37 | 37 |
38 + (string16)elideMenuTitle:(const base::string16&)title | 38 + (base::string16)elideMenuTitle:(const base::string16&)title |
39 toWidth:(int)width; | 39 toWidth:(int)width; |
40 | 40 |
41 // NIB-based initializer. This does not create a menu. Clients can set the | 41 // NIB-based initializer. This does not create a menu. Clients can set the |
42 // properties of the object and the menu will be created upon the first call to | 42 // properties of the object and the menu will be created upon the first call to |
43 // |-menu|. Note that the menu will be immutable after creation. | 43 // |-menu|. Note that the menu will be immutable after creation. |
44 - (id)init; | 44 - (id)init; |
45 | 45 |
46 // Builds a NSMenu from the pre-built model (must not be nil). Changes made | 46 // Builds a NSMenu from the pre-built model (must not be nil). Changes made |
47 // to the contents of the model after calling this will not be noticed. If | 47 // to the contents of the model after calling this will not be noticed. If |
48 // the menu will be displayed by a NSPopUpButtonCell, it needs to be of a | 48 // the menu will be displayed by a NSPopUpButtonCell, it needs to be of a |
49 // slightly different form (0th item is empty). Note this attribute of the menu | 49 // slightly different form (0th item is empty). Note this attribute of the menu |
(...skipping 29 matching lines...) Expand all Loading... |
79 atIndex:(NSInteger)index | 79 atIndex:(NSInteger)index |
80 fromModel:(ui::MenuModel*)model; | 80 fromModel:(ui::MenuModel*)model; |
81 - (NSMenu*)menuFromModel:(ui::MenuModel*)model; | 81 - (NSMenu*)menuFromModel:(ui::MenuModel*)model; |
82 // Returns the maximum width for the menu item. Returns -1 to indicate | 82 // Returns the maximum width for the menu item. Returns -1 to indicate |
83 // that there's no maximum width. | 83 // that there's no maximum width. |
84 - (int)maxWidthForMenuModel:(ui::MenuModel*)model | 84 - (int)maxWidthForMenuModel:(ui::MenuModel*)model |
85 modelIndex:(int)modelIndex; | 85 modelIndex:(int)modelIndex; |
86 @end | 86 @end |
87 | 87 |
88 #endif // UI_BASE_COCOA_MENU_CONTROLLER_H_ | 88 #endif // UI_BASE_COCOA_MENU_CONTROLLER_H_ |
OLD | NEW |