1 /* 2 * PROJECT: input.dll 3 * FILE: dll/cpl/input/edit_dialog.c 4 * PURPOSE: input.dll 5 * PROGRAMMER: Dmitry Chapyshev (dmitry@reactos.org) 6 */ 7 8 #include "input.h" 9 #include "locale_list.h" 10 #include "input_list.h" 11 12 13 INT_PTR CALLBACK 14 EditDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) 15 { 16 UNREFERENCED_PARAMETER(lParam); 17 18 switch (uMsg) 19 { 20 case WM_INITDIALOG: 21 { 22 LAYOUT_LIST_NODE *pCurrentLayout; 23 INPUT_LIST_NODE *pInput; 24 HWND hwndList; 25 26 pInput = (INPUT_LIST_NODE*) lParam; 27 28 if (pInput == NULL) 29 return TRUE; 30 31 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR) pInput); 32 33 SetWindowTextW(GetDlgItem(hwndDlg, IDC_INPUT_LANG_STR), pInput->pLocale->pszName); 34 35 hwndList = GetDlgItem(hwndDlg, IDC_KB_LAYOUT_IME_COMBO); 36 37 for (pCurrentLayout = LayoutList_GetFirst(); 38 pCurrentLayout != NULL; 39 pCurrentLayout = pCurrentLayout->pNext) 40 { 41 INT iItemIndex; 42 43 iItemIndex = ComboBox_AddString(hwndList, pCurrentLayout->pszName); 44 ComboBox_SetItemData(hwndList, iItemIndex, pCurrentLayout); 45 } 46 47 ComboBox_SelectString(hwndList, 0, pInput->pLayout->pszName); 48 return TRUE; 49 } 50 51 case WM_COMMAND: 52 { 53 switch (LOWORD(wParam)) 54 { 55 case IDOK: 56 { 57 INPUT_LIST_NODE *pInput; 58 HWND hwndList; 59 60 hwndList = GetDlgItem(hwndDlg, IDC_KB_LAYOUT_IME_COMBO); 61 62 pInput = (INPUT_LIST_NODE*) GetWindowLongPtrW(hwndDlg, GWLP_USERDATA); 63 64 if (pInput != NULL) 65 { 66 LAYOUT_LIST_NODE *pNewLayout; 67 68 pNewLayout = (LAYOUT_LIST_NODE*)ComboBox_GetItemData(hwndList, 69 ComboBox_GetCurSel(hwndList)); 70 if (pNewLayout != NULL) 71 { 72 pInput->pLayout = pNewLayout; 73 pInput->wFlags |= INPUT_LIST_NODE_FLAG_EDITED; 74 } 75 } 76 77 EndDialog(hwndDlg, LOWORD(wParam)); 78 } 79 break; 80 81 case IDCANCEL: 82 { 83 EndDialog(hwndDlg, LOWORD(wParam)); 84 } 85 break; 86 } 87 } 88 break; 89 } 90 91 return FALSE; 92 } 93