| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/scrollbar/bitmap_scroll_bar.h" | 5 #include "views/controls/scrollbar/bitmap_scroll_bar.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include "views/screen.h" | 8 #include "views/screen.h" |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 return true; | 484 return true; |
| 485 } | 485 } |
| 486 | 486 |
| 487 void BitmapScrollBar::OnMouseReleased(const MouseEvent& event, bool canceled) { | 487 void BitmapScrollBar::OnMouseReleased(const MouseEvent& event, bool canceled) { |
| 488 SetThumbTrackState(CustomButton::BS_NORMAL); | 488 SetThumbTrackState(CustomButton::BS_NORMAL); |
| 489 repeater_.Stop(); | 489 repeater_.Stop(); |
| 490 View::OnMouseReleased(event, canceled); | 490 View::OnMouseReleased(event, canceled); |
| 491 } | 491 } |
| 492 | 492 |
| 493 bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) { | 493 bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) { |
| 494 ScrollByContentsOffset(event.GetOffset()); | 494 ScrollByContentsOffset(event.offset()); |
| 495 return true; | 495 return true; |
| 496 } | 496 } |
| 497 | 497 |
| 498 bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) { | 498 bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) { |
| 499 ScrollAmount amount = SCROLL_NONE; | 499 ScrollAmount amount = SCROLL_NONE; |
| 500 switch (event.GetKeyCode()) { | 500 switch (event.key_code()) { |
| 501 case ui::VKEY_UP: | 501 case ui::VKEY_UP: |
| 502 if (!IsHorizontal()) | 502 if (!IsHorizontal()) |
| 503 amount = SCROLL_PREV_LINE; | 503 amount = SCROLL_PREV_LINE; |
| 504 break; | 504 break; |
| 505 case ui::VKEY_DOWN: | 505 case ui::VKEY_DOWN: |
| 506 if (!IsHorizontal()) | 506 if (!IsHorizontal()) |
| 507 amount = SCROLL_NEXT_LINE; | 507 amount = SCROLL_NEXT_LINE; |
| 508 break; | 508 break; |
| 509 case ui::VKEY_LEFT: | 509 case ui::VKEY_LEFT: |
| 510 if (IsHorizontal()) | 510 if (IsHorizontal()) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 thumb_position = thumb_position - (thumb_->GetSize() / 2); | 717 thumb_position = thumb_position - (thumb_->GetSize() / 2); |
| 718 return (thumb_position * contents_size_) / GetTrackSize(); | 718 return (thumb_position * contents_size_) / GetTrackSize(); |
| 719 } | 719 } |
| 720 | 720 |
| 721 void BitmapScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { | 721 void BitmapScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { |
| 722 thumb_track_state_ = state; | 722 thumb_track_state_ = state; |
| 723 SchedulePaint(); | 723 SchedulePaint(); |
| 724 } | 724 } |
| 725 | 725 |
| 726 } // namespace views | 726 } // namespace views |
| OLD | NEW |