Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: app/l10n_util_win.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | app/resource_bundle_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "app/l10n_util.h" 5 #include "app/l10n_util.h"
6 #include "app/l10n_util_win.h"
7 6
8 #include <algorithm> 7 #include <algorithm>
9 #include <windowsx.h> 8 #include <windowsx.h>
10 9
10 #include "app/l10n_util_win.h"
11 #include "base/i18n/rtl.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/win_util.h" 13 #include "base/win_util.h"
13 14
14 #include "grit/app_locale_settings.h" 15 #include "grit/app_locale_settings.h"
15 16
16 namespace { 17 namespace {
17 18
18 void AdjustLogFont(const std::wstring& font_family, 19 void AdjustLogFont(const std::wstring& font_family,
19 double font_size_scaler, 20 double font_size_scaler,
20 LOGFONT* logfont) { 21 LOGFONT* logfont) {
(...skipping 11 matching lines...) Expand all
32 memcpy(logfont->lfFaceName, font_family.data(), name_len * sizeof(WORD)); 33 memcpy(logfont->lfFaceName, font_family.data(), name_len * sizeof(WORD));
33 logfont->lfFaceName[name_len] = 0; 34 logfont->lfFaceName[name_len] = 0;
34 } 35 }
35 } 36 }
36 37
37 } // namespace 38 } // namespace
38 39
39 namespace l10n_util { 40 namespace l10n_util {
40 41
41 int GetExtendedStyles() { 42 int GetExtendedStyles() {
42 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : 43 return !base::i18n::IsRTL() ? 0 : WS_EX_LAYOUTRTL | WS_EX_RTLREADING;
43 WS_EX_LAYOUTRTL | WS_EX_RTLREADING;
44 } 44 }
45 45
46 int GetExtendedTooltipStyles() { 46 int GetExtendedTooltipStyles() {
47 return GetTextDirection() == LEFT_TO_RIGHT ? 0 : WS_EX_LAYOUTRTL; 47 return !base::i18n::IsRTL() ? 0 : WS_EX_LAYOUTRTL;
48 } 48 }
49 49
50 void HWNDSetRTLLayout(HWND hwnd) { 50 void HWNDSetRTLLayout(HWND hwnd) {
51 DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); 51 DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
52 52
53 // We don't have to do anything if the style is already set for the HWND. 53 // We don't have to do anything if the style is already set for the HWND.
54 if (!(ex_style & WS_EX_LAYOUTRTL)) { 54 if (!(ex_style & WS_EX_LAYOUTRTL)) {
55 ex_style |= WS_EX_LAYOUTRTL; 55 ex_style |= WS_EX_LAYOUTRTL;
56 ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); 56 ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
57 57
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) { 118 if (GetObject(GetWindowFont(hwnd), sizeof(logfont), &logfont)) {
119 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont); 119 AdjustLogFont(ui_font_family, ui_font_size_scaler, &logfont);
120 HFONT hfont = CreateFontIndirect(&logfont); 120 HFONT hfont = CreateFontIndirect(&logfont);
121 if (hfont) 121 if (hfont)
122 SetWindowFont(hwnd, hfont, FALSE); 122 SetWindowFont(hwnd, hfont, FALSE);
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 } // namespace l10n_util 127 } // namespace l10n_util
OLDNEW
« no previous file with comments | « app/l10n_util_unittest.cc ('k') | app/resource_bundle_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698