| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_nsobject.h" |
| 11 |
| 10 namespace info_bubble { | 12 namespace info_bubble { |
| 11 | 13 |
| 12 // These values are in view coordinates. | 14 // These values are in view coordinates. |
| 13 const CGFloat kBubbleArrowHeight = 8.0; | 15 const CGFloat kBubbleArrowHeight = 8.0; |
| 14 const CGFloat kBubbleArrowWidth = 15.0; | 16 const CGFloat kBubbleArrowWidth = 15.0; |
| 15 const CGFloat kBubbleCornerRadius = 2.0; | 17 const CGFloat kBubbleCornerRadius = 2.0; |
| 16 const CGFloat kBubbleArrowXOffset = kBubbleArrowWidth + kBubbleCornerRadius; | 18 const CGFloat kBubbleArrowXOffset = kBubbleArrowWidth + kBubbleCornerRadius; |
| 17 | 19 |
| 18 // Constants that define where the bubble will have rounded corners. | 20 // Constants that define where the bubble will have rounded corners. |
| 19 enum CornerFlags { | 21 enum CornerFlags { |
| 20 kRoundedTopCorners = 1, | 22 kRoundedTopCorners = 1, |
| 21 kRoundedBottomCorners = 1 << 1, | 23 kRoundedBottomCorners = 1 << 1, |
| 22 kRoundedAllCorners = kRoundedTopCorners | kRoundedBottomCorners, | 24 kRoundedAllCorners = kRoundedTopCorners | kRoundedBottomCorners, |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 enum BubbleArrowLocation { | 27 enum BubbleArrowLocation { |
| 26 kTopLeft, | 28 kTopLeft, |
| 27 kTopRight, | 29 kTopRight, |
| 28 kNoArrow, | 30 kNoArrow, |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 enum BubbleAlignment { | 33 enum BubbleAlignment { |
| 32 // The tip of the arrow points to the anchor point. | 34 // The tip of the arrow points to the anchor point. |
| 33 kAlignArrowToAnchor, | 35 kAlignArrowToAnchor, |
| 34 // The edge nearest to the arrow is lined up with the anchor point. | 36 // The edge nearest to the arrow is lined up with the anchor point. |
| 35 kAlignEdgeToAnchorEdge, | 37 kAlignEdgeToAnchorEdge, |
| 38 // Align the right edge to the anchor point. |
| 39 kAlignRightEdgeToAnchorEdge, |
| 40 // Align the left edge to the anchor point. |
| 41 kAlignLeftEdgeToAnchorEdge, |
| 36 }; | 42 }; |
| 37 | 43 |
| 38 } // namespace info_bubble | 44 } // namespace info_bubble |
| 39 | 45 |
| 40 // Content view for a bubble with an arrow showing arbitrary content. | 46 // Content view for a bubble with an arrow showing arbitrary content. |
| 41 // This is where nonrectangular drawing happens. | 47 // This is where nonrectangular drawing happens. |
| 42 @interface InfoBubbleView : NSView { | 48 @interface InfoBubbleView : NSView { |
| 43 @private | 49 @private |
| 44 info_bubble::BubbleArrowLocation arrowLocation_; | 50 info_bubble::BubbleArrowLocation arrowLocation_; |
| 45 info_bubble::BubbleAlignment alignment_; | 51 info_bubble::BubbleAlignment alignment_; |
| 46 info_bubble::CornerFlags cornerFlags_; | 52 info_bubble::CornerFlags cornerFlags_; |
| 53 scoped_nsobject<NSColor> backgroundColor_; |
| 47 } | 54 } |
| 48 | 55 |
| 49 @property(assign, nonatomic) info_bubble::BubbleArrowLocation arrowLocation; | 56 @property(assign, nonatomic) info_bubble::BubbleArrowLocation arrowLocation; |
| 50 @property(assign, nonatomic) info_bubble::BubbleAlignment alignment; | 57 @property(assign, nonatomic) info_bubble::BubbleAlignment alignment; |
| 51 @property(assign, nonatomic) info_bubble::CornerFlags cornerFlags; | 58 @property(assign, nonatomic) info_bubble::CornerFlags cornerFlags; |
| 52 | 59 |
| 53 // Returns the point location in view coordinates of the tip of the arrow. | 60 // Returns the point location in view coordinates of the tip of the arrow. |
| 54 - (NSPoint)arrowTip; | 61 - (NSPoint)arrowTip; |
| 55 | 62 |
| 63 // Gets and sets the bubble's background color. |
| 64 - (NSColor*)backgroundColor; |
| 65 - (void)setBackgroundColor:(NSColor*)backgroundColor; |
| 66 |
| 56 @end | 67 @end |
| 57 | 68 |
| 58 #endif // CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ | 69 #endif // CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_VIEW_H_ |
| OLD | NEW |