OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/l10n_util.h" | 5 #include "chrome/common/l10n_util.h" |
6 #include "chrome/common/l10n_util_win.h" | 6 #include "chrome/common/l10n_util_win.h" |
7 | 7 |
| 8 #include "base/win_util.h" |
| 9 |
8 namespace l10n_util { | 10 namespace l10n_util { |
9 | 11 |
10 int GetExtendedStyles() { | 12 int GetExtendedStyles() { |
11 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : | 13 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : |
12 WS_EX_LAYOUTRTL | WS_EX_RTLREADING; | 14 WS_EX_LAYOUTRTL | WS_EX_RTLREADING; |
13 } | 15 } |
14 | 16 |
15 int GetExtendedTooltipStyles() { | 17 int GetExtendedTooltipStyles() { |
16 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : WS_EX_LAYOUTRTL; | 18 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : WS_EX_LAYOUTRTL; |
17 } | 19 } |
18 | 20 |
19 void HWNDSetRTLLayout(HWND hwnd) { | 21 void HWNDSetRTLLayout(HWND hwnd) { |
20 DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); | 22 DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); |
21 | 23 |
22 // We don't have to do anything if the style is already set for the HWND. | 24 // We don't have to do anything if the style is already set for the HWND. |
23 if (!(ex_style & WS_EX_LAYOUTRTL)) { | 25 if (!(ex_style & WS_EX_LAYOUTRTL)) { |
24 ex_style |= WS_EX_LAYOUTRTL; | 26 ex_style |= WS_EX_LAYOUTRTL; |
25 ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); | 27 ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); |
26 | 28 |
27 // Right-to-left layout changes are not applied to the window immediately | 29 // Right-to-left layout changes are not applied to the window immediately |
28 // so we should make sure a WM_PAINT is sent to the window by invalidating | 30 // so we should make sure a WM_PAINT is sent to the window by invalidating |
29 // the entire window rect. | 31 // the entire window rect. |
30 ::InvalidateRect(hwnd, NULL, true); | 32 ::InvalidateRect(hwnd, NULL, true); |
31 } | 33 } |
32 } | 34 } |
33 | 35 |
| 36 bool IsLocaleSupportedByOS(const std::wstring& locale) { |
| 37 // Block Oriya on Windows XP. |
| 38 return !(LowerCaseEqualsASCII(locale, "or") && |
| 39 win_util::GetWinVersion() < win_util::WINVERSION_VISTA); |
| 40 } |
| 41 |
34 } // namespace l10n_util | 42 } // namespace l10n_util |
OLD | NEW |