ReactOS  0.4.15-dev-5120-gfb68e76
settings_page.c
Go to the documentation of this file.
1 /*
2  * PROJECT: input.dll
3  * FILE: dll/cpl/input/settings_page.c
4  * PURPOSE: input.dll
5  * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
6  * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #include "input.h"
10 #include "layout_list.h"
11 #include "locale_list.h"
12 #include "input_list.h"
13 
15 static INT s_nRootCount = 0;
16 static INT s_iKeyboardImage = -1;
17 static INT s_iDotImage = -1;
19 
20 static HICON
22 {
23  WCHAR szBuf[4];
24  HDC hdcScreen, hdc;
25  HBITMAP hbmColor, hbmMono, hBmpOld;
26  HFONT hFont, hFontOld;
27  LOGFONTW lf;
28  RECT rect;
30  HICON hIcon;
33 
34  /* Getting "EN", "FR", etc. from English, French, ... */
37  szBuf,
38  ARRAYSIZE(szBuf)) == 0)
39  {
40  szBuf[0] = szBuf[1] = L'?';
41  }
42  szBuf[2] = UNICODE_NULL; /* Truncate the identifier to two characters: "ENG" --> "EN" etc. */
43 
44  /* Create hdc, hbmColor and hbmMono */
45  hdcScreen = GetDC(NULL);
46  hdc = CreateCompatibleDC(hdcScreen);
47  hbmColor = CreateCompatibleBitmap(hdcScreen, cxIcon, cyIcon);
48  ReleaseDC(NULL, hdcScreen);
49  hbmMono = CreateBitmap(cxIcon, cyIcon, 1, 1, NULL);
50 
51  /* Checking NULL */
52  if (!hdc || !hbmColor || !hbmMono)
53  {
54  if (hbmMono)
55  DeleteObject(hbmMono);
56  if (hbmColor)
57  DeleteObject(hbmColor);
58  if (hdc)
59  DeleteDC(hdc);
60  return NULL;
61  }
62 
63  /* Create a font */
64  hFont = NULL;
65  if (SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
66  {
67  /* Override the current size with something manageable */
68  lf.lfHeight = -11;
69  lf.lfWidth = 0;
71  }
72  if (!hFont)
74 
75  SetRect(&rect, 0, 0, cxIcon, cyIcon);
76 
77  /* Draw hbmColor */
78  hBmpOld = SelectObject(hdc, hbmColor);
80  FillRect(hdc, &rect, (HBRUSH)GetStockObject(DC_BRUSH));
81  hFontOld = SelectObject(hdc, hFont);
85  SelectObject(hdc, hFontOld);
86 
87  /* Fill hbmMono with black */
88  SelectObject(hdc, hbmMono);
89  PatBlt(hdc, 0, 0, cxIcon, cyIcon, BLACKNESS);
90  SelectObject(hdc, hBmpOld);
91 
92  /* Create an icon from hbmColor and hbmMono */
95  IconInfo.hbmColor = hbmColor;
96  IconInfo.hbmMask = hbmMono;
98 
99  /* Clean up */
101  DeleteObject(hbmMono);
102  DeleteObject(hbmColor);
103  DeleteDC(hdc);
104 
105  return hIcon;
106 }
107 
109 {
110  WCHAR szText[256];
111  INPUT_LIST_NODE *pNode;
112  INT iIndex, nCount, iDefault = (INT)SendMessageW(hwndCombo, CB_GETCURSEL, 0, 0);
113 
114  SendMessageW(hwndCombo, CB_RESETCONTENT, 0, 0);
115 
116  for (pNode = InputList_GetFirst(); pNode != NULL; pNode = pNode->pNext)
117  {
119  continue;
120 
121  StringCchPrintfW(szText, _countof(szText), L"%s - %s",
122  pNode->pLocale->pszName, pNode->pLayout->pszName);
123  iIndex = (INT)SendMessageW(hwndCombo, CB_ADDSTRING, 0, (LPARAM)szText);
124  SendMessageW(hwndCombo, CB_SETITEMDATA, iIndex, (LPARAM)pNode);
125 
126  if (pNode->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
127  iDefault = iIndex;
128  }
129 
130  nCount = (INT)SendMessageW(hwndCombo, CB_GETCOUNT, 0, 0);
131  if (iDefault >= nCount)
132  SendMessageW(hwndCombo, CB_SETCURSEL, nCount - 1, 0);
133  else
134  SendMessageW(hwndCombo, CB_SETCURSEL, iDefault, 0);
135 }
136 
137 static VOID
139 {
140  HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
141  HWND hwndCombo = GetDlgItem(hwndDlg, IDC_DEFAULT_LANGUAGE);
142  BOOL bIsLeaf, bCanRemove, bCanProp;
143  HTREEITEM hSelected = TreeView_GetSelection(hwndList);
145  item.hItem = hSelected;
146 
147  bIsLeaf = (hSelected && TreeView_GetItem(hwndList, &item) && HIWORD(item.lParam));
148 
149  bCanRemove = (bIsLeaf && (s_nAliveLeafCount > 1)) || (s_nRootCount > 1);
150  bCanProp = bIsLeaf;
151 
152  EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE_BUTTON), bCanRemove);
153  EnableWindow(GetDlgItem(hwndDlg, IDC_PROP_BUTTON), bCanProp);
154 
155  InitDefaultLangComboBox(hwndCombo);
156 }
157 
158 static BOOL CALLBACK
160 {
161  HICON* phIconSm = (HICON*)lParam;
162  if (*phIconSm)
163  return FALSE;
164 
165  *phIconSm = (HICON)LoadImageW(hModule, lpszName, IMAGE_ICON,
168  0);
169  return TRUE;
170 }
171 
172 static HICON LoadIMEIcon(LPCTSTR pszImeFile)
173 {
174  WCHAR szSysDir[MAX_PATH], szPath[MAX_PATH];
175  HINSTANCE hImeInst;
176  HICON hIconSm = NULL;
177 
178  GetSystemDirectoryW(szSysDir, _countof(szSysDir));
179  StringCchPrintfW(szPath, _countof(szPath), L"%s\\%s", szSysDir, pszImeFile);
180 
182  if (hImeInst == NULL)
183  return NULL;
184 
186  FreeLibrary(hImeInst);
187 
188  return hIconSm;
189 }
190 
191 static HTREEITEM FindLanguageInList(HWND hwndList, LPCTSTR pszLangName)
192 {
193  TV_ITEM item;
194  TCHAR szText[128];
196 
197  hItem = TreeView_GetRoot(hwndList);
198  while (hItem)
199  {
200  szText[0] = 0;
201  item.mask = TVIF_TEXT | TVIF_HANDLE;
202  item.pszText = szText;
203  item.cchTextMax = _countof(szText);
204  item.hItem = hItem;
205  TreeView_GetItem(hwndList, &item);
206  if (_wcsicmp(szText, pszLangName) == 0)
207  return hItem;
208 
209  hItem = TreeView_GetNextSibling(hwndList, hItem);
210  }
211 
212  return NULL;
213 }
214 
215 static VOID
217 {
218  TV_ITEM item;
220  HIMAGELIST hImageList = TreeView_GetImageList(hwndList, TVSIL_NORMAL);
221  WCHAR szKeyboard[64];
223  BOOL bBold = !!(pInputNode->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT);
224 
225  hItem = FindLanguageInList(hwndList, pInputNode->pLocale->pszName);
226  if (hItem == NULL)
227  {
228  // Language icon
229  INT LangImageIndex = -1;
230  HICON hLangIcon = CreateLayoutIcon(LOWORD(pInputNode->pLocale->dwId));
231  if (hLangIcon)
232  {
233  LangImageIndex = ImageList_AddIcon(hImageList, hLangIcon);
234  DestroyIcon(hLangIcon);
235  }
236 
237  // Language
238  ZeroMemory(&item, sizeof(item));
240  item.pszText = pInputNode->pLocale->pszName;
241  item.iImage = LangImageIndex;
242  item.iSelectedImage = LangImageIndex;
243  item.lParam = LOWORD(pInputNode->pLocale->dwId); // HIWORD(item.lParam) == 0
244  if (bBold)
245  {
246  item.state = item.stateMask = TVIS_BOLD;
247  }
248  insert.hParent = TVI_ROOT;
249  insert.hInsertAfter = TVI_LAST;
250  insert.item = item;
251  hItem = TreeView_InsertItem(hwndList, &insert);
252 
253  // The type of input method (currently keyboard only)
254  LoadStringW(hApplet, IDS_KEYBOARD, szKeyboard, _countof(szKeyboard));
255  ZeroMemory(&item, sizeof(item));
257  item.pszText = szKeyboard;
258  item.iImage = s_iKeyboardImage;
259  item.iSelectedImage = s_iKeyboardImage;
260  item.lParam = 0; // HIWORD(item.lParam) == 0
261  insert.hParent = hItem;
262  insert.hInsertAfter = TVI_LAST;
263  insert.item = item;
264  hItem = TreeView_InsertItem(hwndList, &insert);
265  }
266  else
267  {
268  // Language
269  ZeroMemory(&item, sizeof(item));
270  item.mask = TVIF_STATE | TVIF_HANDLE;
271  item.hItem = hItem;
272  item.stateMask = TVIS_BOLD;
273  if (TreeView_GetItem(hwndList, &item) && bBold && !(item.state & TVIS_BOLD))
274  {
275  // Make the item bold
276  item.mask = TVIF_STATE | TVIF_HANDLE;
277  item.hItem = hItem;
278  item.state = item.stateMask = TVIS_BOLD;
279  TreeView_SetItem(hwndList, &item);
280  }
281 
282  // The type of input method (currently keyboard only)
283  hItem = TreeView_GetChild(hwndList, hItem);
284  }
285 
286  // Input method
287  if (hItem)
288  {
289  INT ImeImageIndex = s_iDotImage;
290  if (IS_IME_HKL(pInputNode->hkl) && pInputNode->pLayout->pszImeFile) // IME?
291  {
292  HICON hImeIcon = LoadIMEIcon(pInputNode->pLayout->pszImeFile);
293  if (hImeIcon)
294  {
295  ImeImageIndex = ImageList_AddIcon(hImageList, hImeIcon);
296  DestroyIcon(hImeIcon);
297  }
298  }
299 
300  ZeroMemory(&item, sizeof(item));
302  item.pszText = pInputNode->pLayout->pszName;
303  item.iImage = ImeImageIndex;
304  item.iSelectedImage = ImeImageIndex;
305  item.lParam = (LPARAM)pInputNode; // HIWORD(item.lParam) != 0
306  if (bBold)
307  {
308  item.state = item.stateMask = TVIS_BOLD; // Make the item bold
309  }
310  insert.hParent = hItem;
311  insert.hInsertAfter = TVI_LAST;
312  insert.item = item;
313  hItem = TreeView_InsertItem(hwndList, &insert);
314  }
315 }
316 
318 {
319  TreeView_Expand(hwndTree, hItem, TVE_EXPAND);
320  hItem = TreeView_GetChild(hwndTree, hItem);
321  while (hItem)
322  {
323  ExpandTreeItem(hwndTree, hItem);
324  hItem = TreeView_GetNextSibling(hwndTree, hItem);
325  }
326 }
327 
328 static VOID
330 {
331  INPUT_LIST_NODE *pNode;
332  HIMAGELIST hImageList = TreeView_GetImageList(hwndList, TVSIL_NORMAL);
334  HICON hKeyboardIcon, hDotIcon;
335 
336  ImageList_RemoveAll(hImageList);
337  TreeView_DeleteAllItems(hwndList);
338 
339  // Add keyboard icon
340  s_iKeyboardImage = -1;
343  0);
344  if (hKeyboardIcon)
345  {
346  s_iKeyboardImage = ImageList_AddIcon(hImageList, hKeyboardIcon);
347  DestroyIcon(hKeyboardIcon);
348  }
349 
350  // Add dot icon
351  s_iDotImage = -1;
354  0);
355  if (hDotIcon)
356  {
357  s_iDotImage = ImageList_AddIcon(hImageList, hDotIcon);
358  DestroyIcon(hDotIcon);
359  }
360 
361  InputList_Sort();
362 
364 
365  // Add items to the list
366  for (pNode = InputList_GetFirst(); pNode; pNode = pNode->pNext)
367  {
369  continue;
370 
371  AddToInputListView(hwndList, pNode);
372  }
373 
374  // Expand all (with counting s_nRootCount)
375  s_nRootCount = 0;
376  hItem = TreeView_GetRoot(hwndList);
377  while (hItem)
378  {
379  ++s_nRootCount;
380  ExpandTreeItem(hwndList, hItem);
381  hItem = TreeView_GetNextSibling(hwndList, hItem);
382  }
383 
384  // Redraw
385  InvalidateRect(hwndList, NULL, TRUE);
386 }
387 
388 static VOID
390 {
391  HWND hwndInputList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
392  HIMAGELIST hLayoutImageList, hOldImageList;
393 
397 
399 
400  hLayoutImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
402  ILC_COLOR8 | ILC_MASK, 0, 0);
403  if (hLayoutImageList != NULL)
404  {
405  hOldImageList = TreeView_SetImageList(hwndInputList, hLayoutImageList, TVSIL_NORMAL);
406  ImageList_Destroy(hOldImageList);
407  }
408 
409  UpdateInputListView(hwndInputList);
410 
411  SetControlsState(hwndDlg);
412 }
413 
414 
415 static VOID
417 {
421 }
422 
423 
424 VOID
426 {
427  switch (LOWORD(wParam))
428  {
429  case IDC_ADD_BUTTON:
430  {
431  if (DialogBoxW(hApplet,
433  hwndDlg,
434  AddDialogProc) == IDOK)
435  {
437  SetControlsState(hwndDlg);
438  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
439  }
440  }
441  break;
442 
443  case IDC_REMOVE_BUTTON:
444  {
445  HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
446  if (hwndList)
447  {
450  item.hItem = hItem;
451 
452  if (hItem && TreeView_GetItem(hwndList, &item))
453  {
454  if (item.lParam == 0) // Branch? (currently branch is keyboard only)
455  {
456  // Get root of branch
457  item.hItem = TreeView_GetParent(hwndList, hItem);
458  TreeView_GetItem(hwndList, &item);
459  }
460 
461  if (HIWORD(item.lParam)) // Leaf?
462  {
463  if (InputList_Remove((INPUT_LIST_NODE*)item.lParam))
465  }
466  else // Root?
467  {
468  if (InputList_RemoveByLang(LOWORD(item.lParam)))
470  }
471 
472  UpdateInputListView(hwndList);
473  SetControlsState(hwndDlg);
474  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
475  }
476  }
477  }
478  break;
479 
480  case IDC_PROP_BUTTON:
481  {
482  HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
483  if (hwndList)
484  {
487  item.hItem = hItem;
488 
489  if (hItem && TreeView_GetItem(hwndList, &item) && HIWORD(item.lParam))
490  {
493  hwndDlg,
495  item.lParam) == IDOK)
496  {
497  UpdateInputListView(hwndList);
498  SetControlsState(hwndDlg);
499  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
500  }
501  }
502  }
503  }
504  break;
505 
506  case IDC_KEY_SET_BTN:
507  {
510  hwndDlg,
512  }
513  break;
514 
515  case IDC_LANGUAGE_BAR:
516  {
517  // FIXME
518  break;
519  }
520 
522  {
523  if (HIWORD(wParam) == CBN_SELENDOK)
524  {
525  HWND hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
526  HWND hwndCombo = GetDlgItem(hwndDlg, IDC_DEFAULT_LANGUAGE);
527  INT iSelected = (INT)SendMessageW(hwndCombo, CB_GETCURSEL, 0, 0);
528  if (iSelected != CB_ERR)
529  {
530  LPARAM lParam = SendMessageW(hwndCombo, CB_GETITEMDATA, iSelected, 0);
531  if (lParam)
532  {
534  if (!(pNode->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT))
535  {
537  InputList_SetDefault(pNode);
538  UpdateInputListView(hwndList);
539  SetControlsState(hwndDlg);
540  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
541  }
542  }
543  }
544  }
545  }
546  }
547 }
548 
550 {
551  INPUT_LIST_NODE *pNode;
552 
554  return TRUE;
555 
556  for (pNode = InputList_GetFirst(); pNode != NULL; pNode = pNode->pNext)
557  {
558  if (IS_IME_HKL(pNode->hkl)) /* IME? */
559  {
560  return TRUE;
561  }
562  }
563 
564  return FALSE;
565 }
566 
568 {
569  HANDLE hToken;
570  LUID luid;
571  TOKEN_PRIVILEGES tokenPrivileges;
572  BOOL Ret;
573 
576  &hToken);
577  if (!Ret)
578  return Ret; // failure
579 
580  Ret = LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid);
581  if (Ret)
582  {
583  tokenPrivileges.PrivilegeCount = 1;
584  tokenPrivileges.Privileges[0].Luid = luid;
585  tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
586 
587  Ret = AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0);
588  }
589 
590  CloseHandle(hToken);
591  return Ret;
592 }
593 
594 static INT_PTR
596 {
598 
599  switch (header->code)
600  {
601  case TVN_SELCHANGED:
602  {
603  SetControlsState(hwndDlg);
604  break;
605  }
606 
607  case TVN_ITEMEXPANDING:
608  {
609  // FIXME: Prevent collapse (COMCTL32 is buggy)
610  // https://bugs.winehq.org/show_bug.cgi?id=53727
611  NM_TREEVIEW* pTreeView = (NM_TREEVIEW*)lParam;
612  if ((pTreeView->action & TVE_TOGGLE) == TVE_COLLAPSE)
613  {
615  return TRUE;
616  }
617  break;
618  }
619 
620  case PSN_APPLY:
621  {
622  BOOL bRebootNeeded = IsRebootNeeded();
623 
624  /* Write Input Methods list to registry */
625  if (InputList_Process() && bRebootNeeded)
626  {
627  /* Needs reboot */
628  WCHAR szNeedsReboot[128], szLanguage[64];
629  LoadStringW(hApplet, IDS_REBOOT_NOW, szNeedsReboot, _countof(szNeedsReboot));
630  LoadStringW(hApplet, IDS_LANGUAGE, szLanguage, _countof(szLanguage));
631 
632  if (MessageBoxW(hwndDlg, szNeedsReboot, szLanguage,
634  {
637  }
638  }
639  break;
640  }
641  }
642 
643  return 0;
644 }
645 
648 {
649  switch (uMsg)
650  {
651  case WM_INITDIALOG:
652  OnInitSettingsPage(hwndDlg);
653  break;
654 
655  case WM_DESTROY:
656  OnDestroySettingsPage(hwndDlg);
657  break;
658 
659  case WM_COMMAND:
660  OnCommandSettingsPage(hwndDlg, wParam);
661  break;
662 
663  case WM_NOTIFY:
664  return OnNotifySettingsPage(hwndDlg, lParam);
665  }
666 
667  return FALSE;
668 }
VOID OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
HGDIOBJ WINAPI GetStockObject(_In_ int)
INT_PTR CALLBACK AddDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: add_dialog.c:177
#define EWX_FORCE
Definition: winuser.h:630
#define CB_SETITEMDATA
Definition: winuser.h:1956
#define IDC_LANGUAGE_BAR
Definition: resource.h:42
#define RT_GROUP_ICON
Definition: pedump.c:375
static HICON
Definition: imagelist.c:84
INT_PTR CALLBACK EditDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit_dialog.c:14
#define TVE_TOGGLE
Definition: commctrl.h:3424
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:598
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDYES
Definition: winuser.h:829
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3417
static VOID SetControlsState(HWND hwndDlg)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
static INT_PTR OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
DWORD yHotspot
Definition: winuser.h:3115
#define CB_GETITEMDATA
Definition: winuser.h:1940
VOID InputList_Destroy(VOID)
Definition: input_list.c:197
#define IDC_ADD_BUTTON
Definition: resource.h:23
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
LONG lfHeight
Definition: dimm.idl:59
INT_PTR CALLBACK KeySettingsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID LayoutList_Create(VOID)
Definition: layout_list.c:215
#define INT
Definition: polytest.cpp:20
LOCALE_LIST_NODE * pLocale
Definition: input_list.h:36
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
#define IDD_ADD
Definition: resource.h:17
$ULONG PrivilegeCount
Definition: setypes.h:1019
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define IDS_KEYBOARD
Definition: resource.h:47
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static VOID UpdateInputListView(HWND hwndList)
#define SM_CYSMICON
Definition: winuser.h:1007
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDD_KEYSETTINGS
Definition: resource.h:18
WORD LANGID
Definition: typedefs.h:81
static int insert
Definition: xmllint.c:144
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
#define PSN_APPLY
Definition: prsht.h:117
static HICON CreateLayoutIcon(LANGID LangID)
Definition: settings_page.c:21
int32_t INT_PTR
Definition: typedefs.h:64
#define EWX_REBOOT
Definition: winuser.h:633
static HICON LoadIMEIcon(LPCTSTR pszImeFile)
INPUT_LIST_NODE * InputList_GetFirst(VOID)
Definition: input_list.c:777
LAYOUT_LIST_NODE * pLayout
Definition: input_list.h:37
#define IDD_INPUT_LANG_PROP
Definition: resource.h:15
VOID LocaleList_Destroy(VOID)
Definition: locale_list.c:60
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
static HTREEITEM FindLanguageInList(HWND hwndList, LPCTSTR pszLangName)
#define CB_GETCURSEL
Definition: winuser.h:1933
DWORD WINAPI GetSysColor(_In_ int)
#define TreeView_GetImageList(hwnd, iImage)
Definition: commctrl.h:3441
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
HFONT hFont
Definition: main.c:53
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
#define ImageList_RemoveAll(himl)
Definition: commctrl.h:556
#define IDC_KEY_SET_BTN
Definition: resource.h:26
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define IDC_DEFAULT_LANGUAGE
Definition: resource.h:22
static INT s_iDotImage
Definition: settings_page.c:17
static BOOL IsRebootNeeded(VOID)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define IDC_PROP_BUTTON
Definition: resource.h:25
#define NM_TREEVIEW
Definition: commctrl.h:3624
#define IDI_KEYBOARD
Definition: resource.h:9
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
#define L(x)
Definition: ntvdm.h:50
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:905
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CBN_SELENDOK
Definition: winuser.h:1971
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
VOID InputList_Create(VOID)
Definition: input_list.c:636
HBITMAP hbmMask
Definition: winuser.h:3116
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define TRANSPARENT
Definition: wingdi.h:950
#define CB_ADDSTRING
Definition: winuser.h:1926
HTREEITEM hItem
Definition: treelist.h:37
BOOL InputList_Remove(INPUT_LIST_NODE *pNode)
Definition: input_list.c:573
LONG lfWidth
Definition: dimm.idl:60
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define TVE_COLLAPSE
Definition: commctrl.h:3422
#define MB_YESNOCANCEL
Definition: winuser.h:812
LONG_PTR LPARAM
Definition: windef.h:208
HBITMAP hbmColor
Definition: winuser.h:3117
INT_PTR CALLBACK SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define TVI_LAST
Definition: commctrl.h:3370
VOID InputList_Sort(VOID)
Definition: input_list.c:701
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
#define CB_RESETCONTENT
Definition: winuser.h:1949
#define CB_ERR
Definition: winuser.h:2425
static INT s_nRootCount
Definition: settings_page.c:15
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4389
#define WM_DESTROY
Definition: winuser.h:1599
char TCHAR
Definition: xmlstorage.h:189
#define IDC_REMOVE_BUTTON
Definition: resource.h:24
BOOL fIcon
Definition: winuser.h:3113
#define FreeLibrary(x)
Definition: compat.h:607
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define IDI_DOT
Definition: resource.h:10
#define TOKEN_QUERY
Definition: setypes.h:924
#define IDS_LANGUAGE
Definition: resource.h:52
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INPUT_LIST_NODE_FLAG_DEFAULT
Definition: input_list.h:30
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
DWORD xHotspot
Definition: winuser.h:3114
#define _countof(array)
Definition: sndvol32.h:68
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define TVN_SELCHANGED
Definition: commctrl.h:3735
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2550
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL InputList_RemoveByLang(LANGID wLangId)
Definition: input_list.c:613
int WINAPI GetSystemMetrics(_In_ int)
VOID LayoutList_Destroy(VOID)
Definition: layout_list.c:67
VOID InputList_SetDefault(INPUT_LIST_NODE *pNode)
Definition: input_list.c:524
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TVI_ROOT
Definition: commctrl.h:3368
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
INT InputList_GetAliveCount(VOID)
Definition: input_list.c:760
#define SM_CXSMICON
Definition: winuser.h:1006
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
static BOOL s_bDefaultInputChanged
Definition: settings_page.c:18
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:338
#define MB_ICONINFORMATION
Definition: winuser.h:796
HDC hdc
Definition: main.c:9
#define INPUT_LIST_NODE_FLAG_DELETED
Definition: input_list.h:24
#define ILC_MASK
Definition: commctrl.h:351
static VOID ExpandTreeItem(HWND hwndTree, HTREEITEM hItem)
#define GetCurrentProcess()
Definition: compat.h:618
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
static VOID OnDestroySettingsPage(HWND hwndDlg)
#define CB_SETCURSEL
Definition: winuser.h:1951
#define WM_COMMAND
Definition: winuser.h:1730
static VOID AddToInputListView(HWND hwndList, INPUT_LIST_NODE *pInputNode)
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
static INT s_iKeyboardImage
Definition: settings_page.c:16
#define TVIF_HANDLE
Definition: commctrl.h:3270
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
#define TV_ITEM
Definition: commctrl.h:3300
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define IS_IME_HKL(hKL)
Definition: input.h:88
_In_ BOOL bEnable
Definition: winddi.h:3426
static ATOM item
Definition: dde.c:856
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3475
#define BLACKNESS
Definition: wingdi.h:323
BOOL WINAPI DeleteDC(_In_ HDC)
#define TVIF_TEXT
Definition: commctrl.h:3266
HICON hIcon
Definition: msconfig.c:44
LPCWSTR szPath
Definition: env.c:37
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
static BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
#define TVIF_IMAGE
Definition: commctrl.h:3267
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
static INT s_nAliveLeafCount
Definition: settings_page.c:14
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1370
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1020
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define IDS_REBOOT_NOW
Definition: resource.h:62
#define TVSIL_NORMAL
Definition: commctrl.h:3443
struct _INPUT_LIST_NODE * pNext
Definition: input_list.h:44
HICON hIconSm
Definition: msconfig.c:44
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
#define HIWORD(l)
Definition: typedefs.h:247
BOOL InputList_Process(VOID)
Definition: input_list.c:382
#define ILC_COLOR8
Definition: commctrl.h:355
#define TVIF_STATE
Definition: commctrl.h:3269
#define DT_CENTER
Definition: winuser.h:527
static VOID OnInitSettingsPage(HWND hwndDlg)
#define TVIS_BOLD
Definition: commctrl.h:3283
#define CB_GETCOUNT
Definition: winuser.h:1932
#define SetWindowLongPtrW
Definition: winuser.h:5336
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define TVIF_PARAM
Definition: commctrl.h:3268
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_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:1075
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define TV_INSERTSTRUCT
Definition: commctrl.h:3377
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:926
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2389
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
LOCALE_LIST_NODE * LocaleList_Create(VOID)
Definition: locale_list.c:84
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define WM_NOTIFY
Definition: richedit.h:61
static VOID InitDefaultLangComboBox(HWND hwndCombo)
HMODULE hModule
Definition: animate.c:44
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define IDC_KEYLAYOUT_LIST
Definition: resource.h:21