Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Side by Side Diff: views/controls/scrollbar/bitmap_scroll_bar.cc

Issue 7057014: Variety of tweaks to View API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/scroll_view.cc ('k') | views/controls/separator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 thumb_->SetBounds(thumb_->x(), thumb_->y(), thumb_prefsize.width(), 441 thumb_->SetBounds(thumb_->x(), thumb_->y(), thumb_prefsize.width(),
442 thumb_->height()); 442 thumb_->height());
443 } 443 }
444 444
445 // Hide the thumb if the track isn't tall enough to display even a tiny 445 // Hide the thumb if the track isn't tall enough to display even a tiny
446 // thumb. The user can only use the mousewheel, scroll buttons or keyboard 446 // thumb. The user can only use the mousewheel, scroll buttons or keyboard
447 // in this scenario. 447 // in this scenario.
448 if ((IsHorizontal() && (track_bounds.width() < thumb_prefsize.width()) || 448 if ((IsHorizontal() && (track_bounds.width() < thumb_prefsize.width()) ||
449 (!IsHorizontal() && (track_bounds.height() < thumb_prefsize.height())))) { 449 (!IsHorizontal() && (track_bounds.height() < thumb_prefsize.height())))) {
450 thumb_->SetVisible(false); 450 thumb_->SetVisible(false);
451 } else if (!thumb_->IsVisible()) { 451 } else if (!thumb_->visible()) {
452 thumb_->SetVisible(true); 452 thumb_->SetVisible(true);
453 } 453 }
454 } 454 }
455 455
456 bool BitmapScrollBar::OnMousePressed(const MouseEvent& event) { 456 bool BitmapScrollBar::OnMousePressed(const MouseEvent& event) {
457 if (event.IsOnlyLeftMouseButton()) { 457 if (event.IsOnlyLeftMouseButton()) {
458 SetThumbTrackState(CustomButton::BS_PUSHED); 458 SetThumbTrackState(CustomButton::BS_PUSHED);
459 gfx::Rect thumb_bounds = thumb_->bounds(); 459 gfx::Rect thumb_bounds = thumb_->bounds();
460 if (IsHorizontal()) { 460 if (IsHorizontal()) {
461 if (event.x() < thumb_bounds.x()) { 461 if (event.x() < thumb_bounds.x()) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 thumb_position = thumb_position - (thumb_->GetSize() / 2); 727 thumb_position = thumb_position - (thumb_->GetSize() / 2);
728 return (thumb_position * contents_size_) / GetTrackSize(); 728 return (thumb_position * contents_size_) / GetTrackSize();
729 } 729 }
730 730
731 void BitmapScrollBar::SetThumbTrackState(CustomButton::ButtonState state) { 731 void BitmapScrollBar::SetThumbTrackState(CustomButton::ButtonState state) {
732 thumb_track_state_ = state; 732 thumb_track_state_ = state;
733 SchedulePaint(); 733 SchedulePaint();
734 } 734 }
735 735
736 } // namespace views 736 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/scroll_view.cc ('k') | views/controls/separator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698