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_win.h" | 5 #include "ui/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" |
| 11 #include "ui/base/event.h" |
11 #include "ui/base/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
12 #include "ui/base/win/hwnd_util.h" | 13 #include "ui/base/win/hwnd_util.h" |
13 #include "ui/base/win/window_impl.h" | 14 #include "ui/base/win/window_impl.h" |
14 #include "ui/views/controls/scrollbar/native_scroll_bar.h" | 15 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
15 #include "ui/views/controls/scrollbar/scroll_bar.h" | 16 #include "ui/views/controls/scrollbar/scroll_bar.h" |
16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
17 | 18 |
18 namespace views { | 19 namespace views { |
19 | 20 |
20 ///////////////////////////////////////////////////////////////////////////// | 21 ///////////////////////////////////////////////////////////////////////////// |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void NativeScrollBarWin::Layout() { | 220 void NativeScrollBarWin::Layout() { |
220 NativeControlWin::Layout(); | 221 NativeControlWin::Layout(); |
221 } | 222 } |
222 | 223 |
223 gfx::Size NativeScrollBarWin::GetPreferredSize() { | 224 gfx::Size NativeScrollBarWin::GetPreferredSize() { |
224 if (native_scroll_bar_->IsHorizontal()) | 225 if (native_scroll_bar_->IsHorizontal()) |
225 return gfx::Size(0, GetHorizontalScrollBarHeight()); | 226 return gfx::Size(0, GetHorizontalScrollBarHeight()); |
226 return gfx::Size(GetVerticalScrollBarWidth(), 0); | 227 return gfx::Size(GetVerticalScrollBarWidth(), 0); |
227 } | 228 } |
228 | 229 |
229 bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) { | 230 bool NativeScrollBarWin::OnKeyPressed(const ui::KeyEvent& event) { |
230 if (!sb_container_.get()) | 231 if (!sb_container_.get()) |
231 return false; | 232 return false; |
232 int code = -1; | 233 int code = -1; |
233 switch (event.key_code()) { | 234 switch (event.key_code()) { |
234 case ui::VKEY_UP: | 235 case ui::VKEY_UP: |
235 if (!native_scroll_bar_->IsHorizontal()) | 236 if (!native_scroll_bar_->IsHorizontal()) |
236 code = SB_LINEUP; | 237 code = SB_LINEUP; |
237 break; | 238 break; |
238 case ui::VKEY_PRIOR: | 239 case ui::VKEY_PRIOR: |
239 code = SB_PAGEUP; | 240 code = SB_PAGEUP; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { | 341 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { |
341 return GetSystemMetrics(SM_CYHSCROLL); | 342 return GetSystemMetrics(SM_CYHSCROLL); |
342 } | 343 } |
343 | 344 |
344 // static | 345 // static |
345 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { | 346 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { |
346 return GetSystemMetrics(SM_CXVSCROLL); | 347 return GetSystemMetrics(SM_CXVSCROLL); |
347 } | 348 } |
348 | 349 |
349 } // namespace views | 350 } // namespace views |
OLD | NEW |