| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/base_scroll_bar.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
| 129 // BaseScrollBar, View implementation: | 129 // BaseScrollBar, View implementation: |
| 130 | 130 |
| 131 bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) { | 131 bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) { |
| 132 if (event.IsOnlyLeftMouseButton()) | 132 if (event.IsOnlyLeftMouseButton()) |
| 133 ProcessPressEvent(event); | 133 ProcessPressEvent(event); |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) { | 137 void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) { |
| 138 SetState(HitTestPoint(event.location()) ? | 138 SetState(HitTestPoint(gfx::ToFlooredPoint(event.location())) |
| 139 CustomButton::STATE_HOVERED : CustomButton::STATE_NORMAL); | 139 ? CustomButton::STATE_HOVERED |
| 140 : CustomButton::STATE_NORMAL); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void BaseScrollBar::OnMouseCaptureLost() { | 143 void BaseScrollBar::OnMouseCaptureLost() { |
| 143 SetState(CustomButton::STATE_NORMAL); | 144 SetState(CustomButton::STATE_NORMAL); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void BaseScrollBar::OnMouseEntered(const ui::MouseEvent& event) { | 147 void BaseScrollBar::OnMouseEntered(const ui::MouseEvent& event) { |
| 147 SetThumbTrackState(CustomButton::STATE_HOVERED); | 148 SetThumbTrackState(CustomButton::STATE_HOVERED); |
| 148 } | 149 } |
| 149 | 150 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 511 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
| 511 return (thumb_position * contents_size_) / GetTrackSize(); | 512 return (thumb_position * contents_size_) / GetTrackSize(); |
| 512 } | 513 } |
| 513 | 514 |
| 514 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 515 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
| 515 thumb_track_state_ = state; | 516 thumb_track_state_ = state; |
| 516 SchedulePaint(); | 517 SchedulePaint(); |
| 517 } | 518 } |
| 518 | 519 |
| 519 } // namespace views | 520 } // namespace views |
| OLD | NEW |