| OLD | NEW |
| 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 CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" |
| 11 #include "ui/base/animation/animation_delegate.h" | 12 #include "ui/base/animation/animation_delegate.h" |
| 12 #include "ui/base/animation/slide_animation.h" | 13 #include "ui/base/animation/slide_animation.h" |
| 13 #include "ui/base/animation/throb_animation.h" | 14 #include "ui/base/animation/throb_animation.h" |
| 14 #include "ui/base/gtk/gtk_signal.h" | 15 #include "ui/base/gtk/gtk_signal.h" |
| 15 #include "ui/base/gtk/gtk_signal_registrar.h" | 16 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 16 | 17 |
| 17 // This class handles the "throbbing" of a GtkChromeButton. The visual effect | 18 // This class handles the "throbbing" of a GtkChromeButton. The visual effect |
| 18 // of throbbing is created by painting partially transparent hover effects. It | 19 // of throbbing is created by painting partially transparent hover effects. It |
| 19 // only works in non-gtk theme mode. This class mainly exists to glue an | 20 // only works in non-gtk theme mode. This class mainly exists to glue an |
| 20 // AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object). | 21 // AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object). |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 // Creates a GtkChromeButton and adds a HoverControllerGtk for it. | 37 // Creates a GtkChromeButton and adds a HoverControllerGtk for it. |
| 37 static GtkWidget* CreateChromeButton(); | 38 static GtkWidget* CreateChromeButton(); |
| 38 | 39 |
| 39 // Stop throbbing and delete |this|. | 40 // Stop throbbing and delete |this|. |
| 40 void Destroy(); | 41 void Destroy(); |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 explicit HoverControllerGtk(GtkWidget* button); | 44 explicit HoverControllerGtk(GtkWidget* button); |
| 44 | 45 |
| 45 // Overridden from ui::AnimationDelegate. | 46 // Overridden from ui::AnimationDelegate. |
| 46 virtual void AnimationProgressed(const ui::Animation* animation); | 47 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 47 virtual void AnimationEnded(const ui::Animation* animation); | 48 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 48 virtual void AnimationCanceled(const ui::Animation* animation); | 49 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
| 49 | 50 |
| 50 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter, | 51 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter, |
| 51 GdkEventCrossing*); | 52 GdkEventCrossing*); |
| 52 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave, | 53 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave, |
| 53 GdkEventCrossing*); | 54 GdkEventCrossing*); |
| 54 CHROMEGTK_CALLBACK_1(HoverControllerGtk, void, OnHierarchyChanged, | 55 CHROMEGTK_CALLBACK_1(HoverControllerGtk, void, OnHierarchyChanged, |
| 55 GtkWidget*); | 56 GtkWidget*); |
| 56 CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy); | 57 CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy); |
| 57 | 58 |
| 58 ui::ThrobAnimation throb_animation_; | 59 ui::ThrobAnimation throb_animation_; |
| 59 ui::SlideAnimation hover_animation_; | 60 ui::SlideAnimation hover_animation_; |
| 60 GtkWidget* button_; | 61 GtkWidget* button_; |
| 61 | 62 |
| 62 ui::GtkSignalRegistrar signals_; | 63 ui::GtkSignalRegistrar signals_; |
| 63 | 64 |
| 64 DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk); | 65 DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk); |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 #endif // CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ | 68 #endif // CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_ |
| OLD | NEW |