| 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_area_button.h" | 5 #include "chrome/browser/chromeos/status_area_button.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/skbitmap_operations.h" | 8 #include "app/gfx/skbitmap_operations.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.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 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // StatusAreaButton | 15 // StatusAreaButton |
| 16 | 16 |
| 17 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) | 17 StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate) |
| 18 : MenuButton(NULL, std::wstring(), menu_delegate, false) { | 18 : MenuButton(NULL, std::wstring(), menu_delegate, false) { |
| 19 set_border(NULL); | 19 set_border(NULL); |
| 20 SetShowHighlighted(true); | 20 SetShowHighlighted(true); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { | 23 void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) { |
| 24 int bitmap_id; | 24 int bitmap_id; |
| 25 | 25 |
| 26 switch(state()) { | 26 switch (state()) { |
| 27 case BS_NORMAL: | 27 case BS_NORMAL: |
| 28 bitmap_id = IDR_STATUSBAR_CONTAINER; | 28 bitmap_id = IDR_STATUSBAR_CONTAINER; |
| 29 break; | 29 break; |
| 30 case BS_HOT: | 30 case BS_HOT: |
| 31 bitmap_id = IDR_STATUSBAR_CONTAINER_HOVER; | 31 bitmap_id = IDR_STATUSBAR_CONTAINER_HOVER; |
| 32 break; | 32 break; |
| 33 case BS_PUSHED: | 33 case BS_PUSHED: |
| 34 bitmap_id = IDR_STATUSBAR_CONTAINER_PRESSED; | 34 bitmap_id = IDR_STATUSBAR_CONTAINER_PRESSED; |
| 35 break; | 35 break; |
| 36 default: | 36 default: |
| 37 bitmap_id = IDR_STATUSBAR_CONTAINER; | 37 bitmap_id = IDR_STATUSBAR_CONTAINER; |
| 38 NOTREACHED(); | 38 NOTREACHED(); |
| 39 } | 39 } |
| 40 SkBitmap* container = | 40 SkBitmap* container = |
| 41 ResourceBundle::GetSharedInstance().GetBitmapNamed(bitmap_id); | 41 ResourceBundle::GetSharedInstance().GetBitmapNamed(bitmap_id); |
| 42 canvas->DrawBitmapInt(*container, 0, 0); | 42 canvas->DrawBitmapInt(*container, 0, 0); |
| 43 DrawIcon(canvas); |
| 44 } |
| 45 |
| 46 void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) { |
| 43 canvas->DrawBitmapInt(icon(), 0, 0); | 47 canvas->DrawBitmapInt(icon(), 0, 0); |
| 44 } | 48 } |
| OLD | NEW |