summaryrefslogtreecommitdiffstats
path: root/ui/views/controls/tabbed_pane/tabbed_pane.cc
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-13 00:45:15 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-13 00:45:15 +0000
commit123ddd3a69fbdb70f09debaa2d2acf00396dead9 (patch)
tree97910f4448c19a5d4d1c85e6ea7cdd55bc77c7dd /ui/views/controls/tabbed_pane/tabbed_pane.cc
parent85033389ec6567b21ecb5ee3fe1a4ab2492498be (diff)
downloadchromium_src-123ddd3a69fbdb70f09debaa2d2acf00396dead9.zip
chromium_src-123ddd3a69fbdb70f09debaa2d2acf00396dead9.tar.gz
chromium_src-123ddd3a69fbdb70f09debaa2d2acf00396dead9.tar.bz2
Activate Views TabbedPane tabs on mouse pressed.
SelectTab in OnMousePressed and for ET_GESTURE_TAP_DOWN. Eliminate the intermediate TAB_PRESSED state enum. (Inactive/Active/Hovered cover the available states) BUG=252919 TEST=View TabbedPane tabs change on mouse down. This UI is used in the website settings bubble (via the page icon), and the collected cookies dialog (from the aforementioned bubble) on Windows and ChromeOS. R=sky@chromium.org Review URL: https://codereview.chromium.org/66603013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/tabbed_pane/tabbed_pane.cc')
-rw-r--r--ui/views/controls/tabbed_pane/tabbed_pane.cc23
1 files changed, 4 insertions, 19 deletions
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc
index 65021d2..c328263 100644
--- a/ui/views/controls/tabbed_pane/tabbed_pane.cc
+++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc
@@ -43,8 +43,6 @@ class Tab : public View {
// Overridden from View:
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
- virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
- virtual void OnMouseCaptureLost() OVERRIDE;
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
@@ -55,7 +53,6 @@ class Tab : public View {
enum TabState {
TAB_INACTIVE,
TAB_ACTIVE,
- TAB_PRESSED,
TAB_HOVERED,
};
@@ -108,18 +105,10 @@ void Tab::SetSelected(bool selected) {
}
bool Tab::OnMousePressed(const ui::MouseEvent& event) {
- SetState(TAB_PRESSED);
- return true;
-}
-
-void Tab::OnMouseReleased(const ui::MouseEvent& event) {
- SetState(selected() ? TAB_ACTIVE : TAB_HOVERED);
- if (GetLocalBounds().Contains(event.location()))
+ if (event.IsOnlyLeftMouseButton() &&
+ GetLocalBounds().Contains(event.location()))
tabbed_pane_->SelectTab(this);
-}
-
-void Tab::OnMouseCaptureLost() {
- SetState(TAB_INACTIVE);
+ return true;
}
void Tab::OnMouseEntered(const ui::MouseEvent& event) {
@@ -133,8 +122,7 @@ void Tab::OnMouseExited(const ui::MouseEvent& event) {
void Tab::OnGestureEvent(ui::GestureEvent* event) {
switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN:
- SetState(TAB_PRESSED);
- break;
+ // Fallthrough.
case ui::ET_GESTURE_TAP:
// SelectTab also sets the right tab color.
tabbed_pane_->SelectTab(this);
@@ -178,9 +166,6 @@ void Tab::SetState(TabState tab_state) {
title_->SetEnabledColor(kTabTitleColor_Active);
title_->SetFont(gfx::Font().DeriveFont(0, gfx::Font::BOLD));
break;
- case TAB_PRESSED:
- // No visual distinction for pressed state.
- break;
case TAB_HOVERED:
title_->SetEnabledColor(kTabTitleColor_Hovered);
title_->SetFont(gfx::Font());