Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: chrome/browser/chromeos/status/status_area_button.cc

Issue 6635008: cros: Fix PaintButton override. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/status/status_area_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "grit/theme_resources.h" 7 #include "grit/theme_resources.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/skbitmap_operations.h" 9 #include "ui/gfx/skbitmap_operations.h"
10 #include "views/border.h" 10 #include "views/border.h"
(...skipping 12 matching lines...) Expand all
23 use_menu_button_paint_(false), active_(true) { 23 use_menu_button_paint_(false), active_(true) {
24 set_border(NULL); 24 set_border(NULL);
25 25
26 // Use an offset that is top aligned with toolbar. 26 // Use an offset that is top aligned with toolbar.
27 set_menu_offset(0, 2); 27 set_menu_offset(0, 2);
28 28
29 // Use a halo for status text as the icons. 29 // Use a halo for status text as the icons.
30 SetTextHaloColor(kStatusTextHaloColor); 30 SetTextHaloColor(kStatusTextHaloColor);
31 } 31 }
32 32
33 void StatusAreaButton::OnPaint(gfx::Canvas* canvas, bool for_drag) { 33 void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
34 if (state() == BS_PUSHED) { 34 if (state() == BS_PUSHED) {
35 // Apply 10% white when pushed down. 35 // Apply 10% white when pushed down.
36 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), 36 canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF),
37 0, 0, width(), height()); 37 0, 0, width(), height());
38 } 38 }
39 39
40 if (use_menu_button_paint_) { 40 if (use_menu_button_paint_) {
41 views::MenuButton::PaintButton( 41 views::MenuButton::PaintButton(canvas, mode);
42 canvas,
43 for_drag ?
44 views::MenuButton::PB_FOR_DRAG :
45 views::MenuButton::PB_NORMAL);
46 } else { 42 } else {
47 canvas->DrawBitmapInt(icon(), horizontal_padding(), 0); 43 canvas->DrawBitmapInt(icon(), horizontal_padding(), 0);
48 OnPaintFocusBorder(canvas); 44 OnPaintFocusBorder(canvas);
49 } 45 }
50 } 46 }
51 47
52 gfx::Size StatusAreaButton::GetPreferredSize() { 48 gfx::Size StatusAreaButton::GetPreferredSize() {
53 gfx::Insets insets = views::MenuButton::GetInsets(); 49 gfx::Insets insets = views::MenuButton::GetInsets();
54 gfx::Size prefsize(icon_width() + insets.width(), 50 gfx::Size prefsize(icon_width() + insets.width(),
55 icon_height() + insets.height()); 51 icon_height() + insets.height());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 88
93 bool StatusAreaButton::Activate() { 89 bool StatusAreaButton::Activate() {
94 if (active_) { 90 if (active_) {
95 return views::MenuButton::Activate(); 91 return views::MenuButton::Activate();
96 } else { 92 } else {
97 return true; 93 return true;
98 } 94 }
99 } 95 }
100 96
101 } // namespace chromeos 97 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/status_area_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698