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. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_ 6 #define CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_ 7 8 #import <Cocoa/Cocoa.h> 9 10 #import "ui/base/cocoa/tracking_area.h" 11 12 namespace constrained_window_button { 13 const CGFloat kButtonMinWidth = 72; 14 } 15 16 @protocol ConstrainedWindowButtonDrawableCell 17 @property (nonatomic, assign) BOOL isMouseInside; 18 - (BOOL)isEnabled; 19 - (BOOL)isHighlighted; 20 @end 21 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 { 25 @private 26 ui::ScopedCrTrackingArea trackingArea_; 27 } 28 29 extern const CGFloat buttonMinWidth_; 30 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 35 inView:(NSView*)view; 36 37 // Draws the highlight inside |path|, with the color for |buttonState|, 38 // onto |view|. 39 + (void)DrawInnerHighlightForPath:(NSBezierPath*)path 40 withCell:(id<ConstrainedWindowButtonDrawableCell>)cell 41 inView:(NSView*)view; 42 43 // Draws the border along |path|, with a color according to |buttonState|, 44 // onto |view|. 45 + (void)DrawBorderForPath:(NSBezierPath*)path 46 withCell:(id<ConstrainedWindowButtonDrawableCell>)cell 47 inView:(NSView*)view; 48 @end 49 50 // A button cell used by ConstrainedWindowButton. 51 @interface ConstrainedWindowButtonCell : 52 NSButtonCell<ConstrainedWindowButtonDrawableCell> { 53 @private 54 BOOL isMouseInside_; 55 } 56 57 @end 58 59 #endif // CHROME_BROWSER_UI_COCOA_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_BUTTON_ 60