summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authormhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 23:53:48 +0000
committermhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 23:53:48 +0000
commitecb0a024ee469a8d591fb95ac4f8db9c6217f462 (patch)
tree36ad2aef2de12cb36eab8e951b24e90018f822c1 /views
parent9833217fbf3188fc1469d3d62b50770beb3a3e22 (diff)
downloadchromium_src-ecb0a024ee469a8d591fb95ac4f8db9c6217f462.zip
chromium_src-ecb0a024ee469a8d591fb95ac4f8db9c6217f462.tar.gz
chromium_src-ecb0a024ee469a8d591fb95ac4f8db9c6217f462.tar.bz2
Fix hottracking on button views.The hottracking on the toolbar was broken, the expected behavoir is when focus is set to the toolbar (by hitting SHIFT+ALT+T) and toolbar buttons are traversed by right/left arrow keys, a bevel should appear on the button (HOT Image).
This patch fixes the initial hottracking issue where the first item is not hottracked. BUG=10942 TEST=ALT+SHIFT+T and traverse with arrow keys, observe hot tracking. Review URL: http://codereview.chromium.org/194037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/button/custom_button.cc14
-rw-r--r--views/controls/button/custom_button.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index f9a58f6..c7eadca 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -219,6 +219,20 @@ void CustomButton::ViewHierarchyChanged(bool is_add, View *parent,
SetState(BS_NORMAL);
}
+void CustomButton::SetHotTracked(bool flag) {
+ if (state_ != BS_DISABLED)
+ SetState(flag ? BS_HOT : BS_NORMAL);
+}
+
+bool CustomButton::IsHotTracked() const {
+ return state_ == BS_HOT;
+}
+
+void CustomButton::WillLoseFocus() {
+ if (IsHotTracked())
+ SetState(BS_NORMAL);
+}
+
////////////////////////////////////////////////////////////////////////////////
// CustomButton, AnimationDelegate implementation:
diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h
index 75cb29b..bd43d4d 100644
--- a/views/controls/button/custom_button.h
+++ b/views/controls/button/custom_button.h
@@ -72,6 +72,9 @@ class CustomButton : public Button,
virtual void OnDragDone();
virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture);
virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child);
+ virtual void SetHotTracked(bool flag);
+ virtual bool IsHotTracked() const;
+ virtual void WillLoseFocus();
// Overridden from AnimationDelegate:
virtual void AnimationProgressed(const Animation* animation);