summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/launcher
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 23:49:23 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-16 23:49:23 +0000
commit0c893bcfc8c118649c3d2aa21f0b9c45d233b9e8 (patch)
tree795684f6f20ca4ad74acab978cd90d733610f334 /ui/aura_shell/launcher
parentaf62a03111366db3b9991d1c7ed084297f2aa6e0 (diff)
downloadchromium_src-0c893bcfc8c118649c3d2aa21f0b9c45d233b9e8.zip
chromium_src-0c893bcfc8c118649c3d2aa21f0b9c45d233b9e8.tar.gz
chromium_src-0c893bcfc8c118649c3d2aa21f0b9c45d233b9e8.tar.bz2
Refactors the tab glow into views so that it can be used by the
launcher. BUG=none TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/8964018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura_shell/launcher')
-rw-r--r--ui/aura_shell/launcher/tabbed_launcher_button.cc23
-rw-r--r--ui/aura_shell/launcher/tabbed_launcher_button.h6
2 files changed, 28 insertions, 1 deletions
diff --git a/ui/aura_shell/launcher/tabbed_launcher_button.cc b/ui/aura_shell/launcher/tabbed_launcher_button.cc
index 404030f..71571e8 100644
--- a/ui/aura_shell/launcher/tabbed_launcher_button.cc
+++ b/ui/aura_shell/launcher/tabbed_launcher_button.cc
@@ -64,7 +64,8 @@ TabbedLauncherButton::TabbedLauncherButton(views::ButtonListener* listener,
: views::ImageButton(listener),
host_(host),
ALLOW_THIS_IN_INITIALIZER_LIST(animation_delegate_(this)),
- show_image_(true) {
+ show_image_(true),
+ ALLOW_THIS_IN_INITIALIZER_LIST(hover_controller_(this)) {
if (!bg_image_1_) {
bg_image_1_ = CreateImageSet(IDR_AURA_LAUNCHER_TABBED_BROWSER_1,
IDR_AURA_LAUNCHER_TABBED_BROWSER_1_PUSHED,
@@ -117,6 +118,8 @@ void TabbedLauncherButton::SetImages(const LauncherTabbedImages& images) {
void TabbedLauncherButton::OnPaint(gfx::Canvas* canvas) {
ImageButton::OnPaint(canvas);
+ hover_controller_.Draw(canvas, *bg_image_1_->normal_image);
+
if (images_.empty() || images_[0].image.empty() || !show_image_)
return;
@@ -139,17 +142,20 @@ void TabbedLauncherButton::OnPaint(gfx::Canvas* canvas) {
bool TabbedLauncherButton::OnMousePressed(const views::MouseEvent& event) {
ImageButton::OnMousePressed(event);
host_->MousePressedOnButton(this, event);
+ hover_controller_.HideImmediately();
return true;
}
void TabbedLauncherButton::OnMouseReleased(const views::MouseEvent& event) {
host_->MouseReleasedOnButton(this, false);
ImageButton::OnMouseReleased(event);
+ hover_controller_.Show();
}
void TabbedLauncherButton::OnMouseCaptureLost() {
host_->MouseReleasedOnButton(this, true);
ImageButton::OnMouseCaptureLost();
+ hover_controller_.Hide();
}
bool TabbedLauncherButton::OnMouseDragged(const views::MouseEvent& event) {
@@ -158,6 +164,21 @@ bool TabbedLauncherButton::OnMouseDragged(const views::MouseEvent& event) {
return true;
}
+void TabbedLauncherButton::OnMouseEntered(const views::MouseEvent& event) {
+ ImageButton::OnMouseEntered(event);
+ hover_controller_.Show();
+}
+
+void TabbedLauncherButton::OnMouseMoved(const views::MouseEvent& event) {
+ ImageButton::OnMouseMoved(event);
+ hover_controller_.SetLocation(event.location());
+}
+
+void TabbedLauncherButton::OnMouseExited(const views::MouseEvent& event) {
+ ImageButton::OnMouseExited(event);
+ hover_controller_.Hide();
+}
+
// static
TabbedLauncherButton::ImageSet* TabbedLauncherButton::CreateImageSet(
int normal_id,
diff --git a/ui/aura_shell/launcher/tabbed_launcher_button.h b/ui/aura_shell/launcher/tabbed_launcher_button.h
index 589c28a..4618cc1 100644
--- a/ui/aura_shell/launcher/tabbed_launcher_button.h
+++ b/ui/aura_shell/launcher/tabbed_launcher_button.h
@@ -11,6 +11,7 @@
#include "ui/aura_shell/launcher/launcher_types.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/views/controls/button/image_button.h"
+#include "ui/views/controls/glow_hover_controller.h"
namespace ui {
class MultiAnimation;
@@ -41,6 +42,9 @@ class TabbedLauncherButton : public views::ImageButton {
virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseCaptureLost() OVERRIDE;
virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
private:
// Used as the delegate for |animation_|. TabbedLauncherButton doesn't
@@ -91,6 +95,8 @@ class TabbedLauncherButton : public views::ImageButton {
static ImageSet* bg_image_2_;
static ImageSet* bg_image_3_;
+ views::GlowHoverController hover_controller_;
+
DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton);
};