| OLD | NEW |
| 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_HOVER_CONTROLLER_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_ | 6 #define CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "app/gtk_signal.h" |
| 10 #include "app/slide_animation.h" | 11 #include "app/slide_animation.h" |
| 11 #include "app/throb_animation.h" | 12 #include "app/throb_animation.h" |
| 12 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 13 | 14 |
| 14 // This class handles the "throbbing" of a GtkChromeButton. The visual effect | 15 // This class handles the "throbbing" of a GtkChromeButton. The visual effect |
| 15 // of throbbing is created by painting partially transparent hover effects. It | 16 // of throbbing is created by painting partially transparent hover effects. It |
| 16 // only works in non-gtk theme mode. This class mainly exists to glue an | 17 // only works in non-gtk theme mode. This class mainly exists to glue an |
| 17 // AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object). | 18 // AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object). |
| 18 class HoverControllerGtk : public AnimationDelegate { | 19 class HoverControllerGtk : public AnimationDelegate { |
| 19 public: | 20 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 37 void Destroy(); | 38 void Destroy(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 explicit HoverControllerGtk(GtkWidget* button); | 41 explicit HoverControllerGtk(GtkWidget* button); |
| 41 | 42 |
| 42 // Overridden from AnimationDelegate. | 43 // Overridden from AnimationDelegate. |
| 43 virtual void AnimationProgressed(const Animation* animation); | 44 virtual void AnimationProgressed(const Animation* animation); |
| 44 virtual void AnimationEnded(const Animation* animation); | 45 virtual void AnimationEnded(const Animation* animation); |
| 45 virtual void AnimationCanceled(const Animation* animation); | 46 virtual void AnimationCanceled(const Animation* animation); |
| 46 | 47 |
| 47 static gboolean OnEnterThunk(GtkWidget* widget, | 48 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter, |
| 48 GdkEventCrossing* event, | 49 GdkEventCrossing*); |
| 49 HoverControllerGtk* hover_controller) { | 50 CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave, |
| 50 return hover_controller->OnEnter(widget, event); | 51 GdkEventCrossing*); |
| 51 } | 52 CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy); |
| 52 gboolean OnEnter(GtkWidget* widget, GdkEventCrossing* event); | |
| 53 | |
| 54 static gboolean OnLeaveThunk(GtkWidget* widget, | |
| 55 GdkEventCrossing* event, | |
| 56 HoverControllerGtk* hover_controller) { | |
| 57 return hover_controller->OnLeave(widget, event); | |
| 58 } | |
| 59 gboolean OnLeave(GtkWidget* widget, GdkEventCrossing* event); | |
| 60 | |
| 61 static void OnButtonDestroyThunk(GtkWidget* widget, | |
| 62 HoverControllerGtk* hover_controller) { | |
| 63 hover_controller->OnButtonDestroy(widget); | |
| 64 } | |
| 65 void OnButtonDestroy(GtkWidget* widget); | |
| 66 | 53 |
| 67 ThrobAnimation throb_animation_; | 54 ThrobAnimation throb_animation_; |
| 68 SlideAnimation hover_animation_; | 55 SlideAnimation hover_animation_; |
| 69 GtkWidget* button_; | 56 GtkWidget* button_; |
| 70 | 57 |
| 58 GtkSignalRegistrar signals_; |
| 59 |
| 71 DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk); | 60 DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk); |
| 72 }; | 61 }; |
| 73 | 62 |
| 74 #endif // CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_ | 63 #endif // CHROME_BROWSER_GTK_HOVER_CONTROLLER_GTK_H_ |
| OLD | NEW |