| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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); | 22 SetShowHighlighted(true); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 25 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
| 26 if (state() == BS_PUSHED) { | 26 if (state() == BS_PUSHED) { |
| 27 DrawPressed(canvas); | 27 DrawPressed(canvas); |
| 28 } | 28 } |
| 29 DrawIcon(canvas); | 29 DrawIcon(canvas); |
| 30 PaintFocusBorder(canvas); |
| 30 } | 31 } |
| 31 | 32 |
| 32 gfx::Size StatusAreaButton::GetPreferredSize() { | 33 gfx::Size StatusAreaButton::GetPreferredSize() { |
| 33 // icons are 24x24 | 34 // icons are 24x24 |
| 34 static const int kIconWidth = 24; | 35 static const int kIconWidth = 24; |
| 35 static const int kIconHeight = 24; | 36 static const int kIconHeight = 24; |
| 36 gfx::Insets insets = GetInsets(); | 37 gfx::Insets insets = GetInsets(); |
| 37 gfx::Size prefsize(kIconWidth + insets.width(), | 38 gfx::Size prefsize(kIconWidth + insets.width(), |
| 38 kIconHeight + insets.height()); | 39 kIconHeight + insets.height()); |
| 39 return prefsize; | 40 return prefsize; |
| 40 } | 41 } |
| 41 | 42 |
| 42 void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) { | 43 void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) { |
| 43 canvas->DrawBitmapInt(icon(), 0, 0); | 44 canvas->DrawBitmapInt(icon(), 0, 0); |
| 44 } | 45 } |
| 45 | 46 |
| 46 } // namespace chromeos | 47 } // namespace chromeos |
| OLD | NEW |