| OLD | NEW |
| 1 // Copyright (c) 2010 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 "chrome/browser/cocoa/extensions/browser_actions_container_view.h" | 5 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 middleColor, (CGFloat)0.5, | 85 middleColor, (CGFloat)0.5, |
| 86 endPointColor, (CGFloat)1.0, | 86 endPointColor, (CGFloat)1.0, |
| 87 nil]); | 87 nil]); |
| 88 CGFloat xPos = bounds.origin.x + bounds.size.width - kRightBorderWidth + | 88 CGFloat xPos = bounds.origin.x + bounds.size.width - kRightBorderWidth + |
| 89 kRightBorderXOffset; | 89 kRightBorderXOffset; |
| 90 NSRect borderRect = NSMakeRect(xPos, kLowerPadding, kRightBorderWidth, | 90 NSRect borderRect = NSMakeRect(xPos, kLowerPadding, kRightBorderWidth, |
| 91 bounds.size.height - kUpperPadding); | 91 bounds.size.height - kUpperPadding); |
| 92 [borderGradient drawInRect:borderRect angle:90.0]; | 92 [borderGradient drawInRect:borderRect angle:90.0]; |
| 93 } | 93 } |
| 94 | 94 |
| 95 [self drawGrippy]; | 95 if (resizable_) |
| 96 [self drawGrippy]; |
| 96 } | 97 } |
| 97 | 98 |
| 98 - (void)resetCursorRects { | 99 - (void)resetCursorRects { |
| 99 [self discardCursorRects]; | 100 [self discardCursorRects]; |
| 100 [self addCursorRect:grippyRect_ cursor:[self appropriateCursorForGrippy]]; | 101 [self addCursorRect:grippyRect_ cursor:[self appropriateCursorForGrippy]]; |
| 101 } | 102 } |
| 102 | 103 |
| 103 - (BOOL)acceptsFirstResponder { | 104 - (BOOL)acceptsFirstResponder { |
| 104 return YES; | 105 return YES; |
| 105 } | 106 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 retVal = [NSCursor resizeRightCursor]; | 209 retVal = [NSCursor resizeRightCursor]; |
| 209 } else if (!canDragRight_) { | 210 } else if (!canDragRight_) { |
| 210 retVal = [NSCursor resizeLeftCursor]; | 211 retVal = [NSCursor resizeLeftCursor]; |
| 211 } else { | 212 } else { |
| 212 retVal = [NSCursor resizeLeftRightCursor]; | 213 retVal = [NSCursor resizeLeftRightCursor]; |
| 213 } | 214 } |
| 214 return retVal; | 215 return retVal; |
| 215 } | 216 } |
| 216 | 217 |
| 217 - (void)drawGrippy { | 218 - (void)drawGrippy { |
| 218 if (!resizable_) | |
| 219 return; | |
| 220 | |
| 221 NSRect grippyRect = NSMakeRect(0.0, kLowerPadding + kGrippyLowerPadding, 1.0, | 219 NSRect grippyRect = NSMakeRect(0.0, kLowerPadding + kGrippyLowerPadding, 1.0, |
| 222 [self bounds].size.height - kUpperPadding - kGrippyUpperPadding); | 220 [self bounds].size.height - kUpperPadding - kGrippyUpperPadding); |
| 223 [[NSColor colorWithCalibratedWhite:0.7 alpha:0.5] set]; | 221 [[NSColor colorWithCalibratedWhite:0.7 alpha:0.5] set]; |
| 224 NSRectFill(grippyRect); | 222 NSRectFill(grippyRect); |
| 225 | 223 |
| 226 [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] set]; | 224 [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] set]; |
| 227 grippyRect.origin.x += 1.0; | 225 grippyRect.origin.x += 1.0; |
| 228 NSRectFill(grippyRect); | 226 NSRectFill(grippyRect); |
| 229 | 227 |
| 230 grippyRect.origin.x += 1.0; | 228 grippyRect.origin.x += 1.0; |
| 231 | 229 |
| 232 [[NSColor colorWithCalibratedWhite:0.7 alpha:0.5] set]; | 230 [[NSColor colorWithCalibratedWhite:0.7 alpha:0.5] set]; |
| 233 grippyRect.origin.x += 1.0; | 231 grippyRect.origin.x += 1.0; |
| 234 NSRectFill(grippyRect); | 232 NSRectFill(grippyRect); |
| 235 | 233 |
| 236 [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] set]; | 234 [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] set]; |
| 237 grippyRect.origin.x += 1.0; | 235 grippyRect.origin.x += 1.0; |
| 238 NSRectFill(grippyRect); | 236 NSRectFill(grippyRect); |
| 239 } | 237 } |
| 240 | 238 |
| 241 @end | 239 @end |
| OLD | NEW |