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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 int BaseScrollBar::GetScrollIncrement(bool is_page, bool is_positive) { | 368 int BaseScrollBar::GetScrollIncrement(bool is_page, bool is_positive) { |
369 return controller()->GetScrollIncrement(this, is_page, is_positive); | 369 return controller()->GetScrollIncrement(this, is_page, is_positive); |
370 } | 370 } |
371 | 371 |
372 | 372 |
373 /////////////////////////////////////////////////////////////////////////////// | 373 /////////////////////////////////////////////////////////////////////////////// |
374 // BaseScrollBar, private: | 374 // BaseScrollBar, private: |
375 | 375 |
376 void BaseScrollBar::ProcessPressEvent(const LocatedEvent& event) { | 376 void BaseScrollBar::ProcessPressEvent(const ui::LocatedEvent& event) { |
377 SetThumbTrackState(CustomButton::BS_PUSHED); | 377 SetThumbTrackState(CustomButton::BS_PUSHED); |
378 gfx::Rect thumb_bounds = thumb_->bounds(); | 378 gfx::Rect thumb_bounds = thumb_->bounds(); |
379 if (IsHorizontal()) { | 379 if (IsHorizontal()) { |
380 if (event.x() < thumb_bounds.x()) { | 380 if (event.x() < thumb_bounds.x()) { |
381 last_scroll_amount_ = SCROLL_PREV_PAGE; | 381 last_scroll_amount_ = SCROLL_PREV_PAGE; |
382 } else if (event.x() > thumb_bounds.right()) { | 382 } else if (event.x() > thumb_bounds.right()) { |
383 last_scroll_amount_ = SCROLL_NEXT_PAGE; | 383 last_scroll_amount_ = SCROLL_NEXT_PAGE; |
384 } | 384 } |
385 } else { | 385 } else { |
386 if (event.y() < thumb_bounds.y()) { | 386 if (event.y() < thumb_bounds.y()) { |
(...skipping 36 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 |