| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ | 5 #ifndef UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ |
| 6 #define UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ | 6 #define UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/events/event_handler.h" | 10 #include "ui/events/event_handler.h" |
| 11 #include "ui/gfx/geometry/point.h" |
| 11 #include "ui/views/animation/ink_drop_delegate.h" | 12 #include "ui/views/animation/ink_drop_delegate.h" |
| 12 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 class ScopedTargetHandler; | 16 class ScopedTargetHandler; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 | 20 |
| 20 class InkDropAnimationController; | 21 class InkDropAnimationController; |
| 21 class InkDropHost; | 22 class InkDropHost; |
| 22 class View; | 23 class View; |
| 23 | 24 |
| 24 // An InkDropDelegate that handles animations for things that act like buttons. | 25 // An InkDropDelegate that handles animations for things that act like buttons. |
| 25 class VIEWS_EXPORT ButtonInkDropDelegate : public InkDropDelegate, | 26 class VIEWS_EXPORT ButtonInkDropDelegate : public InkDropDelegate, |
| 26 public ui::EventHandler { | 27 public ui::EventHandler { |
| 27 public: | 28 public: |
| 28 ButtonInkDropDelegate(InkDropHost* ink_drop_host, View* view); | 29 ButtonInkDropDelegate(InkDropHost* ink_drop_host, View* view); |
| 29 ~ButtonInkDropDelegate() override; | 30 ~ButtonInkDropDelegate() override; |
| 30 | 31 |
| 32 const gfx::Point& last_ink_drop_location() const { |
| 33 return last_ink_drop_location_; |
| 34 } |
| 35 void set_last_ink_drop_location(const gfx::Point& point) { |
| 36 last_ink_drop_location_ = point; |
| 37 } |
| 38 |
| 31 // InkDropDelegate: | 39 // InkDropDelegate: |
| 32 void OnAction(InkDropState state) override; | 40 void OnAction(InkDropState state) override; |
| 33 void SnapToActivated() override; | 41 void SnapToActivated() override; |
| 34 void SetHovered(bool is_hovered) override; | 42 void SetHovered(bool is_hovered) override; |
| 35 | 43 |
| 36 // ui::EventHandler: | 44 // ui::EventHandler: |
| 37 void OnMouseEvent(ui::MouseEvent* event) override; | 45 void OnMouseEvent(ui::MouseEvent* event) override; |
| 38 void OnGestureEvent(ui::GestureEvent* event) override; | 46 void OnGestureEvent(ui::GestureEvent* event) override; |
| 39 | 47 |
| 40 private: | 48 private: |
| 41 // An instance of ScopedTargetHandler allowing |this| to handle events. | 49 // An instance of ScopedTargetHandler allowing |this| to handle events. |
| 42 scoped_ptr<ui::ScopedTargetHandler> target_handler_; | 50 scoped_ptr<ui::ScopedTargetHandler> target_handler_; |
| 43 | 51 |
| 44 // Parent InkDropHost (typically a View) that hosts the ink ripple animations. | 52 // Parent InkDropHost (typically a View) that hosts the ink ripple animations. |
| 45 InkDropHost* ink_drop_host_; | 53 InkDropHost* ink_drop_host_; |
| 46 | 54 |
| 55 // Location of the last ink drop triggering event in coordinate system of the |
| 56 // ctor argument |view|. |
| 57 gfx::Point last_ink_drop_location_; |
| 58 |
| 47 // Animation controller for the ink drop ripple effect. | 59 // Animation controller for the ink drop ripple effect. |
| 48 scoped_ptr<InkDropAnimationController> ink_drop_animation_controller_; | 60 scoped_ptr<InkDropAnimationController> ink_drop_animation_controller_; |
| 49 | 61 |
| 50 DISALLOW_COPY_AND_ASSIGN(ButtonInkDropDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(ButtonInkDropDelegate); |
| 51 }; | 63 }; |
| 52 | 64 |
| 53 } // namespace views | 65 } // namespace views |
| 54 | 66 |
| 55 #endif // UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ | 67 #endif // UI_VIEWS_ANIMATION_BUTTON_INK_DROP_DELEGATE_H_ |
| OLD | NEW |