ReactOS 0.4.16-dev-1273-g5b94656
mlng.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MLNGINFO
 
class  CStaticIconList
 

Macros

#define CTF_COMPAT_DELAY_FIRST_ACTIVATE   2
 

Functions

INT InatAddIcon (_In_ HICON hIcon)
 @implemented
 
HICON InatCreateIcon (_In_ LANGID LangID)
 @implemented
 
HICON InatCreateIconBySize (_In_ LANGID LangID, _In_ INT nWidth, _In_ INT nHeight, _In_ const LOGFONTW *plf)
 @implemented
 
BOOL InatGetIconSize (_Out_ INT *pcx, _Out_ INT *pcy)
 @implemented
 
INT InatGetImageCount (VOID)
 @implemented
 
VOID InatRemoveAll (VOID)
 @implemented
 
DWORD GetHKLSubstitute (_In_ HKL hKL)
 @implemented
 
HICON GetIconFromFile (_In_ INT cx, _In_ INT cy, _In_ LPCWSTR pszFileName, _In_ INT iIcon)
 @implemented
 
VOID UninitINAT (VOID)
 @implemented
 

Macro Definition Documentation

◆ CTF_COMPAT_DELAY_FIRST_ACTIVATE

#define CTF_COMPAT_DELAY_FIRST_ACTIVATE   2

Definition at line 10 of file mlng.h.

Function Documentation

◆ GetHKLSubstitute()

DWORD GetHKLSubstitute ( _In_ HKL  hKL)

@implemented

Definition at line 94 of file mlng.cpp.

95{
96 if (IS_IME_HKL(hKL))
97 return HandleToUlong(hKL);
98
99 DWORD dwKLID;
100 if (HIWORD(hKL) == LOWORD(hKL))
101 dwKLID = LOWORD(hKL);
102 else if (IS_SPECIAL_HKL(hKL))
103 dwKLID = GetSpecialKLID(hKL);
104 else
105 dwKLID = HandleToUlong(hKL);
106
107 if (dwKLID == 0)
108 return HandleToUlong(hKL);
109
110 CicRegKey regKey;
111 LSTATUS error = regKey.Open(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes");
112 if (error == ERROR_SUCCESS)
113 {
114 WCHAR szName[MAX_PATH], szValue[MAX_PATH];
115 DWORD dwIndex, dwValue;
116 for (dwIndex = 0; ; ++dwIndex)
117 {
118 error = regKey.EnumValue(dwIndex, szName, _countof(szName));
119 szName[_countof(szName) - 1] = UNICODE_NULL; // Avoid buffer overrun
120 if (error != ERROR_SUCCESS)
121 break;
122
123 error = regKey.QuerySz(szName, szValue, _countof(szValue));
124 szValue[_countof(szValue) - 1] = UNICODE_NULL; // Avoid buffer overrun
125 if (error != ERROR_SUCCESS)
126 break;
127
128 dwValue = wcstoul(szValue, NULL, 16);
129 if ((dwKLID & ~SPECIAL_MASK) == dwValue)
130 {
131 dwKLID = wcstoul(szName, NULL, 16);
132 break;
133 }
134 }
135 }
136
137 return dwKLID;
138}
#define SPECIAL_MASK
Definition: debug.h:13
#define HandleToUlong(h)
Definition: basetsd.h:79
LSTATUS QuerySz(LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax)
Definition: cicreg.h:84
LSTATUS Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired=KEY_READ)
Definition: cicreg.h:51
LSTATUS EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName)
Definition: cicreg.h:108
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IS_SPECIAL_HKL(hKL)
Definition: imm32_undoc.h:22
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:21
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define error(str)
Definition: mkdosfs.c:1605
DWORD GetSpecialKLID(_In_ HKL hKL)
@implemented
Definition: mlng.cpp:47
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
static const WCHAR szName[]
Definition: powrprof.c:45
#define _countof(array)
Definition: sndvol32.h:70
#define HIWORD(l)
Definition: typedefs.h:247
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GetKbdLayoutNameFromReg().

◆ GetIconFromFile()

HICON GetIconFromFile ( _In_ INT  cx,
_In_ INT  cy,
_In_ LPCWSTR  pszFileName,
_In_ INT  iIcon 
)

@implemented

Definition at line 212 of file mlng.cpp.

213{
214 HICON hIcon;
215
218 else
219 ::ExtractIconExW(pszFileName, iIcon, &hIcon, NULL, 1);
220
221 return hIcon;
222}
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
_Out_opt_ int * cx
Definition: commctrl.h:585
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
#define SM_CXSMICON
Definition: winuser.h:1023
int WINAPI GetSystemMetrics(_In_ int)

Referenced by MLNGINFO::InitIcon().

◆ InatAddIcon()

INT InatAddIcon ( _In_ HICON  hIcon)

@implemented

Definition at line 253 of file mlng.cpp.

254{
255 if (!EnsureIconImageList())
256 return -1;
257 return g_IconList.AddIcon(hIcon);
258}
INT AddIcon(HICON hIcon)
@implemented
Definition: mlng.cpp:452
CStaticIconList g_IconList
Definition: mlng.cpp:36
static BOOL EnsureIconImageList(VOID)
@implemented
Definition: mlng.cpp:225

Referenced by MLNGINFO::InitIcon().

◆ InatCreateIcon()

HICON InatCreateIcon ( _In_ LANGID  LangID)

@implemented

Definition at line 317 of file mlng.cpp.

318{
320
321 LOGFONTW lf;
323 return NULL;
324
325 if (cySmIcon < GetPhysicalFontHeight(&lf))
326 {
327 lf.lfWidth = 0;
328 lf.lfHeight = - (7 * cySmIcon) / 10;
329 }
330
331 return InatCreateIconBySize(LangID, cxSmIcon, cySmIcon, &lf);
332}
HICON InatCreateIconBySize(_In_ LANGID LangID, _In_ INT nWidth, _In_ INT nHeight, _In_ const LOGFONTW *plf)
@implemented
Definition: mlng.cpp:262
static INT GetPhysicalFontHeight(LOGFONTW *plf)
@implemented
Definition: mlng.cpp:234
LONG lfHeight
Definition: dimm.idl:59
LONG lfWidth
Definition: dimm.idl:60
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
#define SM_CYSMICON
Definition: winuser.h:1024
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1391
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by MLNGINFO::InitIcon().

◆ InatCreateIconBySize()

HICON InatCreateIconBySize ( _In_ LANGID  LangID,
_In_ INT  nWidth,
_In_ INT  nHeight,
_In_ const LOGFONTW plf 
)

@implemented

Definition at line 262 of file mlng.cpp.

267{
268 WCHAR szText[64];
270 szText, _countof(szText));
271 if (!ret)
272 szText[0] = szText[1] = L'?';
273
274 szText[2] = UNICODE_NULL;
275 CharUpperW(szText);
276
278 if (!hFont)
279 return NULL;
280
281 HDC hDC = ::GetDC(NULL);
282 HDC hMemDC = ::CreateCompatibleDC(hDC);
283 HBITMAP hbmColor = ::CreateCompatibleBitmap(hDC, nWidth, nHeight);
284 HBITMAP hbmMask = ::CreateBitmap(nWidth, nHeight, 1, 1, NULL);
286
287 HICON hIcon = NULL;
288 HGDIOBJ hbmOld = ::SelectObject(hMemDC, hbmColor);
289 HGDIOBJ hFontOld = ::SelectObject(hMemDC, hFont);
290 if (hMemDC && hbmColor && hbmMask)
291 {
294
295 RECT rc = { 0, 0, nWidth, nHeight };
296 ::ExtTextOutW(hMemDC, 0, 0, ETO_OPAQUE, &rc, L"", 0, NULL);
297
298 ::DrawTextW(hMemDC, szText, 2, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
299 ::SelectObject(hMemDC, hbmMask);
300
301 ::PatBlt(hMemDC, 0, 0, nWidth, nHeight, BLACKNESS);
302
303 ICONINFO IconInfo = { TRUE, 0, 0, hbmMask, hbmColor };
305 }
306 ::SelectObject(hMemDC, hFontOld);
307 ::SelectObject(hMemDC, hbmOld);
308
309 ::DeleteObject(hbmMask);
310 ::DeleteObject(hbmColor);
311 ::DeleteDC(hMemDC);
313 return hIcon;
314}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
#define TRUE
Definition: types.h:120
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1666
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1205
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2306
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
int ret
#define BLACKNESS
Definition: wingdi.h:323
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:34
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2943
#define DT_CENTER
Definition: winuser.h:527
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
#define DT_SINGLELINE
Definition: winuser.h:540
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
HDC WINAPI GetDC(_In_opt_ HWND)
#define DT_VCENTER
Definition: winuser.h:543

Referenced by InatCreateIcon().

◆ InatGetIconSize()

BOOL InatGetIconSize ( _Out_ INT pcx,
_Out_ INT pcy 
)

@implemented

Definition at line 335 of file mlng.cpp.

336{
337 g_IconList.GetIconSize(pcx, pcy);
338 return TRUE;
339}
void GetIconSize(INT *pcx, INT *pcy)
@implemented
Definition: mlng.cpp:480

Referenced by MLNGINFO::InitIcon().

◆ InatGetImageCount()

INT InatGetImageCount ( VOID  )

@implemented

Definition at line 342 of file mlng.cpp.

343{
344 return g_IconList.GetImageCount();
345}
INT GetImageCount()
@implemented
Definition: mlng.cpp:489

◆ InatRemoveAll()

VOID InatRemoveAll ( VOID  )

@implemented

Definition at line 348 of file mlng.cpp.

349{
352}
void RemoveAll(BOOL bNoLock)
@implemented
Definition: mlng.cpp:498
static INT s_cx
Definition: mlng.h:31
#define FALSE
Definition: types.h:117

◆ UninitINAT()

VOID UninitINAT ( VOID  )

@implemented

Definition at line 355 of file mlng.cpp.

356{
358
359 if (g_pMlngInfo)
360 {
361 delete g_pMlngInfo;
363 }
364}
CicArray< MLNGINFO > * g_pMlngInfo
Definition: mlng.cpp:33

Referenced by ProcessDetach().