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

Side by Side Diff: ui/views/controls/glow_hover_controller.h

Issue 10437006: Converts ui/views/controls, ui/views/examples, ui/base/models to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 Canvas;
15 class ImageSkia;
15 class Point; 16 class Point;
16 } 17 }
17 18
18 class SkBitmap;
19
20 namespace views { 19 namespace views {
21 20
22 class View; 21 class View;
23 22
24 // GlowHoverController is responsible for drawing a hover effect as is used by 23 // GlowHoverController is responsible for drawing a hover effect as is used by
25 // the tabstrip. Typical usage: 24 // the tabstrip. Typical usage:
26 // OnMouseEntered() -> invoke Show(). 25 // OnMouseEntered() -> invoke Show().
27 // OnMouseMoved() -> invoke SetLocation(). 26 // OnMouseMoved() -> invoke SetLocation().
28 // OnMouseExited() -> invoke Hide(). 27 // OnMouseExited() -> invoke Hide().
29 // OnPaint() -> if ShouldDraw() returns true invoke Draw(). 28 // OnPaint() -> if ShouldDraw() returns true invoke Draw().
(...skipping 22 matching lines...) Expand all
52 51
53 // Returns the value of the animation. 52 // Returns the value of the animation.
54 double GetAnimationValue() const; 53 double GetAnimationValue() const;
55 54
56 // Returns true if there is something to be drawn. Use this instead of 55 // Returns true if there is something to be drawn. Use this instead of
57 // invoking Draw() if creating |mask_image| is expensive. 56 // invoking Draw() if creating |mask_image| is expensive.
58 bool ShouldDraw() const; 57 bool ShouldDraw() const;
59 58
60 // If the hover is currently visible it is drawn to the supplied canvas. 59 // 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. 60 // |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; 61 void Draw(gfx::Canvas* canvas, const gfx::ImageSkia& mask_image) const;
63 62
64 // ui::AnimationDelegate overrides: 63 // ui::AnimationDelegate overrides:
65 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
66 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
67 66
68 private: 67 private:
69 // View we're drawing to. 68 // View we're drawing to.
70 views::View* view_; 69 views::View* view_;
71 70
72 // Opacity of the glow ramps up over time. 71 // Opacity of the glow ramps up over time.
73 ui::SlideAnimation animation_; 72 ui::SlideAnimation animation_;
74 73
75 // Location of the glow, relative to view. 74 // Location of the glow, relative to view.
76 gfx::Point location_; 75 gfx::Point location_;
77 76
78 DISALLOW_COPY_AND_ASSIGN(GlowHoverController); 77 DISALLOW_COPY_AND_ASSIGN(GlowHoverController);
79 }; 78 };
80 79
81 } // namespace views 80 } // namespace views
82 81
83 #endif // UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_ 82 #endif // UI_VIEWS_CONTROLS_GLOW_HOVER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698