1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_
6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_
8 #import <Cocoa/Cocoa.h>
10 #import "ui/base/cocoa/tracking_area.h"
12 namespace constrained_window_button {
13 const CGFloat kButtonMinWidth = 72;
16 @protocol ConstrainedWindowButtonDrawableCell
17 @property (nonatomic, assign) BOOL isMouseInside;
19 - (BOOL)isHighlighted;
22 // A push button for use in a constrained window. Specialized constrained
23 // windows that need a push button should use this class instead of NSButton.
24 @interface ConstrainedWindowButton : NSButton {
26 ui::ScopedCrTrackingArea trackingArea_;
29 extern const CGFloat buttonMinWidth_;
31 // Draws the background and shadow inside |path| with the appropriate
32 // colors for |buttonState|, onto |view|.
33 + (void)DrawBackgroundAndShadowForPath:(NSBezierPath*)path
34 withCell:(id<ConstrainedWindowButtonDrawableCell>)cell
37 // Draws the highlight inside |path|, with the color for |buttonState|,
39 + (void)DrawInnerHighlightForPath:(NSBezierPath*)path
40 withCell:(id<ConstrainedWindowButtonDrawableCell>)cell
43 // Draws the border along |path|, with a color according to |buttonState|,
45 + (void)DrawBorderForPath:(NSBezierPath*)path
46 withCell:(id<ConstrainedWindowButtonDrawableCell>)cell
50 // A button cell used by ConstrainedWindowButton.
51 @interface ConstrainedWindowButtonCell :
52 NSButtonCell<ConstrainedWindowButtonDrawableCell> {
59 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_