| OLD | NEW |
| 1 // Copyright (c) 2011 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 #ifndef UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ |
| 6 #define UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/base/animation/animation_delegate.h" | 9 #include "ui/base/animation/animation_delegate.h" |
| 10 #include "ui/base/animation/slide_animation.h" | 10 #include "ui/base/animation/slide_animation.h" |
| 11 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Canvas; | 14 class CanvasSkia; |
| 15 class Point; | 15 class Point; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class SkBitmap; | 18 class SkBitmap; |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 | 21 |
| 22 class View; | 22 class View; |
| 23 | 23 |
| 24 // GlowHoverController is responsible for drawing a hover effect as is used by | 24 // GlowHoverController is responsible for drawing a hover effect as is used by |
| (...skipping 27 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 // Returns the value of the animation. | 53 // Returns the value of the animation. |
| 54 double GetAnimationValue() const; | 54 double GetAnimationValue() const; |
| 55 | 55 |
| 56 // Returns true if there is something to be drawn. Use this instead of | 56 // Returns true if there is something to be drawn. Use this instead of |
| 57 // invoking Draw() if creating |mask_image| is expensive. | 57 // invoking Draw() if creating |mask_image| is expensive. |
| 58 bool ShouldDraw() const; | 58 bool ShouldDraw() const; |
| 59 | 59 |
| 60 // If the hover is currently visible it is drawn to the supplied canvas. | 60 // If the hover is currently visible it is drawn to the supplied canvas. |
| 61 // |mask_image| is used to determine what parts of the canvas to draw on. | 61 // |mask_image| is used to determine what parts of the canvas to draw on. |
| 62 void Draw(gfx::Canvas* canvas, const SkBitmap& mask_image) const; | 62 void Draw(gfx::CanvasSkia* canvas, const SkBitmap& mask_image) const; |
| 63 | 63 |
| 64 // ui::AnimationDelegate overrides: | 64 // ui::AnimationDelegate overrides: |
| 65 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 65 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 66 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 66 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // View we're drawing to. | 69 // View we're drawing to. |
| 70 views::View* view_; | 70 views::View* view_; |
| 71 | 71 |
| 72 // Opacity of the glow ramps up over time. | 72 // Opacity of the glow ramps up over time. |
| 73 ui::SlideAnimation animation_; | 73 ui::SlideAnimation animation_; |
| 74 | 74 |
| 75 // Location of the glow, relative to view. | 75 // Location of the glow, relative to view. |
| 76 gfx::Point location_; | 76 gfx::Point location_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(GlowHoverController); | 78 DISALLOW_COPY_AND_ASSIGN(GlowHoverController); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace views | 81 } // namespace views |
| 82 | 82 |
| 83 #endif // UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ | 83 #endif // UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ |
| OLD | NEW |