- add sources.
[platform/framework/web/crosswalk.git] / src / ui / base / l10n / l10n_util_win.h
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_L10N_L10N_UTIL_WIN_H_
6 #define UI_BASE_L10N_L10N_UTIL_WIN_H_
7
8 #include <windows.h>
9 #include <string>
10 #include <vector>
11
12 #include "base/strings/string16.h"
13 #include "ui/base/ui_export.h"
14
15 namespace l10n_util {
16
17 // Returns the locale-dependent extended window styles.
18 // This function is used for adding locale-dependent extended window styles
19 // (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window.
20 // Callers should OR this value into their extended style value when creating
21 // a window.
22 UI_EXPORT int GetExtendedStyles();
23
24 // TODO(xji):
25 // This is a temporary name, it will eventually replace GetExtendedStyles
26 UI_EXPORT int GetExtendedTooltipStyles();
27
28 // Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the
29 // underlying window. When this style is set, the UI for the window is going to
30 // be mirrored. This is generally done for the UI of right-to-left languages
31 // such as Hebrew.
32 UI_EXPORT void HWNDSetRTLLayout(HWND hwnd);
33
34 // See http://blogs.msdn.com/oldnewthing/archive/2005/09/15/467598.aspx
35 // and  http://blogs.msdn.com/oldnewthing/archive/2006/06/26/647365.aspx
36 // as to why we need these three functions.
37
38 // Return true if the default font (we get from Windows) is not suitable
39 // to use in the UI of the current UI (e.g. Malayalam, Bengali). If
40 // override_font_family and font_size_scaler are not null, they'll be
41 // filled with the font family name and the size scaler.  The output
42 // parameters are not modified if the return value is false.
43 UI_EXPORT bool NeedOverrideDefaultUIFont(string16* override_font_family,
44                                          double* font_size_scaler);
45
46 // If the default UI font stored in |logfont| is not suitable, its family
47 // and size are replaced with those stored in the per-locale resource. The
48 // font size is adjusted based on the font scale setting in the OS preferences.
49 // Windows 8 supports scale factors of 1, 1.4 and 1.8.
50 UI_EXPORT void AdjustUIFont(LOGFONT* logfont);
51
52 // If the default UI font stored in |logfont| is not suitable, its family
53 // and size are replaced with those stored in the per-locale resource. The
54 // |dpi_scale| is the ratio of the OS setting for dots per inch relative to the
55 // baseline of 96 DPI.  This ratio is also used for converting sizes from
56 // device independent pixels (DIP) to physical pixels. The font size is scaled
57 // for use with Views and Aura which work in DIP.
58 UI_EXPORT void AdjustUIFontForDIP(float dpi_scale, LOGFONT* logfont);
59
60 // If the font for a given window (pointed to by HWND) is not suitable for the
61 // UI in the current UI langauge, its family and size are replaced with those
62 // stored in the per-locale resource.
63 UI_EXPORT void AdjustUIFontForWindow(HWND hwnd);
64
65 // Allow processes to override the configured locale with the user's Windows UI
66 // languages.  This function should generally be called once early in
67 // Application startup.
68 UI_EXPORT void OverrideLocaleWithUILanguageList();
69
70 // Retrieve the locale override, or an empty vector if the locale has not been
71 // or failed to be overridden.
72 const std::vector<std::string>& GetLocaleOverrides();
73
74 }  // namespace l10n_util
75
76 #endif  // UI_BASE_L10N_L10N_UTIL_WIN_H_