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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 contents_scroll_offset_ = GetMinPosition(); | 105 contents_scroll_offset_ = GetMinPosition(); |
106 } else if (contents_scroll_offset_ > GetMaxPosition()) { | 106 } else if (contents_scroll_offset_ > GetMaxPosition()) { |
107 contents_scroll_offset_ = GetMaxPosition(); | 107 contents_scroll_offset_ = GetMaxPosition(); |
108 } | 108 } |
109 ScrollContentsToOffset(); | 109 ScrollContentsToOffset(); |
110 } | 110 } |
111 | 111 |
112 /////////////////////////////////////////////////////////////////////////////// | 112 /////////////////////////////////////////////////////////////////////////////// |
113 // BaseScrollBar, View implementation: | 113 // BaseScrollBar, View implementation: |
114 | 114 |
115 bool BaseScrollBar::OnMousePressed(const MouseEvent& event) { | 115 bool BaseScrollBar::OnMousePressed(const ui::MouseEvent& event) { |
116 if (event.IsOnlyLeftMouseButton()) | 116 if (event.IsOnlyLeftMouseButton()) |
117 ProcessPressEvent(event); | 117 ProcessPressEvent(event); |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 void BaseScrollBar::OnMouseReleased(const MouseEvent& event) { | 121 void BaseScrollBar::OnMouseReleased(const ui::MouseEvent& event) { |
122 OnMouseCaptureLost(); | 122 OnMouseCaptureLost(); |
123 } | 123 } |
124 | 124 |
125 void BaseScrollBar::OnMouseCaptureLost() { | 125 void BaseScrollBar::OnMouseCaptureLost() { |
126 ResetState(); | 126 ResetState(); |
127 } | 127 } |
128 | 128 |
129 bool BaseScrollBar::OnKeyPressed(const ui::KeyEvent& event) { | 129 bool BaseScrollBar::OnKeyPressed(const ui::KeyEvent& event) { |
130 ScrollAmount amount = SCROLL_NONE; | 130 ScrollAmount amount = SCROLL_NONE; |
131 switch (event.key_code()) { | 131 switch (event.key_code()) { |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 423 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
424 return (thumb_position * contents_size_) / GetTrackSize(); | 424 return (thumb_position * contents_size_) / GetTrackSize(); |
425 } | 425 } |
426 | 426 |
427 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 427 void BaseScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
428 thumb_track_state_ = state; | 428 thumb_track_state_ = state; |
429 SchedulePaint(); | 429 SchedulePaint(); |
430 } | 430 } |
431 | 431 |
432 } // namespace views | 432 } // namespace views |
OLD | NEW |