Alexey Zavyalov: Add functionally Numbers, Currency, Time, Date tabs. Fix some bugs.
[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: dll/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,
77 UINT uMsg,
78 WPARAM wParam,
79 LPARAM lParam)
80 {
81 UNREFERENCED_PARAMETER(wParam);
82 switch(uMsg)
83 {
84 case WM_INITDIALOG:
85 CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGE_COMBO));
86 break;
87
88 case WM_COMMAND:
89
90 break;
91
92 case WM_NOTIFY:
93 {
94 LPNMHDR Lpnm = (LPNMHDR)lParam;
95 /* If push apply button */
96 if (Lpnm->code == (UINT)PSN_APPLY)
97 {
98 // TODO: Implement
99 }
100 }
101 break;
102 }
103 return FALSE;
104 }
105
106 /* EOF */