| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/native_control.h" | 5 #include "chrome/views/native_control.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atlcrack.h> | 9 #include <atlcrack.h> |
| 10 #include <atlframe.h> | 10 #include <atlframe.h> |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // If the UI for the view is mirrored, we should make sure we add the | 333 // If the UI for the view is mirrored, we should make sure we add the |
| 334 // extended window style for a right-to-left layout so the subclass creates | 334 // extended window style for a right-to-left layout so the subclass creates |
| 335 // a mirrored HWND for the underlying control. | 335 // a mirrored HWND for the underlying control. |
| 336 DWORD ex_style = 0; | 336 DWORD ex_style = 0; |
| 337 if (UILayoutIsRightToLeft()) | 337 if (UILayoutIsRightToLeft()) |
| 338 ex_style |= l10n_util::GetExtendedStyles(); | 338 ex_style |= l10n_util::GetExtendedStyles(); |
| 339 | 339 |
| 340 return ex_style; | 340 return ex_style; |
| 341 } | 341 } |
| 342 | 342 |
| 343 DWORD NativeControl::GetAdditionalRTLStyle() const { |
| 344 // If the UI for the view is mirrored, we should make sure we add the |
| 345 // extended window style for a right-to-left layout so the subclass creates |
| 346 // a mirrored HWND for the underlying control. |
| 347 DWORD ex_style = 0; |
| 348 if (UILayoutIsRightToLeft()) |
| 349 ex_style |= l10n_util::GetExtendedTooltipStyles(); |
| 350 |
| 351 return ex_style; |
| 352 } |
| 353 |
| 343 // static | 354 // static |
| 344 LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, | 355 LRESULT CALLBACK NativeControl::NativeControlWndProc(HWND window, UINT message, |
| 345 WPARAM w_param, | 356 WPARAM w_param, |
| 346 LPARAM l_param) { | 357 LPARAM l_param) { |
| 347 HANDLE original_handler = GetProp(window, kHandlerKey); | 358 HANDLE original_handler = GetProp(window, kHandlerKey); |
| 348 DCHECK(original_handler); | 359 DCHECK(original_handler); |
| 349 NativeControl* native_control = | 360 NativeControl* native_control = |
| 350 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); | 361 static_cast<NativeControl*>(GetProp(window, kNativeControlKey)); |
| 351 DCHECK(native_control); | 362 DCHECK(native_control); |
| 352 | 363 |
| 353 if (message == WM_KEYDOWN) { | 364 if (message == WM_KEYDOWN) { |
| 354 if (native_control->OnKeyDown(static_cast<int>(w_param))) | 365 if (native_control->OnKeyDown(static_cast<int>(w_param))) |
| 355 return 0; | 366 return 0; |
| 356 } else if (message == WM_DESTROY) { | 367 } else if (message == WM_DESTROY) { |
| 357 win_util::SetWindowProc(window, | 368 win_util::SetWindowProc(window, |
| 358 reinterpret_cast<WNDPROC>(original_handler)); | 369 reinterpret_cast<WNDPROC>(original_handler)); |
| 359 RemoveProp(window, kHandlerKey); | 370 RemoveProp(window, kHandlerKey); |
| 360 RemoveProp(window, kNativeControlKey); | 371 RemoveProp(window, kNativeControlKey); |
| 361 } | 372 } |
| 362 | 373 |
| 363 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 374 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
| 364 message, w_param, l_param); | 375 message, w_param, l_param); |
| 365 } | 376 } |
| 366 | 377 |
| 367 } // namespace views | 378 } // namespace views |
| 368 | 379 |
| OLD | NEW |