Chromium Code Reviews| Index: views/bubble/bubble_border.h |
| diff --git a/views/bubble/bubble_border.h b/views/bubble/bubble_border.h |
| index edca71e0b6ce17581c96f5002e0617d7dc6506c6..464b26310b026eb5534d06815ec767b315d6db54 100644 |
| --- a/views/bubble/bubble_border.h |
| +++ b/views/bubble/bubble_border.h |
| @@ -13,6 +13,22 @@ class SkBitmap; |
| namespace views { |
| +struct BorderImages { |
|
sky
2011/11/15 05:06:37
Forward declare this as a struct in BubbleBorder.
koz (OOO until 15th September)
2011/11/15 06:35:43
I'm not sure I've understood you here - I've added
sky
2011/11/15 16:36:33
Close. Since you don't actually need the implement
koz (OOO until 15th September)
2011/11/15 22:45:39
Thanks for the clarification. Done.
|
| + SkBitmap* left; |
| + SkBitmap* top_left; |
| + SkBitmap* top; |
| + SkBitmap* top_right; |
| + SkBitmap* right; |
| + SkBitmap* bottom_right; |
| + SkBitmap* bottom; |
| + SkBitmap* bottom_left; |
| + SkBitmap* left_arrow; |
| + SkBitmap* top_arrow; |
| + SkBitmap* right_arrow; |
| + SkBitmap* bottom_arrow; |
| +}; |
| + |
|
sky
2011/11/15 05:06:37
nit: remove one of these lines.
koz (OOO until 15th September)
2011/11/15 06:35:43
Done.
|
| + |
| // Renders a border, with optional arrow, and a custom dropshadow. |
| // This can be used to produce floating "bubble" objects with rounded corners. |
| class VIEWS_EXPORT BubbleBorder : public views::Border { |
| @@ -34,6 +50,11 @@ class VIEWS_EXPORT BubbleBorder : public views::Border { |
| FLOAT = 9 // No arrow. Centered over the supplied rect. |
| }; |
| + enum Shadow { |
| + SHADOW = 0, |
| + NO_SHADOW = 1 |
| + }; |
| + |
| // The position of the bubble in relation to the anchor. |
| enum BubbleAlignment { |
| // The tip of the arrow points to the middle of the anchor. |
| @@ -42,12 +63,12 @@ class VIEWS_EXPORT BubbleBorder : public views::Border { |
| ALIGN_EDGE_TO_ANCHOR_EDGE |
| }; |
| - explicit BubbleBorder(ArrowLocation arrow_location) |
| + BubbleBorder(ArrowLocation arrow_location, Shadow shadow) |
| : override_arrow_offset_(0), |
| arrow_location_(arrow_location), |
| alignment_(ALIGN_ARROW_TO_MID_ANCHOR), |
| background_color_(SK_ColorWHITE) { |
| - InitClass(); |
| + InitClass(shadow); |
| } |
| // Returns the radius of the corner of the border. |
| @@ -118,7 +139,7 @@ class VIEWS_EXPORT BubbleBorder : public views::Border { |
| private: |
| // Loads images if necessary. |
| - static void InitClass(); |
| + void InitClass(Shadow shadow); |
| virtual ~BubbleBorder(); |
| @@ -143,21 +164,25 @@ class VIEWS_EXPORT BubbleBorder : public views::Border { |
| int shift_y) const; |
| // Border graphics. |
| - static SkBitmap* left_; |
| - static SkBitmap* top_left_; |
| - static SkBitmap* top_; |
| - static SkBitmap* top_right_; |
| - static SkBitmap* right_; |
| - static SkBitmap* bottom_right_; |
| - static SkBitmap* bottom_; |
| - static SkBitmap* bottom_left_; |
| - static SkBitmap* left_arrow_; |
| - static SkBitmap* top_arrow_; |
| - static SkBitmap* right_arrow_; |
| - static SkBitmap* bottom_arrow_; |
| + SkBitmap* left_; |
|
sky
2011/11/15 05:06:37
It's weird to have this and the struct. How about
koz (OOO until 15th September)
2011/11/15 06:35:43
Done.
|
| + SkBitmap* top_left_; |
| + SkBitmap* top_; |
| + SkBitmap* top_right_; |
| + SkBitmap* right_; |
| + SkBitmap* bottom_right_; |
| + SkBitmap* bottom_; |
| + SkBitmap* bottom_left_; |
| + SkBitmap* left_arrow_; |
| + SkBitmap* top_arrow_; |
| + SkBitmap* right_arrow_; |
| + SkBitmap* bottom_arrow_; |
| + |
| + // Image bundles. |
| + static struct BorderImages* normal_images_; |
| + static struct BorderImages* shadow_images_; |
| // Minimal offset of the arrow from the closet edge of bounding rect. |
| - static int arrow_offset_; |
| + int arrow_offset_; |
| // If specified, overrides the pre-calculated |arrow_offset_| of the arrow. |
| int override_arrow_offset_; |