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 | 25 |
26 // Use a black halo for status text. | 26 // Use a 0.70 alpha black halo for status text as the icons. |
27 SetTextHaloColor(SK_ColorBLACK); | 27 SetTextHaloColor(SkColorSetARGB(0xB3, 0, 0, 0)); |
DaveMoore
2010/12/04 00:08:02
Could you make this a constant?
xiyuan
2010/12/04 00:35:21
Done.
| |
28 } | 28 } |
29 | 29 |
30 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 30 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
31 if (state() == BS_PUSHED) { | 31 if (state() == BS_PUSHED) { |
32 // Apply 10% white when pushed down. | 32 // Apply 10% white when pushed down. |
33 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), | 33 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), |
34 0, 0, width(), height()); | 34 0, 0, width(), height()); |
35 } | 35 } |
36 | 36 |
37 if (use_menu_button_paint_) { | 37 if (use_menu_button_paint_) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 | 86 |
87 bool StatusAreaButton::Activate() { | 87 bool StatusAreaButton::Activate() { |
88 if (enabled_) { | 88 if (enabled_) { |
89 return views::MenuButton::Activate(); | 89 return views::MenuButton::Activate(); |
90 } else { | 90 } else { |
91 return true; | 91 return true; |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 } // namespace chromeos | 95 } // namespace chromeos |
OLD | NEW |