| 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 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 16 // StatusAreaButton | 16 // StatusAreaButton |
| 17 | 17 |
| 18 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) | 18 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) |
| 19 : MenuButton(NULL, std::wstring(), menu_delegate, false), | 19 : MenuButton(NULL, std::wstring(), menu_delegate, false), |
| 20 use_menu_button_paint_(false), enabled_(true) { | 20 use_menu_button_paint_(false), enabled_(true) { |
| 21 set_border(NULL); | 21 set_border(NULL); |
| 22 | 22 |
| 23 // Use an offset that is top aligned with toolbar. | 23 // Use an offset that is top aligned with toolbar. |
| 24 set_menu_offset(0, 2); | 24 set_menu_offset(0, 2); |
| 25 |
| 26 // Use a black halo for status text. |
| 27 SetTextHaloColor(SK_ColorBLACK); |
| 25 } | 28 } |
| 26 | 29 |
| 27 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 30 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
| 28 if (state() == BS_PUSHED) { | 31 if (state() == BS_PUSHED) { |
| 29 // Apply 10% white when pushed down. | 32 // Apply 10% white when pushed down. |
| 30 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), | 33 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), |
| 31 0, 0, width(), height()); | 34 0, 0, width(), height()); |
| 32 } | 35 } |
| 33 | 36 |
| 34 if (use_menu_button_paint_) { | 37 if (use_menu_button_paint_) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 86 |
| 84 bool StatusAreaButton::Activate() { | 87 bool StatusAreaButton::Activate() { |
| 85 if (enabled_) { | 88 if (enabled_) { |
| 86 return views::MenuButton::Activate(); | 89 return views::MenuButton::Activate(); |
| 87 } else { | 90 } else { |
| 88 return true; | 91 return true; |
| 89 } | 92 } |
| 90 } | 93 } |
| 91 | 94 |
| 92 } // namespace chromeos | 95 } // namespace chromeos |
| OLD | NEW |