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

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: Initialized radius members of InkDropAnimationControllerImpl. Created 5 years, 1 month 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
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..311f5f1885d41a6451be87f88d8d23f2a9d51c56
--- /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);
sadrul 2015/11/04 19:58:11 TimeDelta is a single int64, and we typically just
bruthig 2015/11/11 21:48:44 Seems like a reasonable abstraction to me :)
+
+ // 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* root_layer() { return layer_.get(); }
sadrul 2015/11/04 19:58:11 Why root_layer() instead of just layer()?
bruthig 2015/11/11 21:48:45 Done.
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698