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

Side by Side Diff: chrome/browser/gtk/custom_button.h

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ 5 #ifndef CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ 6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include "app/animation_delegate.h"
12 #include "app/gtk_signal.h" 11 #include "app/gtk_signal.h"
13 #include "app/slide_animation.h"
14 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
15 #include "chrome/browser/gtk/owned_widget_gtk.h" 13 #include "chrome/browser/gtk/owned_widget_gtk.h"
16 #include "chrome/common/notification_observer.h" 14 #include "chrome/common/notification_observer.h"
17 #include "chrome/common/notification_registrar.h" 15 #include "chrome/common/notification_registrar.h"
18 #include "gfx/rect.h" 16 #include "gfx/rect.h"
19 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/base/animation/animation_delegate.h"
19 #include "ui/base/animation/slide_animation.h"
20 20
21 class CairoCachedSurface; 21 class CairoCachedSurface;
22 class GtkThemeProvider; 22 class GtkThemeProvider;
23 class SkBitmap; 23 class SkBitmap;
24 24
25 // These classes implement two kinds of custom-drawn buttons. They're 25 // These classes implement two kinds of custom-drawn buttons. They're
26 // used on the toolbar and the bookmarks bar. 26 // used on the toolbar and the bookmarks bar.
27 27
28 // CustomDrawButtonBase provides the base for building a custom drawn button. 28 // CustomDrawButtonBase provides the base for building a custom drawn button.
29 // It handles managing the pixbufs containing all the static images used to draw 29 // It handles managing the pixbufs containing all the static images used to draw
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Used to listen for theme change notifications. 91 // Used to listen for theme change notifications.
92 NotificationRegistrar registrar_; 92 NotificationRegistrar registrar_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase); 94 DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase);
95 }; 95 };
96 96
97 // CustomDrawHoverController is a convenience class that eases the common task 97 // CustomDrawHoverController is a convenience class that eases the common task
98 // of controlling the hover state of a button. The "hover state" refers to the 98 // of controlling the hover state of a button. The "hover state" refers to the
99 // percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that 99 // percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
100 // when a user moves a mouse over a button the PRELIGHT fades in. 100 // when a user moves a mouse over a button the PRELIGHT fades in.
101 class CustomDrawHoverController : public AnimationDelegate { 101 class CustomDrawHoverController : public ui::AnimationDelegate {
102 public: 102 public:
103 explicit CustomDrawHoverController(GtkWidget* widget); 103 explicit CustomDrawHoverController(GtkWidget* widget);
104 CustomDrawHoverController(); 104 CustomDrawHoverController();
105 105
106 virtual ~CustomDrawHoverController(); 106 virtual ~CustomDrawHoverController();
107 107
108 void Init(GtkWidget* widget); 108 void Init(GtkWidget* widget);
109 109
110 double GetCurrentValue() { 110 double GetCurrentValue() {
111 return slide_animation_.GetCurrentValue(); 111 return slide_animation_.GetCurrentValue();
112 } 112 }
113 113
114 private: 114 private:
115 virtual void AnimationProgressed(const Animation* animation); 115 virtual void AnimationProgressed(const ui::Animation* animation);
116 116
117 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter, 117 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
118 GdkEventCrossing*); 118 GdkEventCrossing*);
119 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave, 119 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
120 GdkEventCrossing*); 120 GdkEventCrossing*);
121 121
122 SlideAnimation slide_animation_; 122 ui::SlideAnimation slide_animation_;
123 GtkWidget* widget_; 123 GtkWidget* widget_;
124 }; 124 };
125 125
126 // CustomDrawButton is a plain button where all its various states are drawn 126 // CustomDrawButton is a plain button where all its various states are drawn
127 // with static images. In GTK rendering mode, it will show the standard button 127 // with static images. In GTK rendering mode, it will show the standard button
128 // with GTK |stock_id|. 128 // with GTK |stock_id|.
129 class CustomDrawButton : public NotificationObserver { 129 class CustomDrawButton : public NotificationObserver {
130 public: 130 public:
131 // The constructor takes 4 resource ids. If a resource doesn't exist for a 131 // The constructor takes 4 resource ids. If a resource doesn't exist for a
132 // button, pass in 0. 132 // button, pass in 0.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Our theme provider. 218 // Our theme provider.
219 GtkThemeProvider* theme_provider_; 219 GtkThemeProvider* theme_provider_;
220 220
221 // Used to listen for theme change notifications. 221 // Used to listen for theme change notifications.
222 NotificationRegistrar registrar_; 222 NotificationRegistrar registrar_;
223 223
224 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); 224 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
225 }; 225 };
226 226
227 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ 227 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698