| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/chromeos/status/status_area_button.h" | 5 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 6 | 6 |
| 7 #include "gfx/canvas.h" | 7 #include "gfx/canvas.h" |
| 8 #include "gfx/skbitmap_operations.h" | 8 #include "gfx/skbitmap_operations.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 #include "views/border.h" | 10 #include "views/border.h" |
| 11 #include "views/view.h" | 11 #include "views/view.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 // A 0.7 black to decorate status text. Same color is used for icon borders. |
| 16 static const SkColor kStatusTextHaloColor = SkColorSetARGB(0xB3, 0, 0, 0); |
| 17 |
| 15 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
| 16 // StatusAreaButton | 19 // StatusAreaButton |
| 17 | 20 |
| 18 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) | 21 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) |
| 19 : MenuButton(NULL, std::wstring(), menu_delegate, false), | 22 : MenuButton(NULL, std::wstring(), menu_delegate, false), |
| 20 use_menu_button_paint_(false), enabled_(true) { | 23 use_menu_button_paint_(false), enabled_(true) { |
| 21 set_border(NULL); | 24 set_border(NULL); |
| 22 | 25 |
| 23 // Use an offset that is top aligned with toolbar. | 26 // Use an offset that is top aligned with toolbar. |
| 24 set_menu_offset(0, 2); | 27 set_menu_offset(0, 2); |
| 25 | 28 |
| 26 // Use a black halo for status text. | 29 // Use a halo for status text as the icons. |
| 27 SetTextHaloColor(SK_ColorBLACK); | 30 SetTextHaloColor(kStatusTextHaloColor); |
| 28 } | 31 } |
| 29 | 32 |
| 30 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 33 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
| 31 if (state() == BS_PUSHED) { | 34 if (state() == BS_PUSHED) { |
| 32 // Apply 10% white when pushed down. | 35 // Apply 10% white when pushed down. |
| 33 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), | 36 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), |
| 34 0, 0, width(), height()); | 37 0, 0, width(), height()); |
| 35 } | 38 } |
| 36 | 39 |
| 37 if (use_menu_button_paint_) { | 40 if (use_menu_button_paint_) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 89 |
| 87 bool StatusAreaButton::Activate() { | 90 bool StatusAreaButton::Activate() { |
| 88 if (enabled_) { | 91 if (enabled_) { |
| 89 return views::MenuButton::Activate(); | 92 return views::MenuButton::Activate(); |
| 90 } else { | 93 } else { |
| 91 return true; | 94 return true; |
| 92 } | 95 } |
| 93 } | 96 } |
| 94 | 97 |
| 95 } // namespace chromeos | 98 } // namespace chromeos |
| OLD | NEW |