73a6031fbb2a00c4e7aa3157ee604050130c2c86
[reactos.git] / reactos / dll / cpl / intl_new / extra.c
1 /*
2 * PROJECT: ReactOS International Control Panel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/cpl/intl/extra.c
5 * PURPOSE: Extra parameters page
6 * PROGRAMMERS: Alexey Zavyalov (gen_x@mail.ru)
7 */
8
9 /* INCLUDES *****************************************************************/
10
11 #include <windows.h>
12 #include <commctrl.h>
13 #include <cpl.h>
14
15 #include "intl.h"
16 #include "resource.h"
17
18 /* GLOBALS ******************************************************************/
19
20 HWND hLanguageList;
21
22 /* FUNCTIONS ****************************************************************/
23
24 /* Language enumerate procedure */
25 BOOL
26 CALLBACK
27 LanguagesEnumProc(LPTSTR lpLanguage)
28 {
29 LCID Lcid;
30 TCHAR Lang[MAX_STR_SIZE];
31 int Index;
32
33 Lcid = wcstoul(lpLanguage, NULL, 16);
34
35 GetLocaleInfo(Lcid, LOCALE_SLANGUAGE, Lang, sizeof(Lang));
36 Index = (int) SendMessageW(hLanguageList,
37 CB_ADDSTRING,
38 0,
39 (LPARAM)Lang);
40
41 SendMessageW(hLanguageList,
42 CB_SETITEMDATA,
43 Index,
44 (LPARAM)Lcid);
45
46 return TRUE;
47 }
48
49 /* Enumerate all installed language identifiers */
50 static
51 VOID
52 CreateLanguagesList(HWND hWnd)
53 {
54 TCHAR LangSel[MAX_STR_SIZE];
55
56 hLanguageList = hWnd;
57
58 EnumSystemLocalesW(LanguagesEnumProc, LCID_INSTALLED);
59
60 // Select current locale
61 GetLocaleInfo(GetUserDefaultLCID(),
62 LOCALE_SLANGUAGE,
63 LangSel,
64 sizeof(LangSel));
65
66 SendMessageW(hLanguageList,
67 CB_SELECTSTRING,
68 (WPARAM) -1,
69 (LPARAM)LangSel);
70 }
71
72
73 /* Extra Parameters page dialog callback */
74 INT_PTR
75 CALLBACK
76 ExtraOptsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
77 {
78 UNREFERENCED_PARAMETER(wParam);
79 switch(uMsg)
80 {
81 case WM_INITDIALOG:
82 CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGE_COMBO));
83 break;
84
85 case WM_COMMAND:
86
87 break;
88
89 case WM_NOTIFY:
90 {
91 LPNMHDR Lpnm = (LPNMHDR)lParam;
92 /* If push apply button */
93 if (Lpnm->code == (UINT)PSN_APPLY)
94 {
95 // TODO: Implement
96 }
97 }
98 break;
99 }
100 return FALSE;
101 }
102
103 /* EOF */