diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 20:16:43 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 20:16:43 +0000 |
commit | 72279de2022a9c5e862963baf000b54ec559d8ed (patch) | |
tree | 14fbea01a08a9c7276ecb1981b95988ae2de0143 /views/controls/scrollbar | |
parent | 9e7b3f08a3e65b88fbb91045450b55582dd745b6 (diff) | |
download | chromium_src-72279de2022a9c5e862963baf000b54ec559d8ed.zip chromium_src-72279de2022a9c5e862963baf000b54ec559d8ed.tar.gz chromium_src-72279de2022a9c5e862963baf000b54ec559d8ed.tar.bz2 |
Reorder some views::View overrides & other functions.
Follow base class ordering and access specifiers.
Add OVERRIDE keyword where applicable.
Define BaseTab::set_animation_container out of line, update includes.
Limit RenderWidgetHostViewViews::OnTouchEvent to TOUCH_UI.
Make RenderWidgetHostViewViews::GetCursorForPoint a virtual override.
Review URL: http://codereview.chromium.org/6673070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/scrollbar')
-rw-r--r-- | views/controls/scrollbar/bitmap_scroll_bar.cc | 41 | ||||
-rw-r--r-- | views/controls/scrollbar/bitmap_scroll_bar.h | 7 |
2 files changed, 27 insertions, 21 deletions
diff --git a/views/controls/scrollbar/bitmap_scroll_bar.cc b/views/controls/scrollbar/bitmap_scroll_bar.cc index d41c332..beef8c4 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -394,11 +394,6 @@ void BitmapScrollBar::ScrollByContentsOffset(int contents_offset) { ScrollContentsToOffset(); } -void BitmapScrollBar::TrackClicked() { - if (last_scroll_amount_ != SCROLL_NONE) - ScrollByAmount(last_scroll_amount_); -} - /////////////////////////////////////////////////////////////////////////////// // BitmapScrollBar, View implementation: @@ -409,14 +404,6 @@ gfx::Size BitmapScrollBar::GetPreferredSize() { return gfx::Size(button_prefsize.width(), button_prefsize.height() * 2); } -void BitmapScrollBar::OnPaint(gfx::Canvas* canvas) { - // Paint the track. - gfx::Rect track_bounds = GetTrackBounds(); - canvas->TileImageInt(*images_[THUMB_TRACK][thumb_track_state_], - track_bounds.x(), track_bounds.y(), - track_bounds.width(), track_bounds.height()); -} - void BitmapScrollBar::Layout() { // Size and place the two scroll buttons. if (show_scroll_buttons_) { @@ -490,11 +477,6 @@ void BitmapScrollBar::OnMouseReleased(const MouseEvent& event, bool canceled) { View::OnMouseReleased(event, canceled); } -bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) { - ScrollByContentsOffset(event.offset()); - return true; -} - bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) { ScrollAmount amount = SCROLL_NONE; switch (event.key_code()) { @@ -534,6 +516,11 @@ bool BitmapScrollBar::OnKeyPressed(const KeyEvent& event) { return false; } +bool BitmapScrollBar::OnMouseWheel(const MouseWheelEvent& event) { + ScrollByContentsOffset(event.offset()); + return true; +} + /////////////////////////////////////////////////////////////////////////////// // BitmapScrollBar, ContextMenuController implementation: @@ -694,8 +681,24 @@ int BitmapScrollBar::GetPosition() const { } /////////////////////////////////////////////////////////////////////////////// +// BitmapScrollBar, View implementation: + +void BitmapScrollBar::OnPaint(gfx::Canvas* canvas) { + // Paint the track. + gfx::Rect track_bounds = GetTrackBounds(); + canvas->TileImageInt(*images_[THUMB_TRACK][thumb_track_state_], + track_bounds.x(), track_bounds.y(), + track_bounds.width(), track_bounds.height()); +} + +/////////////////////////////////////////////////////////////////////////////// // BitmapScrollBar, private: +void BitmapScrollBar::TrackClicked() { + if (last_scroll_amount_ != SCROLL_NONE) + ScrollByAmount(last_scroll_amount_); +} + void BitmapScrollBar::ScrollContentsToOffset() { GetController()->ScrollToPosition(this, contents_scroll_offset_); thumb_->SetPosition(CalculateThumbPosition(contents_scroll_offset_)); diff --git a/views/controls/scrollbar/bitmap_scroll_bar.h b/views/controls/scrollbar/bitmap_scroll_bar.h index 839e872..8357fd1 100644 --- a/views/controls/scrollbar/bitmap_scroll_bar.h +++ b/views/controls/scrollbar/bitmap_scroll_bar.h @@ -96,12 +96,11 @@ class BitmapScrollBar : public ScrollBar, // View overrides: virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void Layout() OVERRIDE; virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const MouseEvent& event, bool canceled) OVERRIDE; - virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; + virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; // BaseButton::ButtonListener overrides: virtual void ButtonPressed(Button* sender, @@ -124,6 +123,10 @@ class BitmapScrollBar : public ScrollBar, virtual bool IsCommandEnabled(int id) const OVERRIDE; virtual void ExecuteCommand(int id) OVERRIDE; + protected: + // View overrides: + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + private: // Called when the mouse is pressed down in the track area. void TrackClicked(); |