| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/native_scroll_bar_win.h" | 5 #include "views/controls/scrollbar/native_scroll_bar_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 gfx::Size NativeScrollBarWin::GetPreferredSize() { | 223 gfx::Size NativeScrollBarWin::GetPreferredSize() { |
| 224 if (native_scroll_bar_->IsHorizontal()) | 224 if (native_scroll_bar_->IsHorizontal()) |
| 225 return gfx::Size(0, GetHorizontalScrollBarHeight()); | 225 return gfx::Size(0, GetHorizontalScrollBarHeight()); |
| 226 return gfx::Size(GetVerticalScrollBarWidth(), 0); | 226 return gfx::Size(GetVerticalScrollBarWidth(), 0); |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) { | 229 bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) { |
| 230 if (!sb_container_.get()) | 230 if (!sb_container_.get()) |
| 231 return false; | 231 return false; |
| 232 int code = -1; | 232 int code = -1; |
| 233 switch (event.GetKeyCode()) { | 233 switch (event.key_code()) { |
| 234 case ui::VKEY_UP: | 234 case ui::VKEY_UP: |
| 235 if (!native_scroll_bar_->IsHorizontal()) | 235 if (!native_scroll_bar_->IsHorizontal()) |
| 236 code = SB_LINEUP; | 236 code = SB_LINEUP; |
| 237 break; | 237 break; |
| 238 case ui::VKEY_PRIOR: | 238 case ui::VKEY_PRIOR: |
| 239 code = SB_PAGEUP; | 239 code = SB_PAGEUP; |
| 240 break; | 240 break; |
| 241 case ui::VKEY_NEXT: | 241 case ui::VKEY_NEXT: |
| 242 code = SB_PAGEDOWN; | 242 code = SB_PAGEDOWN; |
| 243 break; | 243 break; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 265 native_scroll_bar_->IsHorizontal() ? WM_HSCROLL : WM_VSCROLL, | 265 native_scroll_bar_->IsHorizontal() ? WM_HSCROLL : WM_VSCROLL, |
| 266 MAKELONG(static_cast<WORD>(code), 0), 0L); | 266 MAKELONG(static_cast<WORD>(code), 0), 0L); |
| 267 return true; | 267 return true; |
| 268 } | 268 } |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool NativeScrollBarWin::OnMouseWheel(const MouseWheelEvent& e) { | 272 bool NativeScrollBarWin::OnMouseWheel(const MouseWheelEvent& e) { |
| 273 if (!sb_container_.get()) | 273 if (!sb_container_.get()) |
| 274 return false; | 274 return false; |
| 275 sb_container_->ScrollWithOffset(e.GetOffset()); | 275 sb_container_->ScrollWithOffset(e.offset()); |
| 276 return true; | 276 return true; |
| 277 } | 277 } |
| 278 | 278 |
| 279 //////////////////////////////////////////////////////////////////////////////// | 279 //////////////////////////////////////////////////////////////////////////////// |
| 280 // NativeScrollBarWin, NativeControlWin overrides: | 280 // NativeScrollBarWin, NativeControlWin overrides: |
| 281 | 281 |
| 282 void NativeScrollBarWin::CreateNativeControl() { | 282 void NativeScrollBarWin::CreateNativeControl() { |
| 283 sb_container_.reset(new ScrollBarContainer(native_scroll_bar_)); | 283 sb_container_.reset(new ScrollBarContainer(native_scroll_bar_)); |
| 284 NativeControlCreated(sb_container_->hwnd()); | 284 NativeControlCreated(sb_container_->hwnd()); |
| 285 // Reinstall scroll state if we have valid information. | 285 // Reinstall scroll state if we have valid information. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { | 340 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { |
| 341 return GetSystemMetrics(SM_CYHSCROLL); | 341 return GetSystemMetrics(SM_CYHSCROLL); |
| 342 } | 342 } |
| 343 | 343 |
| 344 // static | 344 // static |
| 345 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { | 345 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { |
| 346 return GetSystemMetrics(SM_CXVSCROLL); | 346 return GetSystemMetrics(SM_CXVSCROLL); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace views | 349 } // namespace views |
| OLD | NEW |