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

Unified Diff: chrome/browser/ui/gtk/hover_controller_gtk.h

Issue 6099014: Move chrome/browser/gtk to chrome/browser/ui/gtk (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Move browser/gtk/ to browser/ui/gtk/, leave header stubs, update new header guards 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | chrome/browser/ui/gtk/hover_controller_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/hover_controller_gtk.h
diff --git a/chrome/browser/ui/gtk/hover_controller_gtk.h b/chrome/browser/ui/gtk/hover_controller_gtk.h
new file mode 100644
index 0000000000000000000000000000000000000000..8359869f6d97a84191613ed705a6d967380bf83e
--- /dev/null
+++ b/chrome/browser/ui/gtk/hover_controller_gtk.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
+#define CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "app/gtk_signal.h"
+#include "app/gtk_signal_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
+
+// This class handles the "throbbing" of a GtkChromeButton. The visual effect
+// of throbbing is created by painting partially transparent hover effects. It
+// only works in non-gtk theme mode. This class mainly exists to glue an
+// AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object).
+class HoverControllerGtk : public ui::AnimationDelegate {
+ public:
+ virtual ~HoverControllerGtk();
+
+ GtkWidget* button() { return button_; }
+
+ // Throb for |cycles| cycles. This will override the current remaining
+ // number of cycles. Note that a "cycle" is (somewhat unintuitively) half of
+ // a complete throb revolution.
+ void StartThrobbing(int cycles);
+
+ // Get the HoverControllerGtk for a given GtkChromeButton*. It is an error
+ // to call this on a widget that is not a GtkChromeButton*.
+ static HoverControllerGtk* GetHoverControllerGtk(GtkWidget* button);
+
+ // Creates a GtkChromeButton and adds a HoverControllerGtk for it.
+ static GtkWidget* CreateChromeButton();
+
+ // Stop throbbing and delete |this|.
+ void Destroy();
+
+ private:
+ explicit HoverControllerGtk(GtkWidget* button);
+
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnLeave,
+ GdkEventCrossing*);
+ CHROMEGTK_CALLBACK_1(HoverControllerGtk, void, OnHierarchyChanged,
+ GtkWidget*);
+ CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy);
+
+ ui::ThrobAnimation throb_animation_;
+ ui::SlideAnimation hover_animation_;
+ GtkWidget* button_;
+
+ GtkSignalRegistrar signals_;
+
+ DISALLOW_COPY_AND_ASSIGN(HoverControllerGtk);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_HOVER_CONTROLLER_GTK_H_
« no previous file with comments | « chrome/browser/ui/gtk/gtk_util.cc ('k') | chrome/browser/ui/gtk/hover_controller_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698