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

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

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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) 2012 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 CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
6 #define CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ 6 #define CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/base/animation/animation_delegate.h"
16 #include "ui/base/animation/slide_animation.h"
17 #include "ui/base/gtk/gtk_signal.h" 15 #include "ui/base/gtk/gtk_signal.h"
18 #include "ui/base/gtk/owned_widget_gtk.h" 16 #include "ui/base/gtk/owned_widget_gtk.h"
17 #include "ui/gfx/animation/animation_delegate.h"
18 #include "ui/gfx/animation/slide_animation.h"
19 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
20 20
21 class GtkThemeService; 21 class GtkThemeService;
22 class SkBitmap; 22 class SkBitmap;
23 23
24 namespace gfx { 24 namespace gfx {
25 class CairoCachedSurface; 25 class CairoCachedSurface;
26 } 26 }
27 27
28 // These classes implement two kinds of custom-drawn buttons. They're 28 // These classes implement two kinds of custom-drawn buttons. They're
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Used to listen for theme change notifications. 96 // Used to listen for theme change notifications.
97 content::NotificationRegistrar registrar_; 97 content::NotificationRegistrar registrar_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase); 99 DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase);
100 }; 100 };
101 101
102 // CustomDrawHoverController is a convenience class that eases the common task 102 // CustomDrawHoverController is a convenience class that eases the common task
103 // of controlling the hover state of a button. The "hover state" refers to the 103 // of controlling the hover state of a button. The "hover state" refers to the
104 // percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that 104 // percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
105 // when a user moves a mouse over a button the PRELIGHT fades in. 105 // when a user moves a mouse over a button the PRELIGHT fades in.
106 class CustomDrawHoverController : public ui::AnimationDelegate { 106 class CustomDrawHoverController : public gfx::AnimationDelegate {
107 public: 107 public:
108 explicit CustomDrawHoverController(GtkWidget* widget); 108 explicit CustomDrawHoverController(GtkWidget* widget);
109 CustomDrawHoverController(); 109 CustomDrawHoverController();
110 110
111 virtual ~CustomDrawHoverController(); 111 virtual ~CustomDrawHoverController();
112 112
113 void Init(GtkWidget* widget); 113 void Init(GtkWidget* widget);
114 114
115 double GetCurrentValue() { 115 double GetCurrentValue() {
116 return slide_animation_.GetCurrentValue(); 116 return slide_animation_.GetCurrentValue();
117 } 117 }
118 118
119 private: 119 private:
120 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 120 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
121 121
122 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter, 122 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
123 GdkEventCrossing*); 123 GdkEventCrossing*);
124 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave, 124 CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
125 GdkEventCrossing*); 125 GdkEventCrossing*);
126 126
127 ui::SlideAnimation slide_animation_; 127 gfx::SlideAnimation slide_animation_;
128 GtkWidget* widget_; 128 GtkWidget* widget_;
129 }; 129 };
130 130
131 // CustomDrawButton is a plain button where all its various states are drawn 131 // CustomDrawButton is a plain button where all its various states are drawn
132 // with static images. In GTK rendering mode, it will show the standard button 132 // with static images. In GTK rendering mode, it will show the standard button
133 // with GTK |stock_id|. 133 // with GTK |stock_id|.
134 class CustomDrawButton : public content::NotificationObserver { 134 class CustomDrawButton : public content::NotificationObserver {
135 public: 135 public:
136 // The constructor takes 4 resource ids. If a resource doesn't exist for a 136 // The constructor takes 4 resource ids. If a resource doesn't exist for a
137 // button, pass in 0. 137 // button, pass in 0.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // True if we should never do gtk rendering. 234 // True if we should never do gtk rendering.
235 bool forcing_chrome_theme_; 235 bool forcing_chrome_theme_;
236 236
237 // Used to listen for theme change notifications. 237 // Used to listen for theme change notifications.
238 content::NotificationRegistrar registrar_; 238 content::NotificationRegistrar registrar_;
239 239
240 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); 240 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
241 }; 241 };
242 242
243 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ 243 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc ('k') | chrome/browser/ui/gtk/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698