[email protected] | f88c11d | 2009-02-26 18:00:29 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | a92b864 | 2009-05-05 23:38:56 | [diff] [blame] | 5 | #ifndef APP_L10N_UTIL_WIN_H_ |
| 6 | #define APP_L10N_UTIL_WIN_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | 3cdb6cc | 2009-02-24 23:50:13 | [diff] [blame] | 8 | |
| 9 | #include <windows.h> |
[email protected] | 337ca07 | 2010-11-16 15:28:45 | [diff] [blame] | 10 | #include <string> |
| 11 | #include <vector> |
[email protected] | 3cdb6cc | 2009-02-24 23:50:13 | [diff] [blame] | 12 | |
| 13 | namespace l10n_util { |
| 14 | |
| 15 | // Returns the locale-dependent extended window styles. |
| 16 | // This function is used for adding locale-dependent extended window styles |
| 17 | // (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window. |
| 18 | // Callers should OR this value into their extended style value when creating |
| 19 | // a window. |
| 20 | int GetExtendedStyles(); |
| 21 | |
| 22 | // TODO(xji): |
| 23 | // This is a temporary name, it will eventually replace GetExtendedStyles |
| 24 | int GetExtendedTooltipStyles(); |
| 25 | |
| 26 | // Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the |
| 27 | // underlying window. When this style is set, the UI for the window is going to |
| 28 | // be mirrored. This is generally done for the UI of right-to-left languages |
| 29 | // such as Hebrew. |
| 30 | void HWNDSetRTLLayout(HWND hwnd); |
| 31 | |
[email protected] | 3bd29d3 | 2009-04-15 19:16:10 | [diff] [blame] | 32 | // See http://blogs.msdn.com/oldnewthing/archive/2005/09/15/467598.aspx |
| 33 | // and http://blogs.msdn.com/oldnewthing/archive/2006/06/26/647365.aspx |
[email protected] | a92b864 | 2009-05-05 23:38:56 | [diff] [blame] | 34 | // as to why we need these three functions. |
[email protected] | 3bd29d3 | 2009-04-15 19:16:10 | [diff] [blame] | 35 | |
| 36 | // Return true if the default font (we get from Windows) is not suitable |
| 37 | // to use in the UI of the current UI (e.g. Malayalam, Bengali). If |
| 38 | // override_font_family and font_size_scaler are not null, they'll be |
| 39 | // filled with the font family name and the size scaler. |
| 40 | bool NeedOverrideDefaultUIFont(std::wstring* override_font_family, |
| 41 | double* font_size_scaler); |
| 42 | |
| 43 | // If the default UI font stored in |logfont| is not suitable, its family |
| 44 | // and size are replaced with those stored in the per-locale resource. |
| 45 | void AdjustUIFont(LOGFONT* logfont); |
| 46 | |
| 47 | // If the font for a given window (pointed to by HWND) is not suitable for the |
| 48 | // UI in the current UI langauge, its family and size are replaced with those |
| 49 | // stored in the per-locale resource. |
| 50 | void AdjustUIFontForWindow(HWND hwnd); |
| 51 | |
[email protected] | 337ca07 | 2010-11-16 15:28:45 | [diff] [blame] | 52 | // Allow processes to override the configured locale with the user's Windows UI |
| 53 | // languages. This function should generally be called once early in |
| 54 | // Application startup. |
| 55 | void OverrideLocaleWithUILanguageList(); |
| 56 | |
| 57 | // Retrieve the locale override, or an empty vector if the locale has not been |
| 58 | // or failed to be overridden. |
| 59 | const std::vector<std::string>& GetLocaleOverrides(); |
| 60 | |
[email protected] | 3cdb6cc | 2009-02-24 23:50:13 | [diff] [blame] | 61 | } // namespace l10n_util |
| 62 | |
[email protected] | a92b864 | 2009-05-05 23:38:56 | [diff] [blame] | 63 | #endif // APP_L10N_UTIL_WIN_H_ |