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