Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: ui/views/animation/ink_drop_hover.h

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed the InkDropAnimationControllerImpl to destroy its timer when not running. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/animation/ink_drop_host.h ('k') | ui/views/animation/ink_drop_hover.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_hover.h
diff --git a/ui/views/animation/ink_drop_hover.h b/ui/views/animation/ink_drop_hover.h
new file mode 100644
index 0000000000000000000000000000000000000000..462bbbec8461ebcfafc26a25c8afa70fd0b00189
--- /dev/null
+++ b/ui/views/animation/ink_drop_hover.h
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_ANIMATION_INK_DROP_HOVER_H_
+#define UI_VIEWS_ANIMATION_INK_DROP_HOVER_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/views/views_export.h"
+
+namespace ui {
+class Layer;
+class CallbackLayerAnimationObserver;
+} // namespace ui
+
+namespace views {
+class RoundedRectangleLayerDelegate;
+
+// Manages fade in/out animations for a painted Layer that is used to provide
+// visual feedback on ui::Views for mouse hover states.
+class VIEWS_EXPORT InkDropHover {
+ public:
+ InkDropHover(const gfx::Size& size, int corner_radius);
+ ~InkDropHover();
+
+ // Returns true if the hover layer is visible.
+ bool IsVisible() const;
+
+ // Fades in the hover visual over the given |duration|.
+ void FadeIn(const base::TimeDelta& duration);
+
+ // Fades out the hover visual over the given |duration|.
+ void FadeOut(const base::TimeDelta& duration);
+
+ // The root Layer that can be added in to a Layer tree.
+ ui::Layer* layer() { return layer_.get(); }
+
+ // Sets the |center_point| of the hover layer relative to its parent Layer.
+ void SetCenterPoint(const gfx::Point& center_point);
+
+ private:
+ enum HoverAnimationType { FADE_IN, FADE_OUT };
+
+ // Animates a fade in/out as specified by |animation_type| over the given
+ // |duration|.
+ void AnimateFade(HoverAnimationType animation_type,
+ const base::TimeDelta& duration);
+
+ // The callback that will be invoked when a fade in/out animation is complete.
+ bool AnimationEndedCallback(
+ HoverAnimationType animation_type,
+ const ui::CallbackLayerAnimationObserver& observer);
+
+ // The LayerDelegate that paints the hover |layer_|.
+ scoped_ptr<RoundedRectangleLayerDelegate> layer_delegate_;
+
+ // The visual hover layer that is painted by |layer_delegate_|.
+ scoped_ptr<ui::Layer> layer_;
+
+ DISALLOW_COPY_AND_ASSIGN(InkDropHover);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_ANIMATION_INK_DROP_HOVER_H_
« no previous file with comments | « ui/views/animation/ink_drop_host.h ('k') | ui/views/animation/ink_drop_hover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698