summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorjennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-13 16:00:30 +0000
committerjennyz@chromium.org <jennyz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-13 16:00:30 +0000
commit58c293847945c02725e211b1625722127ace14a5 (patch)
tree9c6badaea20a83ea68057e7035ef4472cfb64ae2 /ash
parenta2232cb1422c7727188ee1626fe5abd0acd2104e (diff)
downloadchromium_src-58c293847945c02725e211b1625722127ace14a5.zip
chromium_src-58c293847945c02725e211b1625722127ace14a5.tar.gz
chromium_src-58c293847945c02725e211b1625722127ace14a5.tar.bz2
Do not draw button border for the first visible button in TrayPopupTextButtonContainer which is the left most one showing up on row.
BUG=148729 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=156423 Review URL: https://codereview.chromium.org/10918199 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/system/tray/tray_views.cc19
-rw-r--r--ash/system/tray/tray_views.h6
2 files changed, 24 insertions, 1 deletions
diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc
index 1aa2050..8528751 100644
--- a/ash/system/tray/tray_views.cc
+++ b/ash/system/tray/tray_views.cc
@@ -327,6 +327,7 @@ TrayPopupTextButton::TrayPopupTextButton(views::ButtonListener* listener,
const string16& text)
: views::TextButton(listener, text),
hover_(false),
+ paint_border_(true),
hover_bg_(views::Background::CreateSolidBackground(SkColorSetARGB(
10, 0, 0, 0))),
hover_border_(views::Border::CreateSolidBorder(1, kButtonStrokeColor)) {
@@ -364,7 +365,7 @@ void TrayPopupTextButton::OnPaintBackground(gfx::Canvas* canvas) {
void TrayPopupTextButton::OnPaintBorder(gfx::Canvas* canvas) {
if (hover_)
hover_border_->Paint(*this, canvas);
- else
+ else if (paint_border_)
views::TextButton::OnPaintBorder(canvas);
}
@@ -399,6 +400,22 @@ void TrayPopupTextButtonContainer::AddTextButton(TrayPopupTextButton* button) {
AddChildView(button);
}
+void TrayPopupTextButtonContainer::Layout() {
+ // Do not draw border for the left most visible button.
+ bool found_first_visible = false;
+ for (int i = 0; i < child_count(); ++i) {
+ TrayPopupTextButton* button =
+ static_cast<TrayPopupTextButton*>(child_at(i));
+ if (!found_first_visible && button->visible()) {
+ button->set_paint_border(false);
+ found_first_visible = true;
+ } else if (button->visible()) {
+ button->set_paint_border(true);
+ }
+ }
+ views::View::Layout();
+}
+
////////////////////////////////////////////////////////////////////////////////
// TrayPopupHeaderButton
diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h
index c9ba066..7481edf 100644
--- a/ash/system/tray/tray_views.h
+++ b/ash/system/tray/tray_views.h
@@ -181,6 +181,8 @@ class TrayPopupTextButton : public views::TextButton {
TrayPopupTextButton(views::ButtonListener* listener, const string16& text);
virtual ~TrayPopupTextButton();
+ void set_paint_border(bool paint_border) { paint_border_ = paint_border; }
+
private:
// Overridden from views::View.
virtual gfx::Size GetPreferredSize() OVERRIDE;
@@ -191,6 +193,7 @@ class TrayPopupTextButton : public views::TextButton {
virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
bool hover_;
+ bool paint_border_;
scoped_ptr<views::Background> hover_bg_;
scoped_ptr<views::Border> hover_border_;
@@ -208,6 +211,9 @@ class TrayPopupTextButtonContainer : public views::View {
views::BoxLayout* layout() const { return layout_; }
+ // Overridden from views::View
+ virtual void Layout() OVERRIDE;
+
private:
views::BoxLayout* layout_;