Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: ui/base/cocoa/hover_button.h

Issue 2898343002: [Mac] Update tab close button when user drags outside (Closed)
Patch Set: Add retain, comment on key events. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.mm ('k') | ui/base/cocoa/hover_button.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 UI_BASE_COCOA_HOVER_BUTTON_ 5 #ifndef UI_BASE_COCOA_HOVER_BUTTON_
6 #define UI_BASE_COCOA_HOVER_BUTTON_ 6 #define UI_BASE_COCOA_HOVER_BUTTON_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #import "ui/base/cocoa/tracking_area.h" 10 #import "ui/base/cocoa/tracking_area.h"
11 #import "ui/base/ui_base_export.h" 11 #import "ui/base/ui_base_export.h"
12 12
13 // A button that changes when you hover over it and click it. 13 // A button that changes when you hover over it and click it.
14 UI_BASE_EXPORT 14 UI_BASE_EXPORT
15 @interface HoverButton : NSButton { 15 @interface HoverButton : NSButton {
16 @protected 16 @protected
17 // Enumeration of the hover states that the close button can be in at any one 17 // Enumeration of the hover states that the close button can be in at any one
18 // time. The button cannot be in more than one hover state at a time. 18 // time. The button cannot be in more than one hover state at a time.
19 enum HoverState { 19 enum HoverState {
20 kHoverStateNone = 0, 20 kHoverStateNone = 0,
21 kHoverStateMouseOver = 1, 21 kHoverStateMouseOver = 1,
22 kHoverStateMouseDown = 2 22 kHoverStateMouseDown = 2
23 }; 23 };
24 24
25 HoverState hoverState_; 25 HoverState hoverState_;
26 26
27 @private 27 @private
28 // Tracking area for button mouseover states. Nil if not enabled. 28 // Tracking area for button mouseover states. Nil if not enabled.
29 ui::ScopedCrTrackingArea trackingArea_; 29 ui::ScopedCrTrackingArea trackingArea_;
30 BOOL mouseDown_;
30 } 31 }
31 32
32 @property(nonatomic) HoverState hoverState; 33 @property(nonatomic) HoverState hoverState;
33 34
35 // Common initialization called from initWithFrame: and awakeFromNib.
36 // Subclassers should call [super commonInit].
37 - (void)commonInit;
38
34 // Text that would be announced by screen readers. 39 // Text that would be announced by screen readers.
35 - (void)setAccessibilityTitle:(NSString*)accessibilityTitle; 40 - (void)setAccessibilityTitle:(NSString*)accessibilityTitle;
36 41
37 // Enables or disables the tracking for the button. 42 // Enables or disables the tracking for the button.
38 - (void)setTrackingEnabled:(BOOL)enabled; 43 - (void)setTrackingEnabled:(BOOL)enabled;
39 44
40 // Checks to see whether the mouse is in the button's bounds and update 45 // Checks to see whether the mouse is in the button's bounds and update
41 // the image in case it gets out of sync. This occurs to the close button 46 // the image in case it gets out of sync. This occurs to the close button
42 // when you close a tab so the tab to the left of it takes its place, and 47 // when you close a tab so the tab to the left of it takes its place, and
43 // drag the button without moving the mouse before you press the button down. 48 // drag the button without moving the mouse before you press the button down.
44 - (void)checkImageState; 49 - (void)checkImageState;
45 50
46 @end 51 @end
47 52
48 #endif // UI_BASE_COCOA_HOVER_BUTTON_ 53 #endif // UI_BASE_COCOA_HOVER_BUTTON_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/hover_close_button.mm ('k') | ui/base/cocoa/hover_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698