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

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

Issue 3058011: Add "pushed" as a state a TextButton can show (alongside "normal" and "hover"... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2009 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 "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "gfx/canvas.h" 8 #include "gfx/canvas.h"
9 #include "gfx/skbitmap_operations.h" 9 #include "gfx/skbitmap_operations.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
11 #include "views/border.h" 11 #include "views/border.h"
12 #include "views/view.h" 12 #include "views/view.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 //////////////////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////////////////
17 // StatusAreaButton 17 // StatusAreaButton
18 18
19 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) 19 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate)
20 : MenuButton(NULL, std::wstring(), menu_delegate, false) { 20 : MenuButton(NULL, std::wstring(), menu_delegate, false) {
21 set_border(NULL); 21 set_border(NULL);
22 SetShowHighlighted(true);
23 } 22 }
24 23
25 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { 24 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) {
26 if (state() == BS_PUSHED) { 25 if (state() == BS_PUSHED) {
27 DrawPressed(canvas); 26 DrawPressed(canvas);
28 } 27 }
29 DrawIcon(canvas); 28 DrawIcon(canvas);
30 PaintFocusBorder(canvas); 29 PaintFocusBorder(canvas);
31 } 30 }
32 31
33 gfx::Size StatusAreaButton::GetPreferredSize() { 32 gfx::Size StatusAreaButton::GetPreferredSize() {
34 // icons are 24x24 33 // icons are 24x24
35 static const int kIconWidth = 24; 34 static const int kIconWidth = 24;
36 static const int kIconHeight = 24; 35 static const int kIconHeight = 24;
37 gfx::Insets insets = GetInsets(); 36 gfx::Insets insets = GetInsets();
38 gfx::Size prefsize(kIconWidth + insets.width(), 37 gfx::Size prefsize(kIconWidth + insets.width(),
39 kIconHeight + insets.height()); 38 kIconHeight + insets.height());
40 return prefsize; 39 return prefsize;
41 } 40 }
42 41
43 void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) { 42 void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) {
44 canvas->DrawBitmapInt(icon(), 0, 0); 43 canvas->DrawBitmapInt(icon(), 0, 0);
45 } 44 }
46 45
47 } // namespace chromeos 46 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698