ReactOS 0.4.16-dev-1524-ga5ab400
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 87 of file mlng.cpp.

88{
89 if (IS_IME_HKL(hKL))
90 return HandleToUlong(hKL);
91
92 DWORD dwKLID;
93 if (HIWORD(hKL) == LOWORD(hKL))
94 dwKLID = LOWORD(hKL);
95 else if (IS_SPECIAL_HKL(hKL))
96 dwKLID = GetSpecialKLID(hKL);
97 else
98 dwKLID = HandleToUlong(hKL);
99
100 if (dwKLID == 0)
101 return HandleToUlong(hKL);
102
103 CicRegKey regKey;
104 LSTATUS error = regKey.Open(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes");
105 if (error == ERROR_SUCCESS)
106 {
107 WCHAR szName[MAX_PATH], szValue[MAX_PATH];
108 DWORD dwIndex, dwValue;
109 for (dwIndex = 0; ; ++dwIndex)
110 {
111 error = regKey.EnumValue(dwIndex, szName, _countof(szName));
112 szName[_countof(szName) - 1] = UNICODE_NULL; // Avoid buffer overrun
113 if (error != ERROR_SUCCESS)
114 break;
115
116 error = regKey.QuerySz(szName, szValue, _countof(szValue));
117 szValue[_countof(szValue) - 1] = UNICODE_NULL; // Avoid buffer overrun
118 if (error != ERROR_SUCCESS)
119 break;
120
121 dwValue = wcstoul(szValue, NULL, 16);
122 if ((dwKLID & ~SPECIAL_MASK) == dwValue)
123 {
124 dwKLID = wcstoul(szName, NULL, 16);
125 break;
126 }
127 }
128 }
129
130 return dwKLID;
131}
#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
#define L(x)
Definition: resources.c:13
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
#define error(str)
Definition: mkdosfs.c:1605
DWORD GetSpecialKLID(_In_ HKL hKL)
@implemented
Definition: mlng.cpp:40
#define UNICODE_NULL
#define LOWORD(l)
Definition: pedump.c:82
static const WCHAR szName[]
Definition: powrprof.c:45
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#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 205 of file mlng.cpp.

206{
207 HICON hIcon;
208
211 else
212 ::ExtractIconExW(pszFileName, iIcon, &hIcon, NULL, 1);
213
214 return hIcon;
215}
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 246 of file mlng.cpp.

247{
248 if (!EnsureIconImageList())
249 return -1;
250 return g_IconList.AddIcon(hIcon);
251}
INT AddIcon(HICON hIcon)
@implemented
Definition: mlng.cpp:445
CStaticIconList g_IconList
Definition: mlng.cpp:29
static BOOL EnsureIconImageList(VOID)
@implemented
Definition: mlng.cpp:218

Referenced by MLNGINFO::InitIcon().

◆ InatCreateIcon()

HICON InatCreateIcon ( _In_ LANGID  LangID)

@implemented

Definition at line 310 of file mlng.cpp.

311{
313
314 LOGFONTW lf;
316 return NULL;
317
318 if (cySmIcon < GetPhysicalFontHeight(&lf))
319 {
320 lf.lfWidth = 0;
321 lf.lfHeight = - (7 * cySmIcon) / 10;
322 }
323
324 return InatCreateIconBySize(LangID, cxSmIcon, cySmIcon, &lf);
325}
HICON InatCreateIconBySize(_In_ LANGID LangID, _In_ INT nWidth, _In_ INT nHeight, _In_ const LOGFONTW *plf)
@implemented
Definition: mlng.cpp:255
static INT GetPhysicalFontHeight(LOGFONTW *plf)
@implemented
Definition: mlng.cpp:227
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 255 of file mlng.cpp.

260{
261 WCHAR szText[64];
263 szText, _countof(szText));
264 if (!ret)
265 szText[0] = szText[1] = L'?';
266
267 szText[2] = UNICODE_NULL;
268 CharUpperW(szText);
269
271 if (!hFont)
272 return NULL;
273
274 HDC hDC = ::GetDC(NULL);
275 HDC hMemDC = ::CreateCompatibleDC(hDC);
276 HBITMAP hbmColor = ::CreateCompatibleBitmap(hDC, nWidth, nHeight);
277 HBITMAP hbmMask = ::CreateBitmap(nWidth, nHeight, 1, 1, NULL);
279
280 HICON hIcon = NULL;
281 HGDIOBJ hbmOld = ::SelectObject(hMemDC, hbmColor);
282 HGDIOBJ hFontOld = ::SelectObject(hMemDC, hFont);
283 if (hMemDC && hbmColor && hbmMask)
284 {
287
288 RECT rc = { 0, 0, nWidth, nHeight };
289 ::ExtTextOutW(hMemDC, 0, 0, ETO_OPAQUE, &rc, L"", 0, NULL);
290
291 ::DrawTextW(hMemDC, szText, 2, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
292 ::SelectObject(hMemDC, hbmMask);
293
294 ::PatBlt(hMemDC, 0, 0, nWidth, nHeight, BLACKNESS);
295
296 ICONINFO IconInfo = { TRUE, 0, 0, hbmMask, hbmColor };
298 }
299 ::SelectObject(hMemDC, hFontOld);
300 ::SelectObject(hMemDC, hbmOld);
301
302 ::DeleteObject(hbmMask);
303 ::DeleteObject(hbmColor);
304 ::DeleteDC(hMemDC);
306 return hIcon;
307}
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:1675
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1205
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2310
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
#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:2958
#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 328 of file mlng.cpp.

329{
330 g_IconList.GetIconSize(pcx, pcy);
331 return TRUE;
332}
void GetIconSize(INT *pcx, INT *pcy)
@implemented
Definition: mlng.cpp:473

Referenced by MLNGINFO::InitIcon().

◆ InatGetImageCount()

INT InatGetImageCount ( VOID  )

@implemented

Definition at line 335 of file mlng.cpp.

336{
337 return g_IconList.GetImageCount();
338}
INT GetImageCount()
@implemented
Definition: mlng.cpp:482

◆ InatRemoveAll()

VOID InatRemoveAll ( VOID  )

@implemented

Definition at line 341 of file mlng.cpp.

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

◆ UninitINAT()

VOID UninitINAT ( VOID  )

@implemented

Definition at line 348 of file mlng.cpp.

349{
351
352 if (g_pMlngInfo)
353 {
354 delete g_pMlngInfo;
356 }
357}
CicArray< MLNGINFO > * g_pMlngInfo
Definition: mlng.cpp:26

Referenced by ProcessDetach().