Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 // This view controller manages the menu item XIB. | 52 // This view controller manages the menu item XIB. |
| 53 @interface AvatarMenuItemController : NSViewController { | 53 @interface AvatarMenuItemController : NSViewController { |
| 54 @private | 54 @private |
| 55 // The parent menu controller; owns this. | 55 // The parent menu controller; owns this. |
| 56 __weak AvatarMenuBubbleController* controller_; | 56 __weak AvatarMenuBubbleController* controller_; |
| 57 | 57 |
| 58 // The AvatarMenuModel::item.model_index field. | 58 // The AvatarMenuModel::item.model_index field. |
| 59 size_t modelIndex_; | 59 size_t modelIndex_; |
| 60 | 60 |
| 61 // Tracks wheter this item is currently highlighted. | |
| 62 BOOL isHighlighted_; | |
| 63 | |
| 61 // Instance variables that back the outlets. | 64 // Instance variables that back the outlets. |
| 62 __weak NSImageView* iconView_; | 65 __weak NSImageView* iconView_; |
| 63 __weak NSImageView* activeView_; | 66 __weak NSImageView* activeView_; |
| 64 __weak NSTextField* nameField_; | 67 __weak NSTextField* nameField_; |
| 65 // These two views sit on top of each other, and only one is visible at a | 68 // These two views sit on top of each other, and only one is visible at a |
| 66 // time. The editButton_ is visible when the mouse is over the item and the | 69 // time. The editButton_ is visible when the mouse is over the item and the |
| 67 // emailField_ is visible otherwise. | 70 // emailField_ is visible otherwise. |
| 68 __weak NSTextField* emailField_; | 71 __weak NSTextField* emailField_; |
| 69 __weak NSButton* editButton_; | 72 __weak NSButton* editButton_; |
| 70 } | 73 } |
| 71 @property(readonly, nonatomic) size_t modelIndex; | 74 @property(readonly, nonatomic) size_t modelIndex; |
| 75 @property(assign, nonatomic) BOOL isHighlighted; | |
|
Robert Sesek
2011/10/24 19:07:04
Could you instead make the view key and test for t
sail
2011/10/24 19:16:38
Currently we highlight on mouse over too. I think
Robert Sesek
2011/10/24 19:25:53
OK.
| |
| 72 @property(assign, nonatomic) IBOutlet NSImageView* iconView; | 76 @property(assign, nonatomic) IBOutlet NSImageView* iconView; |
| 73 @property(assign, nonatomic) IBOutlet NSImageView* activeView; | 77 @property(assign, nonatomic) IBOutlet NSImageView* activeView; |
| 74 @property(assign, nonatomic) IBOutlet NSTextField* nameField; | 78 @property(assign, nonatomic) IBOutlet NSTextField* nameField; |
| 75 @property(assign, nonatomic) IBOutlet NSTextField* emailField; | 79 @property(assign, nonatomic) IBOutlet NSTextField* emailField; |
| 76 @property(assign, nonatomic) IBOutlet NSButton* editButton; | 80 @property(assign, nonatomic) IBOutlet NSButton* editButton; |
| 77 | 81 |
| 78 // Designated initializer. | 82 // Designated initializer. |
| 79 - (id)initWithModelIndex:(size_t)modelIndex | 83 - (id)initWithModelIndex:(size_t)modelIndex |
| 80 menuController:(AvatarMenuBubbleController*)controller; | 84 menuController:(AvatarMenuBubbleController*)controller; |
| 81 | 85 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 95 // view controller for changing highlight style of the item subviews. This is | 99 // view controller for changing highlight style of the item subviews. This is |
| 96 // an invisible button that underlays most of the menu item and is responsible | 100 // an invisible button that underlays most of the menu item and is responsible |
| 97 // for performing the switch profile action. | 101 // for performing the switch profile action. |
| 98 @interface AvatarMenuItemView : NSView { | 102 @interface AvatarMenuItemView : NSView { |
| 99 @private | 103 @private |
| 100 // The controller that manages this. | 104 // The controller that manages this. |
| 101 __weak AvatarMenuItemController* viewController_; | 105 __weak AvatarMenuItemController* viewController_; |
| 102 | 106 |
| 103 // Used to highlight the background on hover. | 107 // Used to highlight the background on hover. |
| 104 ScopedCrTrackingArea trackingArea_; | 108 ScopedCrTrackingArea trackingArea_; |
| 105 | |
| 106 // Whether the mouse is inside the bounds of this view. | |
| 107 BOOL mouseInside_; | |
| 108 } | 109 } |
| 109 @property(assign, nonatomic) IBOutlet AvatarMenuItemController* viewController; | 110 @property(assign, nonatomic) IBOutlet AvatarMenuItemController* viewController; |
| 110 @end | 111 @end |
| 111 | 112 |
| 112 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
| 113 | 114 |
| 114 @interface AccessibilityIgnoredImageCell : NSImageCell | 115 @interface AccessibilityIgnoredImageCell : NSImageCell |
| 115 @end | 116 @end |
| 116 | 117 |
| 117 @interface AccessibilityIgnoredTextFieldCell : NSTextFieldCell | 118 @interface AccessibilityIgnoredTextFieldCell : NSTextFieldCell |
| 118 @end | 119 @end |
| 119 | 120 |
| 120 // Testing API ///////////////////////////////////////////////////////////////// | 121 // Testing API ///////////////////////////////////////////////////////////////// |
| 121 | 122 |
| 122 @interface AvatarMenuBubbleController (ExposedForTesting) | 123 @interface AvatarMenuBubbleController (ExposedForTesting) |
| 123 - (id)initWithModel:(AvatarMenuModel*)model | 124 - (id)initWithModel:(AvatarMenuModel*)model |
| 124 bridge:(AvatarMenuModelObserver*)bridge | 125 bridge:(AvatarMenuModelObserver*)bridge |
| 125 parentWindow:(NSWindow*)parent | 126 parentWindow:(NSWindow*)parent |
| 126 anchoredAt:(NSPoint)point; | 127 anchoredAt:(NSPoint)point; |
| 127 - (void)performLayout; | 128 - (void)performLayout; |
| 128 - (NSMutableArray*)items; | 129 - (NSMutableArray*)items; |
| 129 @end | 130 @end |
| 130 | 131 |
| 131 @interface AvatarMenuItemController (ExposedForTesting) | 132 @interface AvatarMenuItemController (ExposedForTesting) |
| 132 - (void)willStartAnimation:(NSAnimation*)animation; | 133 - (void)willStartAnimation:(NSAnimation*)animation; |
| 133 @end | 134 @end |
| 134 | 135 |
| 135 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ | 136 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_AVATAR_MENU_BUBBLE_CONTROLLER_H_ |
| OLD | NEW |