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