summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status_area_button.cc
blob: 57f66da06219ec84fd6b04cf370118228209ed8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/status_area_button.h"

#include "app/gfx/canvas.h"
#include "app/gfx/skbitmap_operations.h"
#include "app/resource_bundle.h"
#include "grit/theme_resources.h"
#include "views/border.h"
#include "views/view.h"

namespace chromeos {

////////////////////////////////////////////////////////////////////////////////
// StatusAreaButton

StatusAreaButton::StatusAreaButton(views::ViewMenuDelegate* menu_delegate)
    : MenuButton(NULL, std::wstring(), menu_delegate, false) {
  set_border(NULL);
  SetShowHighlighted(true);
}

void StatusAreaButton::Paint(gfx::Canvas* canvas, bool for_drag) {
  int bitmap_id;

  switch (state()) {
    case BS_NORMAL:
      bitmap_id = IDR_STATUSBAR_CONTAINER;
      break;
    case BS_HOT:
      bitmap_id = IDR_STATUSBAR_CONTAINER_HOVER;
      break;
    case BS_PUSHED:
      bitmap_id = IDR_STATUSBAR_CONTAINER_PRESSED;
      break;
    default:
      bitmap_id = IDR_STATUSBAR_CONTAINER;
      NOTREACHED();
  }
  SkBitmap* container =
      ResourceBundle::GetSharedInstance().GetBitmapNamed(bitmap_id);
  canvas->DrawBitmapInt(*container, 0, 0);
  DrawIcon(canvas);
}

void StatusAreaButton::DrawIcon(gfx::Canvas* canvas) {
  canvas->DrawBitmapInt(icon(), 0, 0);
}

}  // namespace chromeos