| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bitmap_scroll_bar.h" | 5 #include "ui/views/controls/scrollbar/bitmap_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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } else if (!thumb->visible()) { | 285 } else if (!thumb->visible()) { |
| 286 thumb->SetVisible(true); | 286 thumb->SetVisible(true); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 /////////////////////////////////////////////////////////////////////////////// | 290 /////////////////////////////////////////////////////////////////////////////// |
| 291 // BitmapScrollBar, View implementation: | 291 // BitmapScrollBar, View implementation: |
| 292 | 292 |
| 293 void BitmapScrollBar::OnPaint(gfx::Canvas* canvas) { | 293 void BitmapScrollBar::OnPaint(gfx::Canvas* canvas) { |
| 294 // Paint the track. | 294 // Paint the track. |
| 295 gfx::Rect track_bounds = GetTrackBounds(); | |
| 296 canvas->TileImageInt(*images_[THUMB_TRACK][GetThumbTrackState()], | 295 canvas->TileImageInt(*images_[THUMB_TRACK][GetThumbTrackState()], |
| 297 track_bounds.x(), track_bounds.y(), | 296 GetTrackBounds()); |
| 298 track_bounds.width(), track_bounds.height()); | |
| 299 } | 297 } |
| 300 | 298 |
| 301 /////////////////////////////////////////////////////////////////////////////// | 299 /////////////////////////////////////////////////////////////////////////////// |
| 302 // BitmapScrollBar, ButtonListener implementation: | 300 // BitmapScrollBar, ButtonListener implementation: |
| 303 | 301 |
| 304 void BitmapScrollBar::ButtonPressed(Button* sender, const views::Event& event) { | 302 void BitmapScrollBar::ButtonPressed(Button* sender, const views::Event& event) { |
| 305 if (sender == prev_button_) { | 303 if (sender == prev_button_) { |
| 306 ScrollByAmount(SCROLL_PREV_LINE); | 304 ScrollByAmount(SCROLL_PREV_LINE); |
| 307 } else if (sender == next_button_) { | 305 } else if (sender == next_button_) { |
| 308 ScrollByAmount(SCROLL_NEXT_LINE); | 306 ScrollByAmount(SCROLL_NEXT_LINE); |
| 309 } | 307 } |
| 310 } | 308 } |
| 311 | 309 |
| 312 } // namespace views | 310 } // namespace views |
| OLD | NEW |