reverting : revison 22930 to 22932, 22938 to 22940, 22943, 22945, 22950, 22953 to...
[reactos.git] / reactos / dll / cpl / intl_new / intl.c
1 /*
2 * PROJECT: ReactOS International Control Panel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/cpl/intl/intl.c
5 * PURPOSE: ReactOS International Control Panel
6 * PROGRAMMERS: Eric Kohl
7 * Alexey Zavyalov (gen_x@mail.ru)
8 */
9
10 /* INCLUDES *****************************************************************/
11
12 #include <windows.h>
13 #include <commctrl.h>
14 #include <cpl.h>
15
16 #include "resource.h"
17 #include "intl.h"
18
19 /* GLOBALS ******************************************************************/
20
21 #define NUM_APPLETS (1)
22 #define NUM_SHEETS 2
23
24 LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam);
25
26 HINSTANCE hApplet;
27
28 APPLET Applets[NUM_APPLETS] =
29 {
30 {IDC_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
31 };
32
33 /* FUNCTIONS ****************************************************************/
34
35 static
36 VOID
37 InitPropSheetPage(PROPSHEETPAGE *PsPage, WORD IdDlg, DLGPROC DlgProc)
38 {
39 ZeroMemory(PsPage, sizeof(PROPSHEETPAGE));
40 PsPage->dwSize = sizeof(PROPSHEETPAGE);
41 PsPage->dwFlags = PSP_DEFAULT;
42 PsPage->hInstance = hApplet;
43 PsPage->pszTemplate = MAKEINTRESOURCE(IdDlg);
44 PsPage->pfnDlgProc = DlgProc;
45 }
46
47 /* Create applets */
48 LONG
49 APIENTRY
50 Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
51 {
52
53 PROPSHEETPAGE PsPage[NUM_SHEETS];
54 PROPSHEETHEADER psh;
55 TCHAR Caption[MAX_STR_SIZE];
56
57 LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
58
59 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
60 psh.dwSize = sizeof(PROPSHEETHEADER);
61 psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE;
62 psh.hwndParent = NULL;
63 psh.hInstance = hApplet;
64 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
65 psh.pszCaption = Caption;
66 psh.nPages = sizeof(PsPage) / sizeof(PROPSHEETPAGE);
67 psh.nStartPage = 0;
68 psh.ppsp = PsPage;
69
70 InitPropSheetPage(&PsPage[0], IDD_REGOPTSPAGE, RegOptsProc);
71 InitPropSheetPage(&PsPage[1], IDD_EXTRAOPTSPAGE, ExtraOptsProc);
72
73 return (LONG)(PropertySheet(&psh) != -1);
74 }
75
76 /* Control Panel Callback */
77 LONG
78 CALLBACK
79 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
80 {
81 switch(uMsg)
82 {
83 case CPL_INIT:
84 {
85 return TRUE;
86 }
87 case CPL_GETCOUNT:
88 {
89 return NUM_APPLETS;
90 }
91 case CPL_INQUIRE:
92 {
93 CPLINFO *CplInfo = (CPLINFO*)lParam2;
94 UINT uAppIndex = (UINT)lParam1;
95
96 CplInfo->lData = 0;
97 CplInfo->idIcon = Applets[uAppIndex].idIcon;
98 CplInfo->idName = Applets[uAppIndex].idName;
99 CplInfo->idInfo = Applets[uAppIndex].idDescription;
100 break;
101 }
102 case CPL_DBLCLK:
103 {
104 UINT uAppIndex = (UINT)lParam1;
105 Applets[uAppIndex].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
106 break;
107 }
108 }
109
110 return FALSE;
111 }
112
113 /* Standart DLL entry */
114
115 BOOL
116 STDCALL
117 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
118 {
119 INITCOMMONCONTROLSEX InitControls;
120 switch(dwReason)
121 {
122 case DLL_PROCESS_ATTACH:
123 case DLL_THREAD_ATTACH:
124 {
125 InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
126 InitControls.dwICC = ICC_LISTVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_BAR_CLASSES;
127 InitCommonControlsEx(&InitControls);
128
129 hApplet = hinstDLL;
130 break;
131 }
132 }
133
134
135 return TRUE;
136 }
137
138 /* EOF */