OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/system/tray/tray_bar_button_with_title.h" | 5 #include "ash/system/tray/tray_bar_button_with_title.h" |
6 | 6 |
7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public: | 33 public: |
34 TrayBarButton(const int bar_active_images[], const int bar_disabled_images[]) | 34 TrayBarButton(const int bar_active_images[], const int bar_disabled_images[]) |
35 : views::View(), | 35 : views::View(), |
36 bar_active_images_(bar_active_images), | 36 bar_active_images_(bar_active_images), |
37 bar_disabled_images_(bar_disabled_images), | 37 bar_disabled_images_(bar_disabled_images), |
38 painter_(new views::HorizontalPainter(bar_active_images_)){ | 38 painter_(new views::HorizontalPainter(bar_active_images_)){ |
39 } | 39 } |
40 virtual ~TrayBarButton() {} | 40 virtual ~TrayBarButton() {} |
41 | 41 |
42 // Overriden from views::View: | 42 // Overriden from views::View: |
43 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 43 virtual void OnPaint(gfx::Canvas* canvas) override { |
44 painter_->Paint(canvas, size()); | 44 painter_->Paint(canvas, size()); |
45 } | 45 } |
46 | 46 |
47 void Update(bool control_on) { | 47 void Update(bool control_on) { |
48 painter_.reset(new views::HorizontalPainter( | 48 painter_.reset(new views::HorizontalPainter( |
49 control_on ? bar_active_images_ : bar_disabled_images_)); | 49 control_on ? bar_active_images_ : bar_disabled_images_)); |
50 SchedulePaint(); | 50 SchedulePaint(); |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // a little bit up to look closer to the bar. | 101 // a little bit up to look closer to the bar. |
102 gfx::Size title_size = title_->GetPreferredSize(); | 102 gfx::Size title_size = title_->GetPreferredSize(); |
103 title_->SetBounds(rect.x(), | 103 title_->SetBounds(rect.x(), |
104 bar_image_y + image_height_ - 3, | 104 bar_image_y + image_height_ - 3, |
105 rect.width(), | 105 rect.width(), |
106 title_size.height()); | 106 title_size.height()); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace ash | 110 } // namespace ash |
OLD | NEW |