OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "grit/theme_resources.h" | 7 #include "grit/theme_resources.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/skbitmap_operations.h" | 10 #include "ui/gfx/skbitmap_operations.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Use an offset that is top aligned with toolbar. | 53 // Use an offset that is top aligned with toolbar. |
54 set_menu_offset(0, 4); | 54 set_menu_offset(0, 4); |
55 | 55 |
56 UpdateTextStyle(); | 56 UpdateTextStyle(); |
57 } | 57 } |
58 | 58 |
59 void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { | 59 void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { |
60 if (state() == BS_PUSHED) { | 60 if (state() == BS_PUSHED) { |
61 // Apply 10% white when pushed down. | 61 // Apply 10% white when pushed down. |
62 canvas->FillRect(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), GetLocalBounds()); | 62 canvas->FillRect(GetLocalBounds(), SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF)); |
63 } | 63 } |
64 | 64 |
65 views::MenuButton::PaintButton(canvas, mode); | 65 views::MenuButton::PaintButton(canvas, mode); |
66 } | 66 } |
67 | 67 |
68 void StatusAreaButton::SetText(const string16& text) { | 68 void StatusAreaButton::SetText(const string16& text) { |
69 // TextButtons normally remember the max text size, so the button's preferred | 69 // TextButtons normally remember the max text size, so the button's preferred |
70 // size will always be as large as the largest text ever put in it. | 70 // size will always be as large as the largest text ever put in it. |
71 // We clear that max text size, so we can adjust the size to fit the text. | 71 // We clear that max text size, so we can adjust the size to fit the text. |
72 // The order is important. ClearMaxTextSize sets the size to that of the | 72 // The order is important. ClearMaxTextSize sets the size to that of the |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return 24; | 159 return 24; |
160 } | 160 } |
161 | 161 |
162 int StatusAreaButton::icon_width() { | 162 int StatusAreaButton::icon_width() { |
163 return 23; | 163 return 23; |
164 } | 164 } |
165 | 165 |
166 int StatusAreaButton::horizontal_padding() { | 166 int StatusAreaButton::horizontal_padding() { |
167 return 1; | 167 return 1; |
168 } | 168 } |
OLD | NEW |