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

Side by Side Diff: chrome/browser/cocoa/hover_close_button.h

Issue 2805055: [Mac] Use Core Graphics to draw the close button used within tabs, infobars, ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 8
9 // The standard close button for our Mac UI which is the "x" 9 // The standard close button for our Mac UI which is the "x" that changes to a
10 // that changes to the red circle with the "x" when you hover over it. 10 // dark circle with the "x" when you hover over it. At this time it is used by
11 // At this time it is used by the popup blocker, download bar, info bar 11 // the popup blocker, download bar, info bar and tabs.
12 // and tabs.
13 @interface HoverCloseButton : NSButton { 12 @interface HoverCloseButton : NSButton {
14 // Tracking area for close button mouseover images. 13 @private
14 // Enumeration of the hover states that the close button can be in at any one
15 // time. The button cannot be in more than one hover state at a time.
16 enum HoverState {
17 kHoverStateNone = 0,
18 kHoverStateMouseOver = 1,
19 kHoverStateMouseDown = 2
20 };
21
22 HoverState hoverState_;
23
24 // Tracking area for close button mouseover states.
15 scoped_nsobject<NSTrackingArea> closeTrackingArea_; 25 scoped_nsobject<NSTrackingArea> closeTrackingArea_;
26
27 // Bezier path for drawing the 'x' within the button.
28 scoped_nsobject<NSBezierPath> xPath_;
29
30 // Bezier path for drawing the hover state circle behind the 'x'.
31 scoped_nsobject<NSBezierPath> circlePath_;
16 } 32 }
17 33
18 // Enables or disables the |NSTrackingRect|s for the button. 34 // Enables or disables the |NSTrackingRect|s for the button.
19 - (void)setTrackingEnabled:(BOOL)enabled; 35 - (void)setTrackingEnabled:(BOOL)enabled;
20 36
21 // Sets up the button's images, tracking areas, and accessibility info 37 // Sets up the button's tracking areas and accessibility info when instantiated
22 // when instantiated via initWithFrame or awakeFromNib. 38 // via initWithFrame or awakeFromNib.
23 - (void)commonInit; 39 - (void)commonInit;
24 40
25 // Checks to see whether the mouse is in the button's bounds and update 41 // Checks to see whether the mouse is in the button's bounds and update
26 // the image in case it gets out of sync. This occurs when you close a 42 // the image in case it gets out of sync. This occurs when you close a
27 // tab so the tab to the left of it takes its place, and drag the button 43 // tab so the tab to the left of it takes its place, and drag the button
28 // without moving the mouse before you press the button down. 44 // without moving the mouse before you press the button down.
29 - (void)checkImageState; 45 - (void)checkImageState;
30 46
31 @end 47 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698