ReactOS  0.4.14-dev-50-g13bb5e2
settings_page.c File Reference
#include "input.h"
#include "layout_list.h"
#include "locale_list.h"
#include "input_list.h"
Include dependency graph for settings_page.c:

Go to the source code of this file.

Functions

static HICON CreateLayoutIcon (LPWSTR szLayout, BOOL bIsDefault)
 
static VOID SetControlsState (HWND hwndDlg, BOOL bIsEnabled)
 
static VOID AddToInputListView (HWND hwndList, INPUT_LIST_NODE *pInputNode)
 
static VOID UpdateInputListView (HWND hwndList)
 
static VOID OnInitSettingsPage (HWND hwndDlg)
 
static VOID OnDestroySettingsPage (HWND hwndDlg)
 
VOID OnCommandSettingsPage (HWND hwndDlg, WPARAM wParam)
 
BOOL EnableProcessPrivileges (LPCWSTR lpPrivilegeName, BOOL bEnable)
 
static VOID OnNotifySettingsPage (HWND hwndDlg, LPARAM lParam)
 
INT_PTR CALLBACK SettingsPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ AddToInputListView()

static VOID AddToInputListView ( HWND  hwndList,
INPUT_LIST_NODE pInputNode 
)
static

Definition at line 124 of file settings_page.c.

125 {
126  INT ItemIndex = -1;
127  INT ImageIndex = -1;
128  LV_ITEM item;
129  HIMAGELIST hImageList;
130 
131  hImageList = ListView_GetImageList(hwndList, LVSIL_SMALL);
132 
133  if (hImageList != NULL)
134  {
135  HICON hLayoutIcon;
136 
137  hLayoutIcon = CreateLayoutIcon(pInputNode->pszIndicator,
138  (pInputNode->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT));
139 
140  if (hLayoutIcon != NULL)
141  {
142  ImageIndex = ImageList_AddIcon(hImageList, hLayoutIcon);
143  DestroyIcon(hLayoutIcon);
144  }
145  }
146 
147  ZeroMemory(&item, sizeof(item));
148 
149  item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
150  item.pszText = pInputNode->pLocale->pszName;
151  item.iItem = ListView_GetItemCount(hwndList) + 1;
152  item.lParam = (LPARAM)pInputNode;
153  item.iImage = ImageIndex;
154 
155  ItemIndex = ListView_InsertItem(hwndList, &item);
156 
157  ListView_SetItemText(hwndList, ItemIndex, 1, pInputNode->pLayout->pszName);
158 }
#define LV_ITEM
Definition: commctrl.h:2309
static HICON
Definition: imagelist.c:84
#define LVSIL_SMALL
Definition: commctrl.h:2271
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
LOCALE_LIST_NODE * pLocale
Definition: input_list.h:18
#define ZeroMemory
Definition: winbase.h:1635
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2380
LAYOUT_LIST_NODE * pLayout
Definition: input_list.h:19
int32_t INT
Definition: typedefs.h:56
#define LVIF_TEXT
Definition: commctrl.h:2281
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2268
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2663
#define INPUT_LIST_NODE_FLAG_DEFAULT
Definition: input_list.h:11
#define LVIF_IMAGE
Definition: commctrl.h:2282
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
static ATOM item
Definition: dde.c:856
#define LVIF_PARAM
Definition: commctrl.h:2283
static HICON CreateLayoutIcon(LPWSTR szLayout, BOOL bIsDefault)
Definition: settings_page.c:16
WCHAR * pszIndicator
Definition: input_list.h:23

Referenced by UpdateInputListView().

◆ CreateLayoutIcon()

static HICON CreateLayoutIcon ( LPWSTR  szLayout,
BOOL  bIsDefault 
)
static

Definition at line 16 of file settings_page.c.

17 {
20  HDC hdc;
21  HDC hdcsrc;
23  HICON hIcon = NULL;
24 
25  hdcsrc = GetDC(NULL);
26  hdc = CreateCompatibleDC(hdcsrc);
28 
29  ReleaseDC(NULL, hdcsrc);
30 
31  if (hdc && hBitmap)
32  {
33  HBITMAP hBmpNew;
34 
35  hBmpNew = CreateBitmap(width, height, 1, 1, NULL);
36  if (hBmpNew)
37  {
38  LOGFONTW lf;
39 
40  if (SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
41  {
43  HFONT hFont;
44 
46 
47  if (hFont != NULL)
48  {
49  HBITMAP hBmpOld;
50 
51  hBmpOld = SelectObject(hdc, hBitmap);
52 
53  if (hBmpOld != NULL)
54  {
55  RECT rect;
56 
57  SetRect(&rect, 0, 0, width / 2, height);
58 
59  if (bIsDefault != FALSE)
60  {
63 
64  ExtTextOutW(hdc, rect.left, rect.top, ETO_OPAQUE, &rect, L"", 0, NULL);
65 
67  DrawTextW(hdc, L"\x2022", 1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
68  }
69  else
70  {
72  }
73 
74  SetRect(&rect, width / 2, 0, width, height);
75 
78 
79  ExtTextOutW(hdc, rect.left, rect.top, ETO_OPAQUE, &rect, L"", 0, NULL);
80 
82  DrawTextW(hdc, szLayout, 2, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
83 
84  SelectObject(hdc, hBmpNew);
85 
86  PatBlt(hdc, 0, 0, width, height, BLACKNESS);
87 
88  SelectObject(hdc, hBmpOld);
89 
91  IconInfo.hbmMask = hBmpNew;
93 
95 
96  DeleteObject(hBmpOld);
97  }
98 
100  }
101  }
102 
103  DeleteObject(hBmpNew);
104  }
105  }
106 
107  DeleteDC(hdc);
109 
110  return hIcon;
111 }
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)
GLint GLint GLsizei width
Definition: gl.h:1546
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define SM_CYSMICON
Definition: winuser.h:1003
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
& rect
Definition: startmenu.cpp:1413
HFONT hFont
Definition: main.c:53
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define ETO_OPAQUE
Definition: wingdi.h:646
HBITMAP hbmMask
Definition: winuser.h:3100
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
HBITMAP hbmColor
Definition: winuser.h:3101
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
BOOL fIcon
Definition: winuser.h:3097
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2546
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define DT_SINGLELINE
Definition: winuser.h:540
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define BLACKNESS
Definition: wingdi.h:322
BOOL WINAPI DeleteDC(_In_ HDC)
HICON hIcon
Definition: msconfig.c:44
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DT_CENTER
Definition: winuser.h:527
static HBITMAP
Definition: button.c:44
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2267
static HBITMAP hBitmap
Definition: timezone.c:35
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)

Referenced by AddToInputListView().

◆ EnableProcessPrivileges()

BOOL EnableProcessPrivileges ( LPCWSTR  lpPrivilegeName,
BOOL  bEnable 
)

Definition at line 353 of file settings_page.c.

354 {
355  HANDLE hToken;
356  LUID luid;
357  TOKEN_PRIVILEGES tokenPrivileges;
358  BOOL Ret;
359 
362  &hToken);
363  if (!Ret)
364  return Ret; // failure
365 
366  Ret = LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid);
367  if (Ret)
368  {
369  tokenPrivileges.PrivilegeCount = 1;
370  tokenPrivileges.Privileges[0].Luid = luid;
371  tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
372 
373  Ret = AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0);
374  }
375 
376  CloseHandle(hToken);
377  return Ret;
378 }
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
$ULONG PrivilegeCount
Definition: setypes.h:969
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
_In_ BOOL bEnable
Definition: winddi.h:3426
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:970
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

Referenced by OnNotifySettingsPage().

◆ OnCommandSettingsPage()

VOID OnCommandSettingsPage ( HWND  hwndDlg,
WPARAM  wParam 
)

Definition at line 250 of file settings_page.c.

251 {
252  switch (LOWORD(wParam))
253  {
254  case IDC_ADD_BUTTON:
255  {
256  if (DialogBoxW(hApplet,
258  hwndDlg,
259  AddDialogProc) == IDOK)
260  {
262  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
263  }
264  }
265  break;
266 
267  case IDC_REMOVE_BUTTON:
268  {
269  HWND hwndList;
270 
271  hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
272 
273  if (hwndList != NULL)
274  {
275  LVITEM item = { 0 };
276 
277  item.mask = LVIF_PARAM;
278  item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
279 
280  if (ListView_GetItem(hwndList, &item) != FALSE)
281  {
283  UpdateInputListView(hwndList);
284  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
285  }
286  }
287  }
288  break;
289 
290  case IDC_PROP_BUTTON:
291  {
292  HWND hwndList;
293 
294  hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
295 
296  if (hwndList != NULL)
297  {
298  LVITEM item = { 0 };
299 
300  item.mask = LVIF_PARAM;
301  item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
302 
303  if (ListView_GetItem(hwndList, &item) != FALSE)
304  {
307  hwndDlg,
309  item.lParam) == IDOK)
310  {
311  UpdateInputListView(hwndList);
312  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
313  }
314  }
315  }
316  }
317  break;
318 
319  case IDC_SET_DEFAULT:
320  {
321  HWND hwndList;
322 
323  hwndList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
324 
325  if (hwndList != NULL)
326  {
327  LVITEM item = { 0 };
328 
329  item.mask = LVIF_PARAM;
330  item.iItem = ListView_GetNextItem(hwndList, -1, LVNI_SELECTED);
331 
332  if (ListView_GetItem(hwndList, &item) != FALSE)
333  {
335  UpdateInputListView(hwndList);
336  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
337  }
338  }
339  }
340  break;
341 
342  case IDC_KEY_SET_BTN:
343  {
346  hwndDlg,
348  }
349  break;
350  }
351 }
INT_PTR CALLBACK AddDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: add_dialog.c:177
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2406
INT_PTR CALLBACK EditDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: edit_dialog.c:14
#define IDOK
Definition: winuser.h:824
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDC_ADD_BUTTON
Definition: resource.h:22
INT_PTR CALLBACK KeySettingsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define IDD_ADD
Definition: resource.h:16
#define IDC_SET_DEFAULT
Definition: resource.h:21
static VOID UpdateInputListView(HWND hwndList)
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2396
#define IDD_KEYSETTINGS
Definition: resource.h:17
#define IDD_INPUT_LANG_PROP
Definition: resource.h:14
WPARAM wParam
Definition: combotst.c:138
#define IDC_KEY_SET_BTN
Definition: resource.h:25
#define IDC_PROP_BUTTON
Definition: resource.h:24
smooth NULL
Definition: ftsmooth.c:416
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4300
#define IDC_REMOVE_BUTTON
Definition: resource.h:23
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
VOID InputList_SetDefault(INPUT_LIST_NODE *pNode)
Definition: input_list.c:452
HWND WINAPI GetParent(_In_ HWND)
VOID InputList_Remove(INPUT_LIST_NODE *pNode)
Definition: input_list.c:478
static ATOM item
Definition: dde.c:856
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define LVIF_PARAM
Definition: commctrl.h:2283
#define LVITEM
Definition: commctrl.h:2347
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_KEYLAYOUT_LIST
Definition: resource.h:20

Referenced by SettingsPageProc().

◆ OnDestroySettingsPage()

static VOID OnDestroySettingsPage ( HWND  hwndDlg)
static

Definition at line 241 of file settings_page.c.

242 {
246 }
VOID InputList_Destroy(VOID)
Definition: input_list.c:193
VOID LocaleList_Destroy(VOID)
Definition: locale_list.c:60
VOID LayoutList_Destroy(VOID)
Definition: layout_list.c:61

Referenced by SettingsPageProc().

◆ OnInitSettingsPage()

static VOID OnInitSettingsPage ( HWND  hwndDlg)
static

Definition at line 188 of file settings_page.c.

189 {
190  HWND hwndInputList;
191 
195 
196  hwndInputList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT_LIST);
197 
198  if (hwndInputList != NULL)
199  {
200  WCHAR szBuffer[MAX_STR_LEN];
201  HIMAGELIST hLayoutImageList;
203 
205 
206  ZeroMemory(&column, sizeof(column));
207 
209 
210  LoadStringW(hApplet, IDS_LANGUAGE, szBuffer, ARRAYSIZE(szBuffer));
211  column.fmt = LVCFMT_LEFT;
212  column.iSubItem = 0;
213  column.pszText = szBuffer;
214  column.cx = 175;
215  ListView_InsertColumn(hwndInputList, 0, &column);
216 
217  LoadStringW(hApplet, IDS_LAYOUT, szBuffer, ARRAYSIZE(szBuffer));
218  column.fmt = LVCFMT_RIGHT;
219  column.cx = 155;
220  column.iSubItem = 1;
221  column.pszText = szBuffer;
222  ListView_InsertColumn(hwndInputList, 1, &column);
223 
224  hLayoutImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON) * 2,
226  ILC_COLOR8 | ILC_MASK, 0, 0);
227  if (hLayoutImageList != NULL)
228  {
229  HIMAGELIST hOldImagelist = ListView_SetImageList(hwndInputList, hLayoutImageList, LVSIL_SMALL);
230  ImageList_Destroy(hOldImagelist);
231  }
232 
233  UpdateInputListView(hwndInputList);
234  }
235 
236  SetControlsState(hwndDlg, FALSE);
237 }
#define LVCF_WIDTH
Definition: commctrl.h:2559
#define LVSIL_SMALL
Definition: commctrl.h:2271
#define LVCF_TEXT
Definition: commctrl.h:2560
#define LV_COLUMN
Definition: commctrl.h:2519
VOID LayoutList_Create(VOID)
Definition: layout_list.c:85
#define LVCFMT_RIGHT
Definition: commctrl.h:2571
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2706
#define LVCFMT_LEFT
Definition: commctrl.h:2570
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1635
static VOID UpdateInputListView(HWND hwndList)
#define SM_CYSMICON
Definition: winuser.h:1003
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define LVCF_SUBITEM
Definition: commctrl.h:2561
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2608
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
VOID InputList_Create(VOID)
Definition: input_list.c:518
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2276
smooth NULL
Definition: ftsmooth.c:416
#define IDS_LANGUAGE
Definition: resource.h:50
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetSystemMetrics(_In_ int)
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2697
#define SM_CXSMICON
Definition: winuser.h:1002
#define ILC_MASK
Definition: commctrl.h:336
static VOID SetControlsState(HWND hwndDlg, BOOL bIsEnabled)
#define LVCF_FMT
Definition: commctrl.h:2558
#define MAX_STR_LEN
Definition: defines.h:33
#define ILC_COLOR8
Definition: commctrl.h:340
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define IDS_LAYOUT
Definition: resource.h:51
LOCALE_LIST_NODE * LocaleList_Create(VOID)
Definition: locale_list.c:84
#define IDC_KEYLAYOUT_LIST
Definition: resource.h:20

Referenced by SettingsPageProc().

◆ OnNotifySettingsPage()

static VOID OnNotifySettingsPage ( HWND  hwndDlg,
LPARAM  lParam 
)
static

Definition at line 381 of file settings_page.c.

382 {
383  LPNMHDR header;
384 
385  header = (LPNMHDR)lParam;
386 
387  switch (header->code)
388  {
389  case NM_CLICK:
390  {
391  if (header->idFrom == IDC_KEYLAYOUT_LIST)
392  {
393  INT iSelected = ListView_GetNextItem(header->hwndFrom, -1, LVNI_SELECTED);
394 
395  if (iSelected != -1)
396  {
397  LVITEM item = { 0 };
398 
399  SetControlsState(hwndDlg, TRUE);
400 
401  item.mask = LVIF_PARAM;
402  item.iItem = iSelected;
403 
404  if (ListView_GetItem(header->hwndFrom, &item) != FALSE)
405  {
406  INPUT_LIST_NODE *pInput;
407 
408  pInput = (INPUT_LIST_NODE*) item.lParam;
409 
410  if (pInput != NULL && pInput->wFlags & INPUT_LIST_NODE_FLAG_DEFAULT)
411  {
413  }
414  }
415  }
416  else
417  {
418  SetControlsState(hwndDlg, FALSE);
419  }
420  }
421  }
422  break;
423 
424  case PSN_APPLY:
425  {
426  /* Write Input Methods list to registry */
427  if (InputList_Process())
428  {
429  /* Needs reboot */
430  WCHAR szNeedsReboot[128], szLanguage[64];
431  LoadStringW(hApplet, IDS_REBOOT_NOW, szNeedsReboot, _countof(szNeedsReboot));
432  LoadStringW(hApplet, IDS_LANGUAGE, szLanguage, _countof(szLanguage));
433 
434  if (MessageBoxW(hwndDlg, szNeedsReboot, szLanguage,
436  {
439  }
440  }
441  }
442  break;
443  }
444 }
#define EWX_FORCE
Definition: winuser.h:630
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2406
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
#define _countof(array)
Definition: fontsub.cpp:30
#define IDC_SET_DEFAULT
Definition: resource.h:21
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2396
#define PSN_APPLY
Definition: prsht.h:117
#define EWX_REBOOT
Definition: winuser.h:633
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:56
struct tagNMHDR * LPNMHDR
smooth NULL
Definition: ftsmooth.c:416
#define MB_YESNOCANCEL
Definition: winuser.h:812
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define IDS_LANGUAGE
Definition: resource.h:50
if(!(yy_init))
Definition: macro.lex.yy.c:714
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:11
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define NM_CLICK
Definition: commctrl.h:130
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static VOID SetControlsState(HWND hwndDlg, BOOL bIsEnabled)
static ATOM item
Definition: dde.c:856
#define IDS_REBOOT_NOW
Definition: resource.h:60
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define LVIF_PARAM
Definition: commctrl.h:2283
#define LVITEM
Definition: commctrl.h:2347
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:383
BOOL InputList_Process(VOID)
Definition: input_list.c:338
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable)
LPARAM lParam
Definition: combotst.c:139
struct CFHEADER header
Definition: fdi.c:109
#define IDC_KEYLAYOUT_LIST
Definition: resource.h:20

Referenced by SettingsPageProc().

◆ SetControlsState()

static VOID SetControlsState ( HWND  hwndDlg,
BOOL  bIsEnabled 
)
static

Definition at line 115 of file settings_page.c.

116 {
117  EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE_BUTTON), bIsEnabled);
118  EnableWindow(GetDlgItem(hwndDlg, IDC_PROP_BUTTON), bIsEnabled);
119  EnableWindow(GetDlgItem(hwndDlg, IDC_SET_DEFAULT), bIsEnabled);
120 }
#define IDC_SET_DEFAULT
Definition: resource.h:21
#define IDC_PROP_BUTTON
Definition: resource.h:24
#define IDC_REMOVE_BUTTON
Definition: resource.h:23
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by OnInitSettingsPage(), and OnNotifySettingsPage().

◆ SettingsPageProc()

INT_PTR CALLBACK SettingsPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 448 of file settings_page.c.

449 {
450  switch (uMsg)
451  {
452  case WM_INITDIALOG:
453  OnInitSettingsPage(hwndDlg);
454  break;
455 
456  case WM_DESTROY:
457  OnDestroySettingsPage(hwndDlg);
458  break;
459 
460  case WM_COMMAND:
461  OnCommandSettingsPage(hwndDlg, wParam);
462  break;
463 
464  case WM_NOTIFY:
465  OnNotifySettingsPage(hwndDlg, lParam);
466  break;
467  }
468 
469  return FALSE;
470 }
VOID OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)
WPARAM wParam
Definition: combotst.c:138
#define WM_DESTROY
Definition: winuser.h:1591
static VOID OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
static VOID OnDestroySettingsPage(HWND hwndDlg)
#define WM_COMMAND
Definition: winuser.h:1722
static VOID OnInitSettingsPage(HWND hwndDlg)
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by SystemApplet().

◆ UpdateInputListView()

static VOID UpdateInputListView ( HWND  hwndList)
static

Definition at line 162 of file settings_page.c.

163 {
164  INPUT_LIST_NODE *pCurrentInputNode;
165  HIMAGELIST hImageList;
166 
167  hImageList = ListView_GetImageList(hwndList, LVSIL_SMALL);
168  if (hImageList != NULL)
169  {
170  ImageList_RemoveAll(hImageList);
171  }
172 
173  ListView_DeleteAllItems(hwndList);
174 
175  for (pCurrentInputNode = InputList_GetFirst();
176  pCurrentInputNode != NULL;
177  pCurrentInputNode = pCurrentInputNode->pNext)
178  {
179  if (!(pCurrentInputNode->wFlags & INPUT_LIST_NODE_FLAG_DELETED))
180  {
181  AddToInputListView(hwndList, pCurrentInputNode);
182  }
183  }
184 }
#define LVSIL_SMALL
Definition: commctrl.h:2271
INPUT_LIST_NODE * InputList_GetFirst(VOID)
Definition: input_list.c:585
#define ImageList_RemoveAll(himl)
Definition: commctrl.h:541
#define ListView_GetImageList(hwnd, iImageList)
Definition: commctrl.h:2268
smooth NULL
Definition: ftsmooth.c:416
#define INPUT_LIST_NODE_FLAG_DELETED
Definition: input_list.h:10
static VOID AddToInputListView(HWND hwndList, INPUT_LIST_NODE *pInputNode)
struct _INPUT_LIST_NODE * pNext
Definition: input_list.h:26
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2386

Referenced by OnCommandSettingsPage(), and OnInitSettingsPage().