diff options
author | sschmitz@chromium.org <sschmitz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-25 08:04:03 +0000 |
---|---|---|
committer | sschmitz@chromium.org <sschmitz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-25 08:04:03 +0000 |
commit | cc49fb44c7df45fefd3300d95e8ae2cea68942dc (patch) | |
tree | 41cc43ee551a9fc36725952b0a76e8a134299bb5 /ui/views/bubble | |
parent | fdf7658868ea51929eaf9404316a5817627d33d0 (diff) | |
download | chromium_src-cc49fb44c7df45fefd3300d95e8ae2cea68942dc.zip chromium_src-cc49fb44c7df45fefd3300d95e8ae2cea68942dc.tar.gz chromium_src-cc49fb44c7df45fefd3300d95e8ae2cea68942dc.tar.bz2 |
Removing arrow of bubble (popup) for volume and brightness.
This fix removes the "bubble arrow" for the volume and
brightness system tray bubbles. Added an init param for
that purpose. If set, the geometry is still computed as
it would be for a case with arrow, but the arrow is not
shown.
This is in contrast to a case, where no arrow is used at
all. In that case the geometry is different. For volume
and brightness we want to preserve the "arrow geometry"
but not show the arrow itself.
Reviewers:
stevenjb@ : overall
msw@ : as owner of ui/views/bubble/
BUG=170937
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/12041034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/bubble_border.cc | 14 | ||||
-rw-r--r-- | ui/views/bubble/bubble_border.h | 3 | ||||
-rw-r--r-- | ui/views/bubble/tray_bubble_view.cc | 4 | ||||
-rw-r--r-- | ui/views/bubble/tray_bubble_view.h | 1 |
4 files changed, 13 insertions, 9 deletions
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc index 92702b5..ae0bd89 100644 --- a/ui/views/bubble/bubble_border.cc +++ b/ui/views/bubble/bubble_border.cc @@ -402,20 +402,20 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) { const int height = bottom - top; const int width = right - left; - const ArrowLocation arrow_location = paint_arrow_ ? arrow_location_ : NONE; - // |arrow_offset| is offset of arrow from the beginning of the edge. int arrow_offset = GetArrowOffset(view.size()); - if (!is_arrow_at_center(arrow_location)) { - if (is_arrow_on_horizontal(arrow_location) && - !is_arrow_on_left(arrow_location)) { + if (!is_arrow_at_center(arrow_location_)) { + if (is_arrow_on_horizontal(arrow_location_) && + !is_arrow_on_left(arrow_location_)) { arrow_offset = view.width() - arrow_offset - 1; - } else if (!is_arrow_on_horizontal(arrow_location) && - !is_arrow_on_top(arrow_location)) { + } else if (!is_arrow_on_horizontal(arrow_location_) && + !is_arrow_on_top(arrow_location_)) { arrow_offset = view.height() - arrow_offset - 1; } } + const ArrowLocation arrow_location = paint_arrow_ ? arrow_location_ : NONE; + // Left edge. if (arrow_location == LEFT_TOP || arrow_location == LEFT_CENTER || diff --git a/ui/views/bubble/bubble_border.h b/ui/views/bubble/bubble_border.h index cf8514f..6745278 100644 --- a/ui/views/bubble/bubble_border.h +++ b/ui/views/bubble/bubble_border.h @@ -130,7 +130,8 @@ class VIEWS_EXPORT BubbleBorder : public Border { // location to make that happen. void set_arrow_offset(int offset) { override_arrow_offset_ = offset; } - // Sets whether the arrow is actually painted. Default is true. + // Sets whether the arrow is actually painted. If false, an arrow may still be + // used for the geometry computations, but it is not shown. Default is true. void set_paint_arrow(bool value) { paint_arrow_ = value; } // For borders with an arrow, gives the desired bounds (in screen coordinates) diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc index f1dfbc1..3b13f2b 100644 --- a/ui/views/bubble/tray_bubble_view.cc +++ b/ui/views/bubble/tray_bubble_view.cc @@ -50,6 +50,7 @@ class TrayBubbleBorder : public views::BubbleBorder { tray_arrow_offset_(params.arrow_offset) { set_alignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); set_background_color(params.arrow_color); + set_paint_arrow(!params.hide_arrow); } virtual ~TrayBubbleBorder() {} @@ -233,6 +234,7 @@ TrayBubbleView::InitParams::InitParams(AnchorType anchor_type, arrow_color(SK_ColorBLACK), arrow_location(views::BubbleBorder::NONE), arrow_offset(kArrowDefaultOffset), + hide_arrow(false), shadow(views::BubbleBorder::BIG_SHADOW) { } @@ -326,7 +328,7 @@ void TrayBubbleView::SetWidth(int width) { } void TrayBubbleView::SetPaintArrow(bool paint_arrow) { - bubble_border_->set_paint_arrow(paint_arrow); + bubble_border_->set_paint_arrow(paint_arrow && !params_.hide_arrow); } gfx::Insets TrayBubbleView::GetBorderInsets() const { diff --git a/ui/views/bubble/tray_bubble_view.h b/ui/views/bubble/tray_bubble_view.h index b1c3373..218d885 100644 --- a/ui/views/bubble/tray_bubble_view.h +++ b/ui/views/bubble/tray_bubble_view.h @@ -95,6 +95,7 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView { SkColor arrow_color; views::BubbleBorder::ArrowLocation arrow_location; int arrow_offset; + bool hide_arrow; // hides arrow, but may still use "arrow geometry" views::BubbleBorder::Shadow shadow; }; |