| Index: ui/views/bubble/bubble_border.h
|
| diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h
|
| index 17d1de7300fb126438d92b4210b69932e548c944..2cec24a2af04bde7ccdf9be88fa6cf5e961e902e 100644
|
| --- a/ui/views/bubble/bubble_border.h
|
| +++ b/ui/views/bubble/bubble_border.h
|
| @@ -39,7 +39,12 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
|
|
| enum Shadow {
|
| SHADOW = 0,
|
| - NO_SHADOW = 1
|
| + NO_SHADOW,
|
| +#if defined(USE_AURA)
|
| + BIG_SHADOW,
|
| + SMALL_SHADOW,
|
| +#endif
|
| + SHADOW_COUNT
|
| };
|
|
|
| // The position of the bubble in relation to the anchor.
|
| @@ -53,6 +58,7 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
| BubbleBorder(ArrowLocation arrow_location, Shadow shadow);
|
|
|
| // Returns the radius of the corner of the border.
|
| + // TODO(xiyuan): Get rid of this since it's part of BorderImages now?
|
| static int GetCornerRadius() {
|
| // We can't safely calculate a border radius by comparing the sizes of the
|
| // side and corner images, because either may have been extended in various
|
| @@ -101,6 +107,14 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
| void set_client_bounds(const gfx::Rect& bounds) { client_bounds_ = bounds; }
|
| const gfx::Rect& client_bounds() const { return client_bounds_; }
|
|
|
| + void set_relative_arrow_offset(int relative_arrow_offset) {
|
| + relative_arrow_offset_ = relative_arrow_offset;
|
| + }
|
| + int relative_arrow_offset() const { return relative_arrow_offset_; }
|
| +
|
| + void set_center_arrow(bool center_arrow) { center_arrow_ = center_arrow; }
|
| + bool center_arrow() const { return center_arrow_; }
|
| +
|
| // For borders with an arrow, gives the desired bounds (in screen coordinates)
|
| // given the rect to point to and the size of the contained contents. This
|
| // depends on the arrow location, so if you change that, you should call this
|
| @@ -108,10 +122,13 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
| virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
|
| const gfx::Size& contents_size) const;
|
|
|
| + // Returns the corner radius of current image set.
|
| + int GetBorderCornerRadius() const;
|
| +
|
| // Sets a fixed offset for the arrow from the beginning of corresponding edge.
|
| // The arrow will still point to the same location but the bubble will shift
|
| - // location to make that happen. Returns actuall arrow offset, in case of
|
| - // overflow it differ from desired.
|
| + // location to make that happen. Returns actual arrow offset, in case of
|
| + // overflow it differs from desired.
|
| int SetArrowOffset(int offset, const gfx::Size& contents_size);
|
|
|
| // Overridden from Border:
|
| @@ -151,12 +168,18 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
|
|
| void DrawArrowInterior(gfx::Canvas* canvas, float tip_x, float tip_y) const;
|
|
|
| + // Ensures that |arrow_offset| is in valid range so that border images are
|
| + // drawn correctly.
|
| + int SanitizeArrowOffset(int arrow_offset, const gfx::Size& border_size) const;
|
| +
|
| + // Calculates the arrow offset to use.
|
| + int CalculateArrowOffset(const gfx::Size& border_size) const;
|
| +
|
| // Border graphics.
|
| struct BorderImages* images_;
|
|
|
| // Image bundles.
|
| - static struct BorderImages* normal_images_;
|
| - static struct BorderImages* shadow_images_;
|
| + static struct BorderImages* border_images_[SHADOW_COUNT];
|
|
|
| // Minimal offset of the arrow from the closet edge of bounding rect.
|
| int arrow_offset_;
|
| @@ -164,6 +187,10 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
| // If specified, overrides the pre-calculated |arrow_offset_| of the arrow.
|
| int override_arrow_offset_;
|
|
|
| + // Relative offset to move current arrow. It is used for move bubble relative
|
| + // to its default position when it is off screen.
|
| + int relative_arrow_offset_;
|
| +
|
| ArrowLocation arrow_location_;
|
| BubbleAlignment alignment_;
|
| SkColor background_color_;
|
| @@ -172,6 +199,10 @@ class VIEWS_EXPORT BubbleBorder : public Border {
|
| // TODO(msw): Clean this up when Windows native controls are no longer needed.
|
| gfx::Rect client_bounds_;
|
|
|
| + // If true (default is false) and |override_arrow_offset_| is not specified,
|
| + // use arrow edge's center point as default arrow offset.
|
| + bool center_arrow_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BubbleBorder);
|
| };
|
|
|
|
|