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

Unified Diff: ui/views/controls/tabbed_pane/tabbed_pane.cc

Issue 66603013: Activate Views TabbedPane tabs on mouse pressed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Limit to only the left mouse button. Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/tabbed_pane/tabbed_pane.cc
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc
index 65021d240cb9257fb93df700828a0fdb3312f25b..c3282634fca54a92b63788d4bd762801652557b2 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());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698