| 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/scroll_bar_views.h" | 5 #include "ui/views/controls/scrollbar/scroll_bar_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/events/keycodes/keyboard_codes.h" | 8 #include "ui/events/keycodes/keyboard_codes.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/path.h" | 10 #include "ui/gfx/path.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 params_.scrollbar_track.track_x = bounds.x(); | 271 params_.scrollbar_track.track_x = bounds.x(); |
| 272 params_.scrollbar_track.track_y = bounds.y(); | 272 params_.scrollbar_track.track_y = bounds.y(); |
| 273 params_.scrollbar_track.track_width = bounds.width(); | 273 params_.scrollbar_track.track_width = bounds.width(); |
| 274 params_.scrollbar_track.track_height = bounds.height(); | 274 params_.scrollbar_track.track_height = bounds.height(); |
| 275 params_.scrollbar_track.classic_state = 0; | 275 params_.scrollbar_track.classic_state = 0; |
| 276 | 276 |
| 277 GetNativeTheme()->Paint(canvas->sk_canvas(), part_, state_, bounds, params_); | 277 GetNativeTheme()->Paint(canvas->sk_canvas(), part_, state_, bounds, params_); |
| 278 } | 278 } |
| 279 | 279 |
| 280 gfx::Size ScrollBarViews::GetPreferredSize() const { | 280 gfx::Size ScrollBarViews::GetPreferredSize() const { |
| 281 return gfx::Size(IsHorizontal() ? 0 : GetLayoutSize(), | 281 return gfx::Size(IsHorizontal() ? 0 : GetThickness(), |
| 282 IsHorizontal() ? GetLayoutSize() : 0); | 282 IsHorizontal() ? GetThickness() : 0); |
| 283 } | 283 } |
| 284 | 284 |
| 285 const char* ScrollBarViews::GetClassName() const { | 285 const char* ScrollBarViews::GetClassName() const { |
| 286 return kViewClassName; | 286 return kViewClassName; |
| 287 } | 287 } |
| 288 | 288 |
| 289 int ScrollBarViews::GetLayoutSize() const { | 289 int ScrollBarViews::GetThickness() const { |
| 290 const ui::NativeTheme* theme = GetNativeTheme(); | 290 const ui::NativeTheme* theme = GetNativeTheme(); |
| 291 return IsHorizontal() ? GetHorizontalScrollBarHeight(theme) | 291 return IsHorizontal() ? GetHorizontalScrollBarHeight(theme) |
| 292 : GetVerticalScrollBarWidth(theme); | 292 : GetVerticalScrollBarWidth(theme); |
| 293 } | 293 } |
| 294 | 294 |
| 295 ////////////////////////////////////////////////////////////////////////////// | 295 ////////////////////////////////////////////////////////////////////////////// |
| 296 // BaseButton::ButtonListener overrides: | 296 // BaseButton::ButtonListener overrides: |
| 297 | 297 |
| 298 void ScrollBarViews::ButtonPressed(Button* sender, const ui::Event& event) { | 298 void ScrollBarViews::ButtonPressed(Button* sender, const ui::Event& event) { |
| 299 if (sender == prev_button_) { | 299 if (sender == prev_button_) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 ui::NativeTheme::ExtraParams thumb_params; | 335 ui::NativeTheme::ExtraParams thumb_params; |
| 336 thumb_params.scrollbar_thumb.is_hovering = false; | 336 thumb_params.scrollbar_thumb.is_hovering = false; |
| 337 gfx::Size track_size = | 337 gfx::Size track_size = |
| 338 theme->GetPartSize(ui::NativeTheme::kScrollbarHorizontalThumb, | 338 theme->GetPartSize(ui::NativeTheme::kScrollbarHorizontalThumb, |
| 339 ui::NativeTheme::kNormal, thumb_params); | 339 ui::NativeTheme::kNormal, thumb_params); |
| 340 | 340 |
| 341 return std::max(track_size.height(), button_size.height()); | 341 return std::max(track_size.height(), button_size.height()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace views | 344 } // namespace views |
| OLD | NEW |