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/native_scroll_bar_views.h" | 5 #include "ui/views/controls/scrollbar/native_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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 // static | 370 // static |
371 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( | 371 NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper( |
372 NativeScrollBar* scroll_bar) { | 372 NativeScrollBar* scroll_bar) { |
373 return new NativeScrollBarViews(scroll_bar); | 373 return new NativeScrollBarViews(scroll_bar); |
374 } | 374 } |
375 | 375 |
376 // static | 376 // static |
377 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight( | 377 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight( |
378 const ui::NativeTheme* theme) { | 378 const ui::NativeTheme* theme) { |
379 if (!theme) | |
380 theme = ui::NativeTheme::instance(); | |
381 ui::NativeTheme::ExtraParams button_params; | 379 ui::NativeTheme::ExtraParams button_params; |
382 button_params.scrollbar_arrow.is_hovering = false; | 380 button_params.scrollbar_arrow.is_hovering = false; |
383 gfx::Size button_size = theme->GetPartSize( | 381 gfx::Size button_size = theme->GetPartSize( |
384 ui::NativeTheme::kScrollbarLeftArrow, | 382 ui::NativeTheme::kScrollbarLeftArrow, |
385 ui::NativeTheme::kNormal, | 383 ui::NativeTheme::kNormal, |
386 button_params); | 384 button_params); |
387 | 385 |
388 ui::NativeTheme::ExtraParams thumb_params; | 386 ui::NativeTheme::ExtraParams thumb_params; |
389 thumb_params.scrollbar_thumb.is_hovering = false; | 387 thumb_params.scrollbar_thumb.is_hovering = false; |
390 gfx::Size track_size = theme->GetPartSize( | 388 gfx::Size track_size = theme->GetPartSize( |
391 ui::NativeTheme::kScrollbarHorizontalThumb, | 389 ui::NativeTheme::kScrollbarHorizontalThumb, |
392 ui::NativeTheme::kNormal, | 390 ui::NativeTheme::kNormal, |
393 thumb_params); | 391 thumb_params); |
394 | 392 |
395 return std::max(track_size.height(), button_size.height()); | 393 return std::max(track_size.height(), button_size.height()); |
396 } | 394 } |
397 | 395 |
398 // static | 396 // static |
399 int NativeScrollBarWrapper::GetVerticalScrollBarWidth( | 397 int NativeScrollBarWrapper::GetVerticalScrollBarWidth( |
400 const ui::NativeTheme* theme) { | 398 const ui::NativeTheme* theme) { |
401 if (!theme) | |
402 theme = ui::NativeTheme::instance(); | |
403 ui::NativeTheme::ExtraParams button_params; | 399 ui::NativeTheme::ExtraParams button_params; |
404 button_params.scrollbar_arrow.is_hovering = false; | 400 button_params.scrollbar_arrow.is_hovering = false; |
405 gfx::Size button_size = theme->GetPartSize( | 401 gfx::Size button_size = theme->GetPartSize( |
406 ui::NativeTheme::kScrollbarUpArrow, | 402 ui::NativeTheme::kScrollbarUpArrow, |
407 ui::NativeTheme::kNormal, | 403 ui::NativeTheme::kNormal, |
408 button_params); | 404 button_params); |
409 | 405 |
410 ui::NativeTheme::ExtraParams thumb_params; | 406 ui::NativeTheme::ExtraParams thumb_params; |
411 thumb_params.scrollbar_thumb.is_hovering = false; | 407 thumb_params.scrollbar_thumb.is_hovering = false; |
412 gfx::Size track_size = theme->GetPartSize( | 408 gfx::Size track_size = theme->GetPartSize( |
413 ui::NativeTheme::kScrollbarVerticalThumb, | 409 ui::NativeTheme::kScrollbarVerticalThumb, |
414 ui::NativeTheme::kNormal, | 410 ui::NativeTheme::kNormal, |
415 thumb_params); | 411 thumb_params); |
416 | 412 |
417 return std::max(track_size.width(), button_size.width()); | 413 return std::max(track_size.width(), button_size.width()); |
418 } | 414 } |
419 | 415 |
420 } // namespace views | 416 } // namespace views |
OLD | NEW |