OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/launcher/launcher_button.h" | 5 #include "ash/launcher/launcher_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/launcher/launcher_button_host.h" | 10 #include "ash/launcher/launcher_button_host.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 class LauncherButton::BarView : public views::ImageView, | 58 class LauncherButton::BarView : public views::ImageView, |
59 public ui::AnimationDelegate { | 59 public ui::AnimationDelegate { |
60 public: | 60 public: |
61 BarView() : ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)) { | 61 BarView() : ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)) { |
62 animation_.SetThrobDuration(kAttentionThrobDurationMS); | 62 animation_.SetThrobDuration(kAttentionThrobDurationMS); |
63 animation_.SetTweenType(ui::Tween::SMOOTH_IN_OUT); | 63 animation_.SetTweenType(ui::Tween::SMOOTH_IN_OUT); |
64 } | 64 } |
65 | 65 |
66 // View overrides. | 66 // View overrides. |
67 bool HitTest(const gfx::Point& l) const OVERRIDE { | 67 bool HitTestRect(const gfx::Rect& rect) const OVERRIDE { |
68 // Allow Mouse...() messages to go to the parent view. | 68 // Allow Mouse...() messages to go to the parent view. |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 72 void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
73 if (animation_.is_animating()) { | 73 if (animation_.is_animating()) { |
74 int alpha = animation_.CurrentValueBetween(0, 255); | 74 int alpha = animation_.CurrentValueBetween(0, 255); |
75 canvas->SaveLayerAlpha(alpha); | 75 canvas->SaveLayerAlpha(alpha); |
76 views::ImageView::OnPaint(canvas); | 76 views::ImageView::OnPaint(canvas); |
77 canvas->Restore(); | 77 canvas->Restore(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 //////////////////////////////////////////////////////////////////////////////// | 200 //////////////////////////////////////////////////////////////////////////////// |
201 // LauncherButton::IconView | 201 // LauncherButton::IconView |
202 | 202 |
203 LauncherButton::IconView::IconView() : icon_size_(kIconSize) { | 203 LauncherButton::IconView::IconView() : icon_size_(kIconSize) { |
204 } | 204 } |
205 | 205 |
206 LauncherButton::IconView::~IconView() { | 206 LauncherButton::IconView::~IconView() { |
207 } | 207 } |
208 | 208 |
209 bool LauncherButton::IconView::HitTest(const gfx::Point& l) const { | 209 bool LauncherButton::IconView::HitTestRect(const gfx::Rect& rect) const { |
210 // Return false so that LauncherButton gets all the mouse events. | 210 // Return false so that LauncherButton gets all the mouse events. |
211 return false; | 211 return false; |
212 } | 212 } |
213 | 213 |
214 //////////////////////////////////////////////////////////////////////////////// | 214 //////////////////////////////////////////////////////////////////////////////// |
215 // LauncherButton | 215 // LauncherButton |
216 | 216 |
217 LauncherButton* LauncherButton::Create(views::ButtonListener* listener, | 217 LauncherButton* LauncherButton::Create(views::ButtonListener* listener, |
218 LauncherButtonHost* host) { | 218 LauncherButtonHost* host) { |
219 LauncherButton* button = new LauncherButton(listener, host); | 219 LauncherButton* button = new LauncherButton(listener, host); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 bar_->SetVerticalAlignment(views::ImageView::CENTER); | 502 bar_->SetVerticalAlignment(views::ImageView::CENTER); |
503 break; | 503 break; |
504 } | 504 } |
505 | 505 |
506 Layout(); | 506 Layout(); |
507 SchedulePaint(); | 507 SchedulePaint(); |
508 } | 508 } |
509 | 509 |
510 } // namespace internal | 510 } // namespace internal |
511 } // namespace ash | 511 } // namespace ash |
OLD | NEW |